Skip to content

Commit 9d5428c

Browse files
ackecursoragent
andauthored
feat(secrets): persist and run Secrets with other scanners [IDE-1747] (#791)
* feat(secrets): persist and run Secrets with other scanners [IDE-1747] - Add activateSnykSecrets to SaveConfigRequest and apply in SaveConfigHandler - Add activateSnykSecrets to LanguageServerSettings and getSettings() - Add secretsResults to TreeFiltering and matchFilteringWithEnablement - Add Secrets scan action to SnykTreeScanTypeFilterActionGroup Co-authored-by: Cursor <cursoragent@cursor.com> * feat(ui): add Secrets root to tool window tree and fix clean-all [IDE-1747] - Add RootSecretsIssuesTreeNode and SECRETS_ROOT_TEXT; tree shows four roots (OSS, Code Security, IaC, Secrets) before and after any scan. - Include Secrets root in removeAllChildren and updateTreeRootNodesPresentation so Clean all results keeps all four roots with labels reset. - Wire Secrets in SnykToolWindowSnykScanListener: scanningStarted/scanningError clear Secrets node; displaySecretsResults and filter refresh populate it. - Map ScanIssue.SECRETS in description panel and flushPendingTreeRefreshes. - Tests: expect four roots, pass rootSecretsIssuesTreeNode, assert no null on Secrets node after clean. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(ui): show Secrets in HTML tree view on first load [IDE-1747] Add Secrets product node to TreeViewInit.html so the initial HTML tree view displays all four products (OSS, Code Security, IaC, Secrets) from plugin load instead of showing Secrets only after the LS sends a tree view update. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(toolwindow): remove Secrets from native tree [IDE-1747] - Remove RootSecretsIssuesTreeNode and delete its class file; Secrets are shown only in the LS-driven HTML tree view (snykTreeView), not in the native Swing tree. - SnykToolWindowSnykScanListener now takes three roots (OSS, Code, IaC); remove all LsProduct.Secrets handling (scanningStarted, scanningError, displaySecretsResults, SECRETS branch in displayResults/displayIssues). - Panel: stop creating/passing Secrets root, drop Secrets from filtering callback and from flushPendingTreeRefreshes. - Update tests for 3-root native tree. Made-with: Cursor * chore(toolwindow): remove SECRETS_ROOT_TEXT, add Secrets description handlers [IDE-1747] - Remove unused SECRETS_ROOT_TEXT from SnykToolWindowPanel companion object. - Add ScanIssue.SECRETS branch in SuggestionDescriptionPanel.initializeBrowser() with SubmitIgnoreRequestHandler so Secrets issue detail HTML can trigger ignore requests (parity with VS Code submitIgnoreRequest). Made-with: Cursor * refactor(toolwindow): remove Secrets from tree filter and HTML tree [IDE-1747] - Drop treeFiltering.secretsResults and matchFiltering sync (native tree not used for Secrets) - Remove createSecretsScanAction and Secrets from scan-type filter menu - Remove product-secrets node from TreeViewInit.html - Test: use 3-param updateTreeRootNodesPresentation call and comment Made-with: Cursor * refactor(toolwindow): remove unused secrets count from tree presentation [IDE-1747] - Drop secretsResultsCount param from displayIssues and updateTreeRootNodesPresentation - Restore Secrets cache clear and comments in scan listener (scan started / scan error) - Call sites: use 3 counts + addHMLPostfix only; test keeps positional updateTreeRootNodesPresentation(0, 0, 0, "") Made-with: Cursor * refactor(toolwindow): remove redundant SECRETS branches for PR review [IDE-1747] - Panel: drop SECRETS branch in productIssues when; Secrets only in HTML tree - SuggestionDescriptionPanel: remove SECRETS SubmitIgnoreRequestHandler block Made-with: Cursor --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4d57c71 commit 9d5428c

5 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/kotlin/io/snyk/plugin/ui/jcef/ConfigurationDataClasses.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ data class SaveConfigRequest(
5656
@SerializedName("activateSnykOpenSource") val activateSnykOpenSource: Boolean? = null,
5757
@SerializedName("activateSnykCode") val activateSnykCode: Boolean? = null,
5858
@SerializedName("activateSnykIac") val activateSnykIac: Boolean? = null,
59+
@SerializedName("activateSnykSecrets") val activateSnykSecrets: Boolean? = null,
5960
@SerializedName("scanningMode") val scanningMode: String? = null,
6061

6162
// Connection Settings

src/main/kotlin/io/snyk/plugin/ui/jcef/SaveConfigHandler.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ class SaveConfigHandler(
212212
settings.ossScanEnable = config.activateSnykOpenSource ?: false
213213
settings.snykCodeSecurityIssuesScanEnable = config.activateSnykCode ?: false
214214
settings.iacScanEnabled = config.activateSnykIac ?: false
215+
settings.secretsEnabled = config.activateSnykSecrets ?: false
215216

216217
// Scanning mode
217218
config.scanningMode?.let { settings.scanOnSave = (it == "auto") }

src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykToolWindowPanel.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,7 @@ class SnykToolWindowPanel(val project: Project) : JPanel(), Disposable {
385385
ScanIssue.CODE_SECURITY -> cache?.currentSnykCodeResultsLS
386386
ScanIssue.OPEN_SOURCE -> cache?.currentOSSResultsLS
387387
ScanIssue.INFRASTRUCTURE_AS_CODE -> cache?.currentIacResultsLS
388-
else -> {
389-
null
390-
}
388+
else -> null
391389
}
392390
productIssues?.values?.any { issues -> issues.any { issue.id == it.id } } == true
393391
} else {
@@ -538,7 +536,7 @@ class SnykToolWindowPanel(val project: Project) : JPanel(), Disposable {
538536
scanListenerLS.displayIacResults(results)
539537
}
540538
}
541-
LsProduct.Secrets -> Unit // we use the HTML tree for secrets
539+
LsProduct.Secrets -> Unit
542540
LsProduct.Unknown -> Unit
543541
}
544542
}

src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ class LanguageServerWrapper(private val project: Project) : Disposable {
557557
activateSnykOpenSource = ps.ossScanEnable.toString(),
558558
activateSnykCodeSecurity = ps.snykCodeSecurityIssuesScanEnable.toString(),
559559
activateSnykIac = ps.iacScanEnabled.toString(),
560+
activateSnykSecrets = ps.secretsEnabled.toString(),
560561
organization = ps.organization ?: "",
561562
insecure = ps.ignoreUnknownCA.toString(),
562563
endpoint = getEndpointUrl(),

src/main/kotlin/snyk/common/lsp/settings/LanguageServerSettings.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ data class LanguageServerSettings(
1313
@SerializedName("activateSnykOpenSource") val activateSnykOpenSource: String? = "false",
1414
@SerializedName("activateSnykCode") val activateSnykCode: String? = "false",
1515
@SerializedName("activateSnykIac") val activateSnykIac: String? = "false",
16+
@SerializedName("activateSnykSecrets") val activateSnykSecrets: String? = "false",
1617
@SerializedName("insecure") val insecure: String?,
1718
@SerializedName("endpoint") val endpoint: String?,
1819
@SerializedName("additionalParams") val additionalParams: String? = null,

0 commit comments

Comments
 (0)