From 4afe6ff3353e304eda879e90032eedfd224676fb Mon Sep 17 00:00:00 2001 From: Jeppe Fredsgaard Blaabjerg Date: Wed, 2 Dec 2026 15:33:49 +0100 Subject: [PATCH 1/4] fix(scan): say which early stops --reach-continue-on-analysis-errors covers The help listed timeouts and OOM as analysis errors without saying that an analysis that stops early at the timeout or memory limit, but still returns results, is not one: Coana reports what it found, and the vulnerabilities it found no path to as unreachable. --- src/commands/scan/cmd-scan-create.test.mts | 2 +- src/commands/scan/cmd-scan-reach.test.mts | 2 +- src/commands/scan/reachability-flags.mts | 2 +- .../cli.native.socket-help-scan-create.svg | 130 +++++++++--------- .../cli.native.socket-help-scan-reach.svg | 86 ++++++------ 5 files changed, 113 insertions(+), 109 deletions(-) diff --git a/src/commands/scan/cmd-scan-create.test.mts b/src/commands/scan/cmd-scan-create.test.mts index aa4b5af29..37dc88226 100644 --- a/src/commands/scan/cmd-scan-create.test.mts +++ b/src/commands/scan/cmd-scan-create.test.mts @@ -128,7 +128,7 @@ describe('socket scan create', async () => { --reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB. --reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly. --reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. - --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. + --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory limit but still returns results is not an error. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors. --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version catalog / pre-generated SBOM). By default, the CLI halts. --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By default, the CLI halts. diff --git a/src/commands/scan/cmd-scan-reach.test.mts b/src/commands/scan/cmd-scan-reach.test.mts index 9eb0c170c..a3aa46cf1 100644 --- a/src/commands/scan/cmd-scan-reach.test.mts +++ b/src/commands/scan/cmd-scan-reach.test.mts @@ -46,7 +46,7 @@ describe('socket scan reach', async () => { --reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB. --reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly. --reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. - --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. + --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory limit but still returns results is not an error. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors. --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version catalog / pre-generated SBOM). By default, the CLI halts. --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By default, the CLI halts. diff --git a/src/commands/scan/reachability-flags.mts b/src/commands/scan/reachability-flags.mts index 8f8361383..b9dcca8fe 100644 --- a/src/commands/scan/reachability-flags.mts +++ b/src/commands/scan/reachability-flags.mts @@ -79,7 +79,7 @@ export const reachabilityFlags: MeowFlags = { type: 'boolean', default: false, description: - 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors.', + 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory limit but still returns results is not an error.', }, reachContinueOnInstallErrors: { type: 'boolean', diff --git a/test/snapshots/termless/cli.native.socket-help-scan-create.svg b/test/snapshots/termless/cli.native.socket-help-scan-create.svg index 550c83391..e82e08e6c 100644 --- a/test/snapshots/termless/cli.native.socket-help-scan-create.svg +++ b/test/snapshots/termless/cli.native.socket-help-scan-create.svg @@ -1,4 +1,4 @@ - + CLI: v2.1.0-rc.0 | cmd: socket scan create | org: (not set) | token: (not set) @@ -127,129 +127,129 @@ --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back -to precomputed reachability results. By default, the CLI halts on analysis errors. +to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory lim - --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi +it but still returns results is not an error. -lity results. By default, the CLI halts on installation errors. + --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi - --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version +lity results. By default, the CLI halts on installation errors. - catalog / pre-generated SBOM). By default, the CLI halts. + --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version - --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By defa + catalog / pre-generated SBOM). By default, the CLI halts. -ult, the CLI halts. + --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By defa - --reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI. +ult, the CLI halts. - --reach-detailed-analysis-log-file A log file with detailed analysis logs is written to root of each analyzed workspace. + --reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI. - --reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations. + --reach-detailed-analysis-log-file A log file with detailed analysis logs is written to root of each analyzed workspace. - --reach-disable-dependency-downloads Only analyze dependencies that are already installed (e.g. in the project's .venv, vendor director + --reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations. -y or module cache). Missing dependencies count as installation failures. + --reach-disable-dependency-downloads Only analyze dependencies that are already installed (e.g. in the project's .venv, vendor director - --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. +y or module cache). Missing dependencies count as installation failures. - --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supp + --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. -orted: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. + --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supp - --reach-fallback-to-regular-scan If reachability analysis fails, continue with a regular SCA scan (without reachability results) instea +orted: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. -d of halting. By default, the CLI halts on reachability errors. + --reach-fallback-to-regular-scan If reachability analysis fails, continue with a regular SCA scan (without reachability results) instea - --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d +d of halting. By default, the CLI halts on reachability errors. -eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a + --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d -n SBOM carrying stale reachability results. +eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a - --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous +n SBOM carrying stale reachability results. - runs to speed up the analysis. + --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous - --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your + runs to speed up the analysis. -project. + --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your - --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. +project. - + --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. - Uploads the specified dependency manifest files for Go, Gradle, JavaScript, + - Kotlin, Python, and Scala. Files like "package.json" and "requirements.txt". + Uploads the specified dependency manifest files for Go, Gradle, JavaScript, - If any folder is specified, the ones found in there recursively are uploaded. + Kotlin, Python, and Scala. Files like "package.json" and "requirements.txt". - + If any folder is specified, the ones found in there recursively are uploaded. - Details on TARGET: - + + Details on TARGET: - - Defaults to the current dir (cwd) if none given + - - Multiple targets can be specified + - Defaults to the current dir (cwd) if none given - - If a target is a file, only that file is checked + - Multiple targets can be specified - - If it is a dir, the dir is scanned for any supported manifest files + - If a target is a file, only that file is checked - - Dirs MUST be within the current dir (cwd), you can use --cwd to change it + - If it is a dir, the dir is scanned for any supported manifest files - - Supports globbing such as "**/package.json", "**/requirements.txt", etc. + - Dirs MUST be within the current dir (cwd), you can use --cwd to change it - - Ignores any file specified in your project's ".gitignore" + - Supports globbing such as "**/package.json", "**/requirements.txt", etc. - - Also a sensible set of default ignores from the "ignore-by-default" module + - Ignores any file specified in your project's ".gitignore" - + - Also a sensible set of default ignores from the "ignore-by-default" module - The --repo and --branch flags tell Socket to associate this Scan with that + - repo/branch. The names will show up on your dashboard on the Socket website. + The --repo and --branch flags tell Socket to associate this Scan with that - + repo/branch. The names will show up on your dashboard on the Socket website. - Note: for a first run you probably want to set --default-branch to indicate + - the default branch name, like "main" or "master". + Note: for a first run you probably want to set --default-branch to indicate - + the default branch name, like "main" or "master". - The "alerts page" (​https://socket.dev/dashboard/org/YOURORG/alerts​) will show + - the results from the last scan designated as the "pending head" on the branch + The "alerts page" (​https://socket.dev/dashboard/org/YOURORG/alerts​) will show - configured on Socket to be the "default branch". When creating a scan the + the results from the last scan designated as the "pending head" on the branch - --set-as-alerts-page flag will default to true to update this. You can prevent + configured on Socket to be the "default branch". When creating a scan the - this by using --no-set-as-alerts-page. This flag is ignored for any branch that + --set-as-alerts-page flag will default to true to update this. You can prevent - is not designated as the "default branch". It is disabled when using --tmp. + this by using --no-set-as-alerts-page. This flag is ignored for any branch that - + is not designated as the "default branch". It is disabled when using --tmp. - You can use `socket scan setup` to configure certain repo flag defaults. - + + You can use `socket scan setup` to configure certain repo flag defaults. - Examples + - $ socket scan create + Examples - $ socket scan create ./proj --json + $ socket scan create - $ socket scan create --repo=test-repo --branch=main ./package.json + $ socket scan create ./proj --json - $ socket scan create --uv-members ./packages/api ./packages/worker + $ socket scan create --repo=test-repo --branch=main ./package.json - + $ socket scan create --uv-members ./packages/api ./packages/worker @@ -258,4 +258,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/test/snapshots/termless/cli.native.socket-help-scan-reach.svg b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg index 6f063d190..b99f14980 100644 --- a/test/snapshots/termless/cli.native.socket-help-scan-reach.svg +++ b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg @@ -1,4 +1,4 @@ - + CLI: v2.1.0-rc.0 | cmd: socket scan reach | org: (not set) | token: (not set) @@ -83,85 +83,85 @@ --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back -to precomputed reachability results. By default, the CLI halts on analysis errors. +to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory lim - --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi +it but still returns results is not an error. -lity results. By default, the CLI halts on installation errors. + --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi - --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version +lity results. By default, the CLI halts on installation errors. - catalog / pre-generated SBOM). By default, the CLI halts. + --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version - --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By defa + catalog / pre-generated SBOM). By default, the CLI halts. -ult, the CLI halts. + --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By defa - --reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI. +ult, the CLI halts. - --reach-detailed-analysis-log-file A log file with detailed analysis logs is written to root of each analyzed workspace. + --reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI. - --reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations. + --reach-detailed-analysis-log-file A log file with detailed analysis logs is written to root of each analyzed workspace. - --reach-disable-dependency-downloads Only analyze dependencies that are already installed (e.g. in the project's .venv, vendor director + --reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations. -y or module cache). Missing dependencies count as installation failures. + --reach-disable-dependency-downloads Only analyze dependencies that are already installed (e.g. in the project's .venv, vendor director - --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. +y or module cache). Missing dependencies count as installation failures. - --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supp + --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. -orted: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. + --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supp - --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d +orted: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. -eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a + --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d -n SBOM carrying stale reachability results. +eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a - --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous +n SBOM carrying stale reachability results. - runs to speed up the analysis. + --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous - --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your + runs to speed up the analysis. -project. + --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your - --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. +project. - + --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. - Runs the Socket reachability analysis without creating a scan in Socket. + - The output is written to .socket.facts.json in the current working directory + Runs the Socket reachability analysis without creating a scan in Socket. - unless the --output flag is specified. + The output is written to .socket.facts.json in the current working directory - + unless the --output flag is specified. - Note: Manifest files are uploaded to Socket's backend services because the + - reachability analysis requires creating a Software Bill of Materials (SBOM) + Note: Manifest files are uploaded to Socket's backend services because the - from these files before the analysis can run. + reachability analysis requires creating a Software Bill of Materials (SBOM) - + from these files before the analysis can run. - Examples + - $ socket scan reach + Examples - $ socket scan reach ./proj + $ socket scan reach - $ socket scan reach ./proj --reach-ecosystems npm,pypi + $ socket scan reach ./proj - $ socket scan reach ./monorepo --dynamic-sbom-inference + $ socket scan reach ./proj --reach-ecosystems npm,pypi - $ socket scan reach --output custom-report.json + $ socket scan reach ./monorepo --dynamic-sbom-inference - $ socket scan reach ./proj --output ./reports/analysis.json + $ socket scan reach --output custom-report.json - + $ socket scan reach ./proj --output ./reports/analysis.json @@ -170,4 +170,6 @@ - \ No newline at end of file + + + \ No newline at end of file From 0eb6a0415447aa780918aa83ed30635158a9f795 Mon Sep 17 00:00:00 2001 From: Jeppe Fredsgaard Blaabjerg Date: Wed, 2 Dec 2026 16:22:27 +0100 Subject: [PATCH 2/4] feat(scan): add --reach-incomplete-analysis-as-error An analysis that stops early at the timeout or memory limit reports the vulnerabilities it found no path to as unreachable. The new flag passes Coana's --incomplete-analysis-as-error, which reports them as analysis errors instead: the scan halts, or with --reach-continue-on-analysis-errors falls back to precomputed results. The --reach-continue-on-analysis-errors help now says how the two combine, in place of the sentence the previous commit added. --- src/commands/ci/handle-ci.mts | 1 + src/commands/scan/cmd-scan-create.mts | 3 + src/commands/scan/cmd-scan-create.test.mts | 3 +- src/commands/scan/cmd-scan-reach.mts | 3 + src/commands/scan/cmd-scan-reach.test.mts | 3 +- src/commands/scan/create-scan-from-github.mts | 1 + .../scan/perform-reachability-analysis.mts | 4 + .../perform-reachability-analysis.test.mts | 12 ++ src/commands/scan/reachability-flags.mts | 8 +- test/reachability-options.mts | 1 + .../cli.native.socket-help-scan-create.svg | 104 +++++++++--------- .../cli.native.socket-help-scan-reach.svg | 68 ++++++------ 12 files changed, 128 insertions(+), 83 deletions(-) diff --git a/src/commands/ci/handle-ci.mts b/src/commands/ci/handle-ci.mts index d315d5a12..f5a9434b8 100644 --- a/src/commands/ci/handle-ci.mts +++ b/src/commands/ci/handle-ci.mts @@ -125,6 +125,7 @@ export async function handleCi(autoManifest: boolean): Promise { reachEcosystems: [], reachExcludePaths: [], reachFallbackToRegularScan: false, + reachIncompleteAnalysisAsError: false, reachRetainFactsFile: false, reachSkipCache: false, reachUseOnlyPregeneratedSboms: false, diff --git a/src/commands/scan/cmd-scan-create.mts b/src/commands/scan/cmd-scan-create.mts index 05d7fa7f4..3e88f7fb9 100644 --- a/src/commands/scan/cmd-scan-create.mts +++ b/src/commands/scan/cmd-scan-create.mts @@ -302,6 +302,7 @@ async function run( reachDisableDependencyDownloads, reachDisableExternalToolChecks, reachFallbackToRegularScan, + reachIncompleteAnalysisAsError, reachRetainFactsFile, reachSkipCache, reachUseOnlyPregeneratedSboms, @@ -340,6 +341,7 @@ async function run( reachDisableDependencyDownloads: boolean reachDisableExternalToolChecks: boolean reachFallbackToRegularScan: boolean + reachIncompleteAnalysisAsError: boolean reachRetainFactsFile: boolean reachSkipCache: boolean reachUseOnlyPregeneratedSboms: boolean @@ -710,6 +712,7 @@ async function run( reachEcosystems, reachExcludePaths, reachFallbackToRegularScan: Boolean(reachFallbackToRegularScan), + reachIncompleteAnalysisAsError: Boolean(reachIncompleteAnalysisAsError), reachRetainFactsFile: Boolean(reachRetainFactsFile), reachSkipCache: Boolean(reachSkipCache), reachUseOnlyPregeneratedSboms: Boolean(reachUseOnlyPregeneratedSboms), diff --git a/src/commands/scan/cmd-scan-create.test.mts b/src/commands/scan/cmd-scan-create.test.mts index 37dc88226..85d420906 100644 --- a/src/commands/scan/cmd-scan-create.test.mts +++ b/src/commands/scan/cmd-scan-create.test.mts @@ -128,7 +128,7 @@ describe('socket scan create', async () => { --reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB. --reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly. --reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. - --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory limit but still returns results is not an error. + --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis that stops early with partial results counts as an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors. --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version catalog / pre-generated SBOM). By default, the CLI halts. --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By default, the CLI halts. @@ -139,6 +139,7 @@ describe('socket scan create', async () => { --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supported: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. --reach-fallback-to-regular-scan If reachability analysis fails, continue with a regular SCA scan (without reachability results) instead of halting. By default, the CLI halts on reachability errors. + --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. --reach-retain-facts-file Keep the \`.socket.facts.json\` reachability report that the analysis writes to the scan directory instead of deleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as an SBOM carrying stale reachability results. --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous runs to speed up the analysis. --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your project. diff --git a/src/commands/scan/cmd-scan-reach.mts b/src/commands/scan/cmd-scan-reach.mts index a0526a97c..331c56b83 100644 --- a/src/commands/scan/cmd-scan-reach.mts +++ b/src/commands/scan/cmd-scan-reach.mts @@ -164,6 +164,7 @@ async function run( reachDisableAnalytics, reachDisableDependencyDownloads, reachDisableExternalToolChecks, + reachIncompleteAnalysisAsError, reachRetainFactsFile, reachSkipCache, reachUseOnlyPregeneratedSboms, @@ -187,6 +188,7 @@ async function run( reachDisableAnalytics: boolean reachDisableDependencyDownloads: boolean reachDisableExternalToolChecks: boolean + reachIncompleteAnalysisAsError: boolean reachRetainFactsFile: boolean reachSkipCache: boolean reachUseOnlyPregeneratedSboms: boolean @@ -315,6 +317,7 @@ async function run( reachDisableExternalToolChecks: Boolean(reachDisableExternalToolChecks), reachEcosystems, reachExcludePaths, + reachIncompleteAnalysisAsError: Boolean(reachIncompleteAnalysisAsError), reachRetainFactsFile: Boolean(reachRetainFactsFile), reachSkipCache: Boolean(reachSkipCache), reachUseOnlyPregeneratedSboms: Boolean(reachUseOnlyPregeneratedSboms), diff --git a/src/commands/scan/cmd-scan-reach.test.mts b/src/commands/scan/cmd-scan-reach.test.mts index a3aa46cf1..38695fcb1 100644 --- a/src/commands/scan/cmd-scan-reach.test.mts +++ b/src/commands/scan/cmd-scan-reach.test.mts @@ -46,7 +46,7 @@ describe('socket scan reach', async () => { --reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB. --reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly. --reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. - --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory limit but still returns results is not an error. + --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis that stops early with partial results counts as an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors. --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version catalog / pre-generated SBOM). By default, the CLI halts. --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By default, the CLI halts. @@ -56,6 +56,7 @@ describe('socket scan reach', async () => { --reach-disable-dependency-downloads Only analyze dependencies that are already installed (e.g. in the project's .venv, vendor directory or module cache). Missing dependencies count as installation failures. --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supported: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. + --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. --reach-retain-facts-file Keep the \`.socket.facts.json\` reachability report that the analysis writes to the scan directory instead of deleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as an SBOM carrying stale reachability results. --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous runs to speed up the analysis. --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your project. diff --git a/src/commands/scan/create-scan-from-github.mts b/src/commands/scan/create-scan-from-github.mts index 077df6418..36bc267d5 100644 --- a/src/commands/scan/create-scan-from-github.mts +++ b/src/commands/scan/create-scan-from-github.mts @@ -344,6 +344,7 @@ async function scanOneRepo( reachEcosystems: [], reachExcludePaths: [], reachFallbackToRegularScan: false, + reachIncompleteAnalysisAsError: false, reachRetainFactsFile: false, reachSkipCache: false, reachUseOnlyPregeneratedSboms: false, diff --git a/src/commands/scan/perform-reachability-analysis.mts b/src/commands/scan/perform-reachability-analysis.mts index e141237f9..f5853dab4 100644 --- a/src/commands/scan/perform-reachability-analysis.mts +++ b/src/commands/scan/perform-reachability-analysis.mts @@ -46,6 +46,7 @@ export type ReachabilityOptions = { reachDisableAnalytics: boolean reachEcosystems: PURL_Type[] reachExcludePaths: string[] + reachIncompleteAnalysisAsError: boolean reachRetainFactsFile: boolean reachSkipCache: boolean reachUseOnlyPregeneratedSboms: boolean @@ -243,6 +244,9 @@ export async function performReachabilityAnalysis( ...(reachabilityOptions.reachDisableExternalToolChecks ? ['--disable-external-tool-checks'] : []), + ...(reachabilityOptions.reachIncompleteAnalysisAsError + ? ['--incomplete-analysis-as-error'] + : []), // Older Coana versions split analyses unless this is passed. '--disable-analysis-splitting', '--run-without-docker', diff --git a/src/commands/scan/perform-reachability-analysis.test.mts b/src/commands/scan/perform-reachability-analysis.test.mts index 55c862b97..2acbc25a0 100644 --- a/src/commands/scan/perform-reachability-analysis.test.mts +++ b/src/commands/scan/perform-reachability-analysis.test.mts @@ -333,6 +333,18 @@ describe('performReachabilityAnalysis flag forwarding', () => { const args = await coanaArgsFor(scanCwd, { reachAdvisories: [] }) expect(args).not.toContain('--ghsas') }) + + it('passes --reach-incomplete-analysis-as-error to Coana as --incomplete-analysis-as-error', async () => { + const args = await coanaArgsFor(scanCwd, { + reachIncompleteAnalysisAsError: true, + }) + expect(args).toContain('--incomplete-analysis-as-error') + }) + + it('omits --incomplete-analysis-as-error by default', async () => { + const args = await coanaArgsFor(scanCwd, {}) + expect(args).not.toContain('--incomplete-analysis-as-error') + }) }) describe('performReachabilityAnalysis --use-only-socket-facts-artifacts gating', () => { diff --git a/src/commands/scan/reachability-flags.mts b/src/commands/scan/reachability-flags.mts index b9dcca8fe..59da1cbdd 100644 --- a/src/commands/scan/reachability-flags.mts +++ b/src/commands/scan/reachability-flags.mts @@ -79,7 +79,7 @@ export const reachabilityFlags: MeowFlags = { type: 'boolean', default: false, description: - 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory limit but still returns results is not an error.', + 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis that stops early with partial results counts as an error too.', }, reachContinueOnInstallErrors: { type: 'boolean', @@ -160,6 +160,12 @@ export const reachabilityFlags: MeowFlags = { description: 'If reachability analysis fails, continue with a regular SCA scan (without reachability results) instead of halting. By default, the CLI halts on reachability errors.', }, + reachIncompleteAnalysisAsError: { + type: 'boolean', + default: false, + description: + 'Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set.', + }, reachLazyMode: { type: 'boolean', default: false, diff --git a/test/reachability-options.mts b/test/reachability-options.mts index 70ed0eaa6..101eef0c8 100644 --- a/test/reachability-options.mts +++ b/test/reachability-options.mts @@ -21,6 +21,7 @@ export function makeReachabilityOptions(): ReachabilityOptions { reachDisableExternalToolChecks: false, reachEcosystems: [], reachExcludePaths: [], + reachIncompleteAnalysisAsError: false, reachRetainFactsFile: false, reachSkipCache: false, reachUseOnlyPregeneratedSboms: false, diff --git a/test/snapshots/termless/cli.native.socket-help-scan-create.svg b/test/snapshots/termless/cli.native.socket-help-scan-create.svg index e82e08e6c..730a8ee66 100644 --- a/test/snapshots/termless/cli.native.socket-help-scan-create.svg +++ b/test/snapshots/termless/cli.native.socket-help-scan-create.svg @@ -1,4 +1,4 @@ - + CLI: v2.1.0-rc.0 | cmd: socket scan create | org: (not set) | token: (not set) @@ -127,9 +127,9 @@ --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back -to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory lim +to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis th -it but still returns results is not an error. +at stops early with partial results counts as an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi @@ -163,101 +163,107 @@ d of halting. By default, the CLI halts on reachability errors. - --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d + --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early -eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a + (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless -n SBOM carrying stale reachability results. +--reach-continue-on-analysis-errors is set. - --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous + --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d - runs to speed up the analysis. +eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a - --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your +n SBOM carrying stale reachability results. -project. + --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous - --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. + runs to speed up the analysis. - + --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your - Uploads the specified dependency manifest files for Go, Gradle, JavaScript, +project. - Kotlin, Python, and Scala. Files like "package.json" and "requirements.txt". + --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. - If any folder is specified, the ones found in there recursively are uploaded. - + + Uploads the specified dependency manifest files for Go, Gradle, JavaScript, - Details on TARGET: + Kotlin, Python, and Scala. Files like "package.json" and "requirements.txt". - + If any folder is specified, the ones found in there recursively are uploaded. - - Defaults to the current dir (cwd) if none given + - - Multiple targets can be specified + Details on TARGET: - - If a target is a file, only that file is checked + - - If it is a dir, the dir is scanned for any supported manifest files + - Defaults to the current dir (cwd) if none given - - Dirs MUST be within the current dir (cwd), you can use --cwd to change it + - Multiple targets can be specified - - Supports globbing such as "**/package.json", "**/requirements.txt", etc. + - If a target is a file, only that file is checked - - Ignores any file specified in your project's ".gitignore" + - If it is a dir, the dir is scanned for any supported manifest files - - Also a sensible set of default ignores from the "ignore-by-default" module + - Dirs MUST be within the current dir (cwd), you can use --cwd to change it - + - Supports globbing such as "**/package.json", "**/requirements.txt", etc. - The --repo and --branch flags tell Socket to associate this Scan with that + - Ignores any file specified in your project's ".gitignore" - repo/branch. The names will show up on your dashboard on the Socket website. + - Also a sensible set of default ignores from the "ignore-by-default" module - Note: for a first run you probably want to set --default-branch to indicate + The --repo and --branch flags tell Socket to associate this Scan with that - the default branch name, like "main" or "master". + repo/branch. The names will show up on your dashboard on the Socket website. - The "alerts page" (​https://socket.dev/dashboard/org/YOURORG/alerts​) will show + Note: for a first run you probably want to set --default-branch to indicate - the results from the last scan designated as the "pending head" on the branch + the default branch name, like "main" or "master". - configured on Socket to be the "default branch". When creating a scan the + - --set-as-alerts-page flag will default to true to update this. You can prevent + The "alerts page" (​https://socket.dev/dashboard/org/YOURORG/alerts​) will show - this by using --no-set-as-alerts-page. This flag is ignored for any branch that + the results from the last scan designated as the "pending head" on the branch - is not designated as the "default branch". It is disabled when using --tmp. + configured on Socket to be the "default branch". When creating a scan the - + --set-as-alerts-page flag will default to true to update this. You can prevent - You can use `socket scan setup` to configure certain repo flag defaults. + this by using --no-set-as-alerts-page. This flag is ignored for any branch that - + is not designated as the "default branch". It is disabled when using --tmp. - Examples + - $ socket scan create + You can use `socket scan setup` to configure certain repo flag defaults. - $ socket scan create ./proj --json + - $ socket scan create --repo=test-repo --branch=main ./package.json + Examples - $ socket scan create --uv-members ./packages/api ./packages/worker + $ socket scan create - + $ socket scan create ./proj --json - + $ socket scan create --repo=test-repo --branch=main ./package.json - + $ socket scan create --uv-members ./packages/api ./packages/worker - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/test/snapshots/termless/cli.native.socket-help-scan-reach.svg b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg index b99f14980..214ff618a 100644 --- a/test/snapshots/termless/cli.native.socket-help-scan-reach.svg +++ b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg @@ -1,4 +1,4 @@ - + CLI: v2.1.0-rc.0 | cmd: socket scan reach | org: (not set) | token: (not set) @@ -83,9 +83,9 @@ --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back -to precomputed reachability results. By default, the CLI halts on analysis errors. An analysis that stops early at the timeout or memory lim +to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis th -it but still returns results is not an error. +at stops early with partial results counts as an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi @@ -115,61 +115,67 @@ orted: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. - --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d + --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early -eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a + (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless -n SBOM carrying stale reachability results. +--reach-continue-on-analysis-errors is set. - --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous + --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d - runs to speed up the analysis. +eleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as a - --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your +n SBOM carrying stale reachability results. -project. + --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous - --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. + runs to speed up the analysis. - + --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your - Runs the Socket reachability analysis without creating a scan in Socket. +project. - The output is written to .socket.facts.json in the current working directory + --reach-version Override the version of @coana-tech/cli used for reachability analysis. Default: 15.15.9. - unless the --output flag is specified. - + + Runs the Socket reachability analysis without creating a scan in Socket. - Note: Manifest files are uploaded to Socket's backend services because the + The output is written to .socket.facts.json in the current working directory - reachability analysis requires creating a Software Bill of Materials (SBOM) + unless the --output flag is specified. - from these files before the analysis can run. - + + Note: Manifest files are uploaded to Socket's backend services because the - Examples + reachability analysis requires creating a Software Bill of Materials (SBOM) - $ socket scan reach + from these files before the analysis can run. - $ socket scan reach ./proj + - $ socket scan reach ./proj --reach-ecosystems npm,pypi + Examples - $ socket scan reach ./monorepo --dynamic-sbom-inference + $ socket scan reach - $ socket scan reach --output custom-report.json + $ socket scan reach ./proj - $ socket scan reach ./proj --output ./reports/analysis.json + $ socket scan reach ./proj --reach-ecosystems npm,pypi - + $ socket scan reach ./monorepo --dynamic-sbom-inference - + $ socket scan reach --output custom-report.json - + $ socket scan reach ./proj --output ./reports/analysis.json - \ No newline at end of file + + + + + + + \ No newline at end of file From 5572225559d22884eac2e287cc917a4a8fd5b6f0 Mon Sep 17 00:00:00 2001 From: Jeppe Fredsgaard Blaabjerg Date: Wed, 2 Dec 2026 17:32:25 +0100 Subject: [PATCH 3/4] fix(scan): name the verdict --reach-incomplete-analysis-as-error changes An early-stopped analysis can already be an error when it reached no dependencies; the flag turns its unreachable verdicts into errors. Co-Authored-By: Claude Opus 5.5 --- src/commands/scan/cmd-scan-create.test.mts | 4 ++-- src/commands/scan/cmd-scan-reach.test.mts | 4 ++-- src/commands/scan/reachability-flags.mts | 4 ++-- .../termless/cli.native.socket-help-scan-create.svg | 10 +++++----- .../termless/cli.native.socket-help-scan-reach.svg | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/commands/scan/cmd-scan-create.test.mts b/src/commands/scan/cmd-scan-create.test.mts index 85d420906..4757d9ebd 100644 --- a/src/commands/scan/cmd-scan-create.test.mts +++ b/src/commands/scan/cmd-scan-create.test.mts @@ -128,7 +128,7 @@ describe('socket scan create', async () => { --reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB. --reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly. --reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. - --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis that stops early with partial results counts as an error too. + --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an unreachable verdict from an analysis that stopped early is an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors. --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version catalog / pre-generated SBOM). By default, the CLI halts. --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By default, the CLI halts. @@ -139,7 +139,7 @@ describe('socket scan create', async () => { --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supported: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. --reach-fallback-to-regular-scan If reachability analysis fails, continue with a regular SCA scan (without reachability results) instead of halting. By default, the CLI halts on reachability errors. - --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. + --reach-incomplete-analysis-as-error An analysis that stops early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) can report a vulnerability unreachable because it found no path before it stopped. Report such a vulnerability as an analysis error instead. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. --reach-retain-facts-file Keep the \`.socket.facts.json\` reachability report that the analysis writes to the scan directory instead of deleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as an SBOM carrying stale reachability results. --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous runs to speed up the analysis. --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your project. diff --git a/src/commands/scan/cmd-scan-reach.test.mts b/src/commands/scan/cmd-scan-reach.test.mts index 38695fcb1..b44372138 100644 --- a/src/commands/scan/cmd-scan-reach.test.mts +++ b/src/commands/scan/cmd-scan-reach.test.mts @@ -46,7 +46,7 @@ describe('socket scan reach', async () => { --reach-analysis-memory-limit The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB. --reach-analysis-timeout Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly. --reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. - --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis that stops early with partial results counts as an error too. + --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an unreachable verdict from an analysis that stopped early is an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors. --reach-continue-on-missing-lock-files Continue reachability analysis when a Gradle or SBT project is missing its lock file (or version catalog / pre-generated SBOM). By default, the CLI halts. --reach-continue-on-no-source-files Continue reachability analysis when a workspace contains no source files for its ecosystem. By default, the CLI halts. @@ -56,7 +56,7 @@ describe('socket scan reach', async () => { --reach-disable-dependency-downloads Only analyze dependencies that are already installed (e.g. in the project's .venv, vendor directory or module cache). Missing dependencies count as installation failures. --reach-disable-external-tool-checks Disable external tool checks during reachability analysis. --reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Supported: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. - --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. + --reach-incomplete-analysis-as-error An analysis that stops early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) can report a vulnerability unreachable because it found no path before it stopped. Report such a vulnerability as an analysis error instead. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. --reach-retain-facts-file Keep the \`.socket.facts.json\` reachability report that the analysis writes to the scan directory instead of deleting it after a successful scan. Delete it once inspected: later reachability scans ignore it, but a scan without --reach uploads it as an SBOM carrying stale reachability results. --reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous runs to speed up the analysis. --reach-use-only-pregenerated-sboms When using this option, the scan is created based only on pre-generated CDX and SPDX files in your project. diff --git a/src/commands/scan/reachability-flags.mts b/src/commands/scan/reachability-flags.mts index 59da1cbdd..e4a7b028b 100644 --- a/src/commands/scan/reachability-flags.mts +++ b/src/commands/scan/reachability-flags.mts @@ -79,7 +79,7 @@ export const reachabilityFlags: MeowFlags = { type: 'boolean', default: false, description: - 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis that stops early with partial results counts as an error too.', + 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an unreachable verdict from an analysis that stopped early is an error too.', }, reachContinueOnInstallErrors: { type: 'boolean', @@ -164,7 +164,7 @@ export const reachabilityFlags: MeowFlags = { type: 'boolean', default: false, description: - 'Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set.', + 'An analysis that stops early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) can report a vulnerability unreachable because it found no path before it stopped. Report such a vulnerability as an analysis error instead. Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set.', }, reachLazyMode: { type: 'boolean', diff --git a/test/snapshots/termless/cli.native.socket-help-scan-create.svg b/test/snapshots/termless/cli.native.socket-help-scan-create.svg index 730a8ee66..9208f3d69 100644 --- a/test/snapshots/termless/cli.native.socket-help-scan-create.svg +++ b/test/snapshots/termless/cli.native.socket-help-scan-create.svg @@ -127,9 +127,9 @@ --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back -to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis th +to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an unreachable -at stops early with partial results counts as an error too. + verdict from an analysis that stopped early is an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi @@ -163,11 +163,11 @@ d of halting. By default, the CLI halts on reachability errors. - --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early + --reach-incomplete-analysis-as-error An analysis that stops early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) c - (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless +an report a vulnerability unreachable because it found no path before it stopped. Report such a vulnerability as an analysis error instead. ---reach-continue-on-analysis-errors is set. +Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d diff --git a/test/snapshots/termless/cli.native.socket-help-scan-reach.svg b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg index 214ff618a..53fbfa5d3 100644 --- a/test/snapshots/termless/cli.native.socket-help-scan-reach.svg +++ b/test/snapshots/termless/cli.native.socket-help-scan-reach.svg @@ -83,9 +83,9 @@ --reach-continue-on-analysis-errors Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back -to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an analysis th +to precomputed reachability results. By default, the CLI halts on analysis errors. With --reach-incomplete-analysis-as-error, an unreachable -at stops early with partial results counts as an error too. + verdict from an analysis that stopped early is an error too. --reach-continue-on-install-errors Continue reachability analysis when package installation fails, falling back to precomputed reachabi @@ -115,11 +115,11 @@ orted: cargo, composer, gem, golang, maven, npm, nuget, pypi. Defaults to all supported ecosystems. - --reach-incomplete-analysis-as-error Report a vulnerability as an analysis error instead of unreachable when its analysis stopped early + --reach-incomplete-analysis-as-error An analysis that stops early (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) c - (e.g. at --reach-analysis-timeout or --reach-analysis-memory-limit) without finding a reachable path. Analysis errors halt the scan unless +an report a vulnerability unreachable because it found no path before it stopped. Report such a vulnerability as an analysis error instead. ---reach-continue-on-analysis-errors is set. +Analysis errors halt the scan unless --reach-continue-on-analysis-errors is set. --reach-retain-facts-file Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of d From 851991799ef1d11e60e48efd4184a20d3a076c44 Mon Sep 17 00:00:00 2001 From: Jeppe Fredsgaard Blaabjerg Date: Thu, 3 Dec 2026 10:10:55 +0100 Subject: [PATCH 4/4] docs(changelog): note --reach-incomplete-analysis-as-error Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e559b3db6..947a2c1c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +### Added +- Catch reachability analyses that stop early: with `--reach-incomplete-analysis-as-error`, `socket scan create --reach` and `socket scan reach` report a vulnerability whose analysis hit the timeout or memory limit before finding a reachable path as an analysis error instead of unreachable. + ### Changed - Updated the Coana CLI to v `15.15.10`.