-
Notifications
You must be signed in to change notification settings - Fork 16
refactor(oss): delegate C/C++ auto-detect to CLI extension [IDE-2089] #1311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c3eb8e8
cf9c7f4
3201d94
c3d7e4c
68f9a01
31e8837
ec992dd
04bb3f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| IDE-1898: The Eclipse plugin shall successfully complete LSP initialization regardless of the number of workspace folders. | ||
| IDE-1898: When a feature flag is deactivated, the IDE plugin shall observe the change within 60 seconds. | ||
| IDE-1898: When a user authenticates, the IDE plugin shall immediately re-evaluate feature flags without waiting for any previously cached authentication failures to expire. | ||
| IDE-2089: snyk-ls shall set `SNYK_AUTODETECT_OSS=1` in the environment of every Snyk OSS CLI invocation so the CLI's os-flows extension can decide per-folder whether to also run an unmanaged scan. | ||
| IDE-2089: The CLI's `cli-extension-os-flows` extension shall, when `SNYK_AUTODETECT_OSS` is truthy and `--unmanaged` was not explicitly passed, inspect each input directory for C/C++ source, header, or build-system files and run an extra unmanaged scan alongside the managed scan when any are found. | ||
| IDE-2089: When the extension runs an extra unmanaged scan it shall return the unmanaged results alongside the managed results so both are presented to the user without per-folder IDE configuration. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,6 +203,7 @@ func (cliScanner *CLIScanner) Scan(ctx context.Context, pathToScan types.FilePat | |
| logger.Debug().Msg("Open Source scan skipped: path is not a supported manifest, lockfile, or directory") | ||
| return []types.Issue{}, nil | ||
| } | ||
|
|
||
| return cliScanner.scanInternal(ctx, cliScanner.prepareScanCommand) | ||
| } | ||
|
|
||
|
|
@@ -392,6 +393,14 @@ func (cliScanner *CLIScanner) prepareScanCommand(args []string, parameterBlackli | |
| if params := cliScanner.configResolver.GetStringSlice(types.SettingCliAdditionalOssParameters, folderConfig); len(params) > 0 { | ||
| args = append(args, params...) | ||
| } | ||
| // Opt the CLI's os-flows extension into auto-detecting C/C++ projects: | ||
| // when set, it runs an extra unmanaged scan alongside the managed scan | ||
| // for folders that look unmanaged-eligible, so the LS doesn't need to | ||
| // prompt or expose a per-folder toggle. | ||
| if env == nil { | ||
| env = gotenv.Env{} | ||
| } | ||
| env["SNYK_AUTODETECT_OSS"] = "1" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion (non-blocking). The string literal
Verified the feared interactions are non-issues: setting this unconditionally alongside a user-supplied — AI review |
||
|
|
||
| processedArgs := []string{} | ||
| // now add all additional parameters, skipping blacklisted ones | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
getCommand(infrastructure/cli/cli.go) treats a non-nilenvas the complete subprocess environment and skips loadingos.Environ(). Today that's safe becauseupdateArgs→GetEnvFromSystemAndConfigurationalways returns a fully OS-populated map. But the newif env == nil { env = gotenv.Env{} }guard codifies a path that, if ever reached, would handgetCommanda map containing onlySNYK_AUTODETECT_OSS=1— stripping PATH and the rest of the OS env from the CLI subprocess. Consider a one-line comment naming that invariant, or setting the var via the existingAppendCliEnvironmentVariablesmerge path. Non-blocking.— AI review