feat(scan): support --dynamic-sbom-inference on scan reach - #1513
Merged
Jeppe Fredsgaard Blaabjerg (jfblaa) merged 1 commit intoAug 25, 2026
Merged
Conversation
The flag was hidden and hardcoded to false on `socket scan reach`, since it relied on `--auto-manifest` generating the per-build-root Socket facts first and that command has no such flag. Run the recursive facts generation directly instead, so standalone reachability gets the same per-project/module splitting `scan create` does. Without it, Gradle and sbt projects analyzed through this path find no vulnerabilities at all. Extract the recursive-facts step out of handle-create-new-scan into run-dynamic-sbom-inference so both commands share one implementation and one set of error messages, and give the flag a per-command description since only `scan create` implies --auto-manifest.
Jeppe Fredsgaard Blaabjerg (jfblaa)
deleted the
feat/scan-reach-dynamic-sbom-inference
branch
August 25, 2026 12:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
--dynamic-sbom-inferencesupport tosocket scan reach.The flag was hidden and hardcoded to
falsethere, because it relied on--auto-manifestgenerating the per-build-root Socket facts first andscan reachhas no such flag. It now runs the recursive facts generation directly instead, so standalone reachability gets the same per-project/module splittingscan createdoes.Why
socket scan reachis the path Coana uses for its CI e2e tests. Without the flag, Gradle and sbt projects analyzed through it are reduced to one synthetic root and every test passes vacuously with 0 vulnerabilities detected.How
run-dynamic-sbom-inference.mts— the recursive-facts step, extracted fromhandle-create-new-scan.mtsso both commands share one implementation and one set of error messages: discover every independent gradle/sbt/maven build root undercwd, generate its.socket.facts.json, accumulate the resolved-paths sidecar, and throwInputErroron "no build root found" / "a build root failed".handle-scan-reach.mts— when the flag is on, runs that step before manifest discovery, merges the generated facts paths into the targets handed togetPackageFilesForScan(so they get uploaded), and forwards the sidecar toperformReachabilityAnalysis, which is what makes it pass--maven-use-only-socket-factsalongside--compute-artifacts-sidecar. The body is wrapped in awithTmpDirthat only allocates when the flag is on, since sbt's Scala toolchain lives under the shared global base the sidecar's paths point into and must outlive the analysis.cmd-scan-reach.mts— flag unhidden and actually read. Its description differs fromscan create's (no--auto-manifesthere; the build tools are run directly), so the shared sentence moved toDYNAMIC_SBOM_INFERENCE_DESCRIPTIONinreachability-flags.mtsand each command appends its own tail.handle-create-new-scan.mts— unchanged behavior, now delegating to the shared helper.No changelog entry:
socket scan reachis internal-only.Testing
pnpm run checkpasses.pnpm test:unit src/commands/scan/ src/commands/manifest/— 748 passed / 2 skipped, including 4 new tests for the helper and 3 for thescan reachwiring.scan reach --helpsnapshot regenerated.Note
The generated per-root facts are written as
<build-root>/.socket.facts.json, and Coana's report defaults to.socket.facts.jsonincwd. Ifcwdis itself a build root, the report overwrites that root's generated facts after the upload. Pre-existing behavior shared withscan create, not introduced here —--outputavoids it if a caller needs both files on disk.🤖 Generated with Claude Code
Note
Medium Risk
Changes reachability manifest discovery and Coana inputs for multi-root JVM builds; failures abort the whole command rather than partial analysis, but behavior only applies when the new flag is set.
Overview
socket scan reachnow honors--dynamic-sbom-inferenceinstead of hiding the flag and forcing it off. For Gradle, sbt, and Maven monorepos, the command discovers each independent build root, builds it to emit per-root.socket.facts.json, includes those paths in manifest upload/discovery, and passes the resolved-paths sidecar into Coana so reachability splits per module likescan create.Recursive facts generation is centralized in
runDynamicSbomInference, shared withhandle-create-new-scan(same errors for missing roots or partial failures).scan reachruns that step directly (no--auto-manifest); when the flag is on it keeps ansbttoolchain temp dir alive viawithTmpDiruntil analysis finishes. Help text uses a sharedDYNAMIC_SBOM_INFERENCE_DESCRIPTIONwith command-specific wording.Reviewed by Cursor Bugbot for commit 84aafcf. Configure here.