Skip to content

feat(scan): add --dynamic-sbom-inference-ignore-unresolved - #1818

Open
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 2 commits into
jfblaa/dsi-no-build-root-noopfrom
jfblaa/dsi-settings-flags
Open

Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 2 commits into
jfblaa/dsi-no-build-root-noopfrom
jfblaa/dsi-settings-flags

Conversation

@jfblaa

@jfblaa Jeppe Fredsgaard Blaabjerg (jfblaa) commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Adds --dynamic-sbom-inference-ignore-unresolved to socket scan create, socket scan reach and socket fix, so many repositories can be scanned with --dynamic-sbom-inference without a socket.json in each. It tolerates unresolved dependencies in every build and overrides ignoreUnresolved from socket.json, builds entries included.

The scan commands now reject --ignore-unresolved, --exclude-configs, --include-configs and --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 the socket.json setting 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.
  • The flags shared by the three commands are dynamicSbomInferenceFlags; giving one without --dynamic-sbom-inference is an input error.
Tests
  • reachability-flags.test.mts: parsing, and the requires---dynamic-sbom-inference error.
  • 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, builds entries included.
  • Help snapshots, inline and native.

@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes unresolved-dependency behavior for dynamic SBOM scans and breaks scripts that passed manifest-only flags to scan commands; scan targeting mistakes become hard errors instead of silent mis-parsing.

Overview
Adds --dynamic-sbom-inference-ignore-unresolved (with --dynamic-sbom-inference) on socket scan create, socket scan reach, and socket fix, so CI can scan many repos without per-build socket.json. The flag warns instead of failing on unresolved JVM/.NET deps and overrides every ignoreUnresolved in socket.json, including per-build builds entries.

Dynamic SBOM options are now a DynamicSbomInference object (ignoreUnresolved + purlTypes) instead of a bare ecosystem list, threaded through facts generation and fix flows.

socket scan create and socket scan reach error on undeclared flags --ignore-unresolved, --exclude-configs, --include-configs, and --verbose (replacing silent warnings), because unknown flags could consume the scan target. Scan users get --dynamic-sbom-inference-ignore-unresolved instead of --ignore-unresolved; other manifest-only settings stay in socket.json.

Reviewed by Cursor Bugbot for commit 3ac31b0. Configure here.

@mtorp Martin Torp (mtorp) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/dynamic-sbom-inference-settings.md Outdated

## On the command line

Only `ignoreUnresolved` also has a flag that overrides `socket.json`; set the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants