Repository navigation
feat(scan): add --dynamic-sbom-inference-ignore-unresolved - #1818
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 2 commits into
Conversation
PR SummaryMedium Risk Overview Dynamic SBOM options are now a
Reviewed by Cursor Bugbot for commit 3ac31b0. Configure here. |
Martin Torp (mtorp)
left a comment
There was a problem hiding this comment.
The override reaches scan create, reach, and fix. I left three comments on the CLI messages and settings guide. The one I’d prioritize is the replacement suggested for a negated flag, since copying it changes which dependencies the scan can omit.
| const parts: string[] = [] | ||
| if (flags['ignoreUnresolved'] !== undefined) { | ||
| parts.push( | ||
| `\`${command}\` takes --dynamic-sbom-inference-ignore-unresolved, with --dynamic-sbom-inference, in place of --ignore-unresolved.`, |
There was a problem hiding this comment.
POLA-1 · Both --no-ignore-unresolved and --ignore-unresolved=false get the positive replacement here. If someone copies that suggestion, their next scan can omit unresolved dependencies even when a build’s socket.json requires strict resolution. Could the hint suggest --no-dynamic-sbom-inference-ignore-unresolved for both false spellings? An argument-level test would cover the boolean false and the string "false" that the parser returns.
There was a problem hiding this comment.
Fixed in 58d3d30 - --no-ignore-unresolved and --ignore-unresolved=false (any case) now point to --no-dynamic-sbom-inference-ignore-unresolved; an argv-level test parses each spelling through meowOrExit.
| dynamicSbomInferenceIgnoreUnresolved: { | ||
| type: 'boolean', | ||
| description: | ||
| "With --dynamic-sbom-inference: warn on unresolved dependencies instead of failing the build (unresolved deps are not emitted to the facts files); overrides each build's socket.json setting.", |
There was a problem hiding this comment.
POLA-2 · Could we qualify this help text and the changelog? The flag lets a build omit missing packages once dependency resolution runs. For example, if Maven cannot load the project because an imported bill of materials is missing, the build still fails with this flag enabled. Resolver test for that case
There was a problem hiding this comment.
Fixed in 58d3d30 - the help text and changelog now say that a build that cannot be loaded, for example over a missing imported Maven BOM, still fails.
|
|
||
| ## On the command line | ||
|
|
||
| Only `ignoreUnresolved` also has a flag that overrides `socket.json`; set the |
There was a problem hiding this comment.
POLA-3 · Could we scope “only” to socket scan create, socket scan reach, and socket fix? This section also covers socket manifest dynamic-sbom-inference, where --verbose turns on build output for one run even if a build sets verbose to false. Build setting precedence
There was a problem hiding this comment.
Fixed in 58d3d30 - the guide scopes the one-flag rule to scan create, scan reach and fix, and says the manifest command takes --ignore-unresolved and --verbose.
Scanning many repositories with --dynamic-sbom-inference needed a socket.json in each to tolerate unresolved dependencies. The new flag on scan create, scan reach and fix applies to every build and overrides socket.json, as --ignore-unresolved does on the manifest command. The scan commands do not declare --ignore-unresolved, --exclude-configs, --include-configs or --verbose, so each could take the scan target as its value. They are now rejected with a pointer to the flag or socket.json setting to use instead. DynamicSbomInference now carries the selected ecosystems and the ignore-unresolved override together.
--no-ignore-unresolved and --ignore-unresolved=false now point to --no-dynamic-sbom-inference-ignore-unresolved, since copying the positive form would let a strict build omit unresolved dependencies. The help and changelog say that a build that cannot be loaded still fails, and the settings guide scopes the single-flag rule to the scan and fix commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3ac31b0 to
58d3d30
Compare
Adds
--dynamic-sbom-inference-ignore-unresolvedtosocket scan create,socket scan reachandsocket fix, so many repositories can be scanned with--dynamic-sbom-inferencewithout asocket.jsonin each. It tolerates unresolved dependencies in every build and overridesignoreUnresolvedfromsocket.json,buildsentries included.The scan commands now reject
--ignore-unresolved,--exclude-configs,--include-configsand--verbose. They never declared them, so each silently took the next argument, which can be the scan target, as its value. The error names the flag or thesocket.jsonsetting to use instead.Why only this setting
It is the only build setting that is the same across unrelated repositories. Java homes, build tool binaries, options and configurations are per repository and stay in
socket.json.Implementation notes
DynamicSbomInference = { ignoreUnresolved, purlTypes }replaces the bare purl type list passed from the commands to facts generation, so later options join it as fields.dynamicSbomInferenceFlags; giving one without--dynamic-sbom-inferenceis an input error.Tests
reachability-flags.test.mts: parsing, and the requires---dynamic-sbom-inferenceerror.reject-manifest-only-flags.test.mts: each rejected flag and its message.run-dynamic-sbom-inference.test.mts,generate-recursive-manifests.test.mts: the override reaches every build,buildsentries included.