Skip to content

Commit 1940658

Browse files
Merge branch 'main' into feat/add-login-button
2 parents 5e57709 + 6d52e62 commit 1940658

File tree

52 files changed

+581
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+581
-624
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# Snyk Security Changelog
22

3-
## [Unreleased]
3+
## [3.0.0]
44
### Changes
55
- process api URL from hasAuthenticated message
66
- add release channel preference to select which CLI is downloaded
77
- added plugin installed event and analytics sender
8+
- added new UI view to display issue details for all scan types
9+
- removed legacy UI view
10+
- added Snyk Code consistent ignores support
11+
- added Net new issues support
812

913
## [2.2.0] - v20241024.154007
1014
### Changes

plugin/plugin.xml

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</extension>
4242
<extension point="org.eclipse.ui.commands">
4343
<command
44-
defaultHandler="io.snyk.eclipse.plugin.views.MenuHandler"
44+
defaultHandler="io.snyk.eclipse.plugin.views.ScanWorkspaceFolderHandler"
4545
id="io.snyk.eclipse.plugin.commands.execute"
4646
name="%command.name">
4747
</command>
@@ -102,7 +102,7 @@
102102
</command>
103103
<command
104104
id="io.snyk.eclipse.plugin.commands.enableIAC"
105-
name="Infrastructure as Code"
105+
name="Configuration"
106106
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.EnableIacProductHandler">
107107
</command>
108108
<command
@@ -117,44 +117,34 @@
117117
</command>
118118
<command
119119
id="io.snyk.eclipse.plugin.commands.snykFilterNetNewIssues"
120-
name="Net New Issues"
121-
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.FilterDeltaNewIssuesHandler">
120+
name="Show only Net New Issues"
121+
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.FilterNetNewIssuesHandler">
122122
</command>
123123
<command
124124
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.FilterIgnoresOpenIssuesHandler"
125125
id="io.snyk.eclipse.plugin.commands.snykShowOpenIgnored"
126-
name="Open Issues">
126+
name="Show open Issues">
127127
</command>
128128
<command
129129
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.FilterIgnoresIgnoredIssuesHandler"
130130
id="io.snyk.eclipse.plugin.commands.snykShowIgnored"
131-
name="Ignored Issues">
131+
name="Show ignored Issues">
132132
</command>
133133
<command
134134
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.FilterFixableIssuesHandler"
135135
id="io.snyk.eclipse.plugin.commands.snykFilterFixableIssues"
136-
name="AI Fixable">
136+
name="Show only fixable issues">
137137
</command>
138138
<command
139-
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.FilterOssFixableIssuesHandler"
140-
id="io.snyk.eclipse.plugin.commands.snykFilterOssFixableIssues"
141-
name="Fixable">
142-
</command>
143-
<command
144-
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.EnableAllAiFixHandler"
145-
id="io.snyk.eclipse.plugin.snykShowAllSeverities"
139+
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.EnableAllSeveritiesHandler"
140+
id="io.snyk.eclipse.plugin.commands.snykShowAllSeverities"
146141
name="Show All Severities">
147142
</command>
148143
<command
149144
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.EnableAllProductHandler"
150145
id="io.snyk.eclipse.plugin.command.snykShowAllProducts"
151146
name="Show All Products">
152147
</command>
153-
<command
154-
defaultHandler="io.snyk.eclipse.plugin.views.snyktoolview.handlers.EnableAllIssuesHandler"
155-
id="io.snyk.eclipse.plugin.command.snykShowAllIssuesStatus"
156-
name="Show All Issues">
157-
</command>
158148
</extension>
159149
<extension point="org.eclipse.ui.menus">
160150
<menuContribution
@@ -284,7 +274,7 @@
284274
visible="true">
285275
</separator>
286276
<command
287-
commandId="io.snyk.eclipse.plugin.snykShowAllSeverities"
277+
commandId="io.snyk.eclipse.plugin.commands.snykShowAllSeverities"
288278
icon="icons/enabled.png"
289279
style="push"
290280
tooltip="Show Issues of all Severities">
@@ -351,23 +341,13 @@
351341
</command>
352342
</menu>
353343
<menu
354-
id="io.snyk.eclipse.plugin.views.snyktoolview.filtersAiFixMenu"
355-
label="Open Source Fixability">
356-
<command
357-
commandId="io.snyk.eclipse.plugin.commands.snykFilterOssFixableIssues"
358-
icon="icons/enabled.png"
359-
style="push"
360-
tooltip="Show only issues with Open Source Upgrade suggestions">
361-
</command>
362-
</menu>
363-
<menu
364-
id="io.snyk.eclipse.plugin.views.snyktoolview.filtersOssMenu"
365-
label="Code AI Fixability">
344+
id="io.snyk.eclipse.plugin.views.snyktoolview.filtersFixability"
345+
label="Fixability">
366346
<command
367347
commandId="io.snyk.eclipse.plugin.commands.snykFilterFixableIssues"
368348
icon="icons/enabled.png"
369349
style="push"
370-
tooltip="Show only issues with AIFix or Fix suggestions">
350+
tooltip="Show only issues that can be automatically fixed">
371351
</command>
372352
</menu>
373353
</menuContribution>

plugin/src/main/java/io/snyk/eclipse/plugin/html/BaseHtmlProvider.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
import java.util.Map;
55
import java.util.Random;
66

7+
import org.eclipse.core.runtime.Platform;
78
import org.eclipse.jface.resource.ColorRegistry;
89
import org.eclipse.swt.graphics.Color;
910
import org.eclipse.swt.graphics.RGB;
1011
import org.eclipse.ui.PlatformUI;
1112
import org.eclipse.ui.themes.ITheme;
1213
import org.eclipse.ui.themes.IThemeManager;
14+
import org.osgi.framework.Bundle;
1315

1416
import io.snyk.eclipse.plugin.preferences.Preferences;
17+
import io.snyk.eclipse.plugin.utils.ResourceUtils;
1518

1619
public class BaseHtmlProvider {
1720
private final Random random = new Random();
@@ -42,6 +45,55 @@ public String getNonce() {
4245
nonce = nonceBuilder.toString();
4346
return nonce;
4447
}
48+
49+
public String getNoDescriptionHtml() {
50+
String snykWarningText = Platform.getResourceString(Platform.getBundle("io.snyk.eclipse.plugin"),
51+
"%snyk.trust.dialog.warning.text");
52+
53+
Bundle bundle = Platform.getBundle("io.snyk.eclipse.plugin");
54+
String base64Image = ResourceUtils.getBase64Image(bundle, "logo_snyk.png");
55+
56+
var html = """
57+
<!DOCTYPE html>
58+
<html lang="en">
59+
<head>
60+
<meta charset="UTF-8">
61+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
62+
<style>
63+
body {
64+
font-family: var(--default-font);
65+
background-color: var(--background-color);
66+
color: var(--text-color);
67+
}
68+
.container {
69+
display: flex;
70+
align-items: center;
71+
}
72+
.logo {
73+
margin-right: 20px;
74+
}
75+
a {
76+
color: var(--link-color)
77+
}
78+
79+
div {
80+
padding: 20px
81+
}
82+
</style>
83+
</head>
84+
<body>
85+
<div class="container">
86+
<img src='data:image/png;base64,%s' alt='Snyk Logo'>
87+
<div>
88+
<p><strong>Please rescan to see the issue description.</strong></p>
89+
</div>
90+
</div>
91+
</body>
92+
</html>
93+
""".formatted(base64Image, snykWarningText);
94+
return html;
95+
}
96+
4597

4698
public String replaceCssVariables(String html) {
4799
// Build the CSS with the nonce

plugin/src/main/java/io/snyk/eclipse/plugin/html/StaticPageHtmlProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static StaticPageHtmlProvider getInstance() {
1818
}
1919
return instance;
2020
}
21-
21+
2222
public String getInitHtml() {
2323
String snykWarningText = Platform.getResourceString(Platform.getBundle("io.snyk.eclipse.plugin"),
2424
"%snyk.panel.auth.trust.warning.text");
@@ -98,4 +98,6 @@ public String getInitHtml() {
9898
""".formatted(base64Image, snykWarningText);
9999
return replaceCssVariables(html);
100100
}
101+
102+
101103
}

plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,18 @@ public static synchronized Preferences getInstance(PreferenceStore store) {
4646
public static final String LSP_VERSION = "LSP_VERSION";
4747
public static final String USE_TOKEN_AUTH = "useTokenAuth";
4848
public static final String ANALYTICS_PLUGIN_INSTALLED_SENT = "analyticsPluginInstalledSent";
49-
public static final String FILTER_CRITICAL = "FILTER_SNYK_CRITICAL";
50-
public static final String FILTER_HIGH = "FILTER_SNYK_HIGH";
51-
public static final String FILTER_MEDIUM = "FILTER_SNYK_MEDIUM";
52-
public static final String FILTER_LOW = "FILTER_SNYK_LOW";
53-
public static final String FILTER_DELTA_NEW_ISSUES = "FILTER_SNYK_NEW_ISSUES";
54-
public static final String FILTER_IGNORES_SHOW_OPEN_ISSUES = "FILTER_IGNORES_OPEN_ISSUES";
55-
public static final String FILTER_IGNORES_SHOW_IGNORED_ISSUES = "FILTER_IGNORES_IGNORED_ISSUES";
56-
public static final String FILTER_FIXABLE_ISSUES = "FILTER_FIXABLE_ISSUES";
57-
public static final String FILTER_OSS_FIXABLE_ISSUES = "FILTER_OSS_FIXABLE_ISSUES";
49+
public static final String ENABLE_DELTA = "ENABLE_DELTA";
50+
51+
52+
// all filter preferences are positive: SHOW = true, HIDE = false
53+
public static final String FILTER_SHOW_CRITICAL = "FILTER_SHOW_CRITICAL";
54+
public static final String FILTER_SHOW_HIGH = "FILTER_SHOW_HIGH";
55+
public static final String FILTER_SHOW_MEDIUM = "FILTER_SHOW_MEDIUM";
56+
public static final String FILTER_SHOW_LOW = "FILTER_SHOW_LOW";
57+
58+
public static final String FILTER_IGNORES_SHOW_OPEN_ISSUES = "FILTER_IGNORES_SHOW_OPEN_ISSUES";
59+
public static final String FILTER_IGNORES_SHOW_IGNORED_ISSUES = "FILTER_IGNORES_SHOW_IGNORED_ISSUES";
60+
public static final String FILTER_SHOW_ONLY_FIXABLE = "FILTER_SHOW_FIXABLE_AND_UNFIXABLE_ISSUES";
5861

5962
// Feature flags
6063
public static final String IS_GLOBAL_IGNORES_FEATURE_ENABLED = "IS_GLOBAL_IGNORES_FEATURE_ENABLED";
@@ -87,32 +90,29 @@ public static synchronized Preferences getInstance(PreferenceStore store) {
8790
if (getPref(ACTIVATE_SNYK_IAC) == null) {
8891
store(ACTIVATE_SNYK_IAC, "true");
8992
}
90-
if (getPref(FILTER_CRITICAL) == null) {
91-
store(FILTER_CRITICAL, "false");
93+
if (getPref(FILTER_SHOW_CRITICAL) == null) {
94+
store(FILTER_SHOW_CRITICAL, "true");
9295
}
93-
if (getPref(FILTER_HIGH) == null) {
94-
store(FILTER_HIGH, "false");
96+
if (getPref(FILTER_SHOW_HIGH) == null) {
97+
store(FILTER_SHOW_HIGH, "true");
9598
}
96-
if (getPref(FILTER_MEDIUM) == null) {
97-
store(FILTER_MEDIUM, "false");
99+
if (getPref(FILTER_SHOW_MEDIUM) == null) {
100+
store(FILTER_SHOW_MEDIUM, "true");
98101
}
99-
if (getPref(FILTER_LOW) == null) {
100-
store(FILTER_LOW, "false");
102+
if (getPref(FILTER_SHOW_LOW) == null) {
103+
store(FILTER_SHOW_LOW, "true");
101104
}
102-
if (getPref(FILTER_DELTA_NEW_ISSUES) == null) {
103-
store(FILTER_DELTA_NEW_ISSUES, "false");
105+
if (getPref(ENABLE_DELTA) == null) {
106+
store(ENABLE_DELTA, "false");
104107
}
105108
if (getPref(FILTER_IGNORES_SHOW_OPEN_ISSUES) == null) {
106109
store(FILTER_IGNORES_SHOW_OPEN_ISSUES, "true");
107110
}
108111
if (getPref(FILTER_IGNORES_SHOW_IGNORED_ISSUES) == null) {
109-
store(FILTER_IGNORES_SHOW_IGNORED_ISSUES, "true");
110-
}
111-
if (getPref(FILTER_FIXABLE_ISSUES) == null) {
112-
store(FILTER_FIXABLE_ISSUES, "false");
112+
store(FILTER_IGNORES_SHOW_IGNORED_ISSUES, "false");
113113
}
114-
if (getPref(FILTER_OSS_FIXABLE_ISSUES) == null) {
115-
store(FILTER_OSS_FIXABLE_ISSUES, "false");
114+
if (getPref(FILTER_SHOW_ONLY_FIXABLE) == null) {
115+
store(FILTER_SHOW_ONLY_FIXABLE, "false");
116116
}
117117

118118
if (getPref(SEND_ERROR_REPORTS) == null) {
@@ -262,7 +262,7 @@ public boolean isTest() {
262262
}
263263

264264
public static boolean isDeltaEnabled() {
265-
return Preferences.getInstance().getBooleanPref(Preferences.FILTER_DELTA_NEW_ISSUES);
265+
return Preferences.getInstance().getBooleanPref(Preferences.ENABLE_DELTA);
266266
}
267267

268268
public static void setCurrentPreferences(Preferences prefs) {

plugin/src/main/java/io/snyk/eclipse/plugin/views/MenuHandler.java renamed to plugin/src/main/java/io/snyk/eclipse/plugin/views/ScanWorkspaceFolderHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import io.snyk.eclipse.plugin.utils.ResourceUtils;
1717
import io.snyk.languageserver.protocolextension.SnykExtendedLanguageClient;
1818

19-
public class MenuHandler extends AbstractHandler {
19+
public class ScanWorkspaceFolderHandler extends AbstractHandler {
2020

2121
@SuppressWarnings("restriction")
2222
public Object execute(ExecutionEvent event) throws ExecutionException {

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/BrowserHandler.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package io.snyk.eclipse.plugin.views.snyktoolview;
22

3+
import static org.apache.commons.lang3.StringUtils.isEmpty;
4+
35
import java.nio.file.Paths;
46
import java.util.concurrent.CompletableFuture;
57

6-
import org.apache.commons.lang3.StringUtils;
78
import org.eclipse.jface.viewers.TreeNode;
89
import org.eclipse.jface.wizard.WizardDialog;
910
import org.eclipse.lsp4e.LSPEclipseUtils;
@@ -96,7 +97,7 @@ public void changed(LocationEvent event) {
9697
browser.addProgressListener(new ProgressAdapter() {
9798
@Override
9899
public void completed(ProgressEvent event) {
99-
if (!StringUtils.isEmpty(initScript)) {
100+
if (!isEmpty(initScript)) {
100101
browser.execute(initScript);
101102
}
102103
}
@@ -130,9 +131,14 @@ public CompletableFuture<Void> updateBrowserContent(TreeNode node) {
130131
return CompletableFuture.supplyAsync(() -> {
131132
return generateHtmlContent(node);
132133
}).thenAccept(htmlContent -> {
133-
var content = htmlProvider.replaceCssVariables(htmlContent);
134+
if (isEmpty(htmlContent)) {
135+
htmlContent = htmlProvider.getNoDescriptionHtml();
136+
}
137+
138+
final var browserContent = htmlProvider.replaceCssVariables(htmlContent);
139+
134140
Display.getDefault().syncExec(() -> {
135-
browser.setText(content);
141+
browser.setText(browserContent);
136142
});
137143
});
138144
}

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/SnykToolView.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ public void selectionChanged(SelectionChangedEvent event) {
131131

132132
if (Preferences.isDeltaEnabled())
133133
this.enableDelta();
134+
135+
// initialize the filters
136+
TreeFilterManager.getInstance();
134137
}
135138

136139
private void registerTreeContextMenu(Control control) {
@@ -406,10 +409,6 @@ public void disableDelta() {
406409
}
407410
}
408411
}
409-
410-
CompletableFuture.runAsync(() -> {
411-
SnykExtendedLanguageClient.getInstance().triggerScan(null);
412-
});
413412
}
414413

415414
// Helper method to add a command if it's not already present

0 commit comments

Comments
 (0)