Skip to content

feat(fix): add --dynamic-sbom-inference - #1563

Open
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 7 commits into
v1.xfrom
jfblaa/fix-dynamic-sbom-inference
Open

Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 7 commits into
v1.xfrom
jfblaa/fix-dynamic-sbom-inference

Conversation

@jfblaa

@jfblaa Jeppe Fredsgaard Blaabjerg (jfblaa) commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

LLM Description written by Claude Code:claude-opus-5-5

Summary

  • socket fix --dynamic-sbom-inference generates Socket facts for every Gradle, sbt and Maven build root, uploads them, and has Coana attribute Maven artifacts only through them. A fix then lands only in the modules that actually resolve the vulnerable dependency, instead of everywhere depscan's coordinate-merged SBOM points.
  • The facts files merge components by version across a build, so their sidecar's per-project classpaths (collected without resolving artifact paths) are passed along for exact attribution.
  • The generated files are restored after each PR-mode reset and removed when the fix is done. Facts files already in the repo are still refused.
  • PR mode now commits the files Coana reports writing, so edits to build files that are not uploaded manifests (for example gradle.properties, sbt project/*.scala) and files the fix creates are no longer dropped from fix PRs.

Note

Medium Risk
Opt-in flag runs real JVM builds and changes Coana inputs and PR commit contents; incorrect attribution or missing files would affect automated fix PRs.

Overview
Adds socket fix --dynamic-sbom-inference, wiring the fix flow through the same per-build-root Socket facts generation used for scans. For Gradle, sbt, and Maven it generates .socket.facts.json per independent build root, uploads them with the manifest tar, and passes --maven-use-only-socket-facts plus a --compute-artifacts-sidecar classpath sidecar into Coana so fixes land only in modules that actually resolve the vulnerable dependency. Generated facts are backed up and restored after each PR-mode branch reset, then removed when the run finishes; pre-existing facts files in the repo are still rejected.

PR-mode fix commits no longer filter changes to uploaded manifest basenames only. When Coana reports modifiedFiles, the CLI commits exactly those paths from unstaged and untracked git listings (via new gitUntrackedFiles), so edits like gradle.properties, sbt project/*.scala, and newly created override files are included in fix PRs.

Supporting changes: generateSocketFactsForFix, optional sidecar collection in runDynamicSbomInference / accumulateSidecar without resolving artifact paths, bundled @coana-tech/cli 15.11.0, and unit tests for the new fix path.

Reviewed by Cursor Bugbot for commit b9e5dfc. Configure here.

Generate Socket facts for every Gradle, sbt and Maven build root, upload
them with the other manifests and have Coana attribute Maven artifacts only
through them, so a fix lands only in the modules that resolve the vulnerable
dependency. The generated files are restored after each PR-mode reset and
removed once the fix is done. Facts files already present are still refused.

PR mode now commits the files Coana reports writing, falling back to the
uploaded manifest names, so build-script edits are no longer dropped.
Untracked files the fix reports writing, such as new sbt override files,
were left out of the commit because only git's tracked changes were
considered.
The facts files merge components by version across a build, so they
over-approximate which projects resolve a dependency. socket fix
--dynamic-sbom-inference now keeps the sidecar's per-project classpaths,
without resolving artifact paths, and passes it to
compute-fixes-and-upgrade-purls.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b9e5dfc. Configure here.

Comment thread src/commands/fix/coana-fix.mts

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.

1 participant