Skip to content

feat(manifest): add socket.json reachability settings for the build tools - #1728

Merged
Jeppe Fredsgaard Blaabjerg (jfblaa) merged 12 commits into
jfblaa/facts-3-delete-scriptsfrom
jfblaa/facts-4-reachability-settings
Nov 27, 2026
Merged

Jeppe Fredsgaard Blaabjerg (jfblaa) merged 12 commits into
jfblaa/facts-3-delete-scriptsfrom
jfblaa/facts-4-reachability-settings

Conversation

@jfblaa

@jfblaa Jeppe Fredsgaard Blaabjerg (jfblaa) commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Heads up, reviewer

Reachability analysis can use different settings than sbom generation, e.g. analyse against a different java/dotnet runtime.
Additionally, customers may want to build their projects for reachability analysis, but not when just generating sboms.
This PR adds reachability settings to socket.json to help configure such properties.


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

A build tool's socket.json section, and a build's own builds entry, take a reachability object that --dynamic-sbom-inference reachability scans send to Coana with each build root's request: whether to compile the project before the analysis, and the JDK or .NET runtime the analysis assumes. --auto-manifest ignores them.

Merges with the stack. The Coana release it needs is pinned on v1.x since #1762.

Settings
  • build: "compile" builds the project first, and a failed build fails the scan; "none" or unset analyses it unbuilt.
  • javaHome (Maven, Gradle, sbt): the JDK the analysis takes the program to run on, passed as written; unset, the build's own JDK.
  • runtimeVersion (.NET): the runtime a framework-dependent build's analysis starts on; major.minor takes its latest installed patch, major.minor.patch[-prerelease] exactly that runtime.
Cascade and validation
  • Each field cascades on its own, a build's builds entry last; null clears an inherited value.
  • Only --dynamic-sbom-inference reachability scans read them, for the builds they run and don't skip, so an invalid value never stops another command.
  • An invalid value or a field the tool doesn't take fails the scan before any build runs, naming the socket.json and setting.
Stack
  1. fix: keep the API token and settings socket-cli passes Coana out of the build tools it runs #1725: Keep the Socket API token out of the tools Coana runs (merged)
  2. feat(manifest): generate Socket facts with Coana #1726: Generate Socket facts with Coana
  3. refactor(manifest): delete socket-cli's build-tool scripts and facts assembly #1727: Delete socket-cli's build-tool scripts and facts assembly (internal)
  4. feat(manifest): add socket.json reachability settings for the build tools #1728: socket.json reachability settings for the build tools (this PR)
  5. feat(manifest): ask for the reachability settings in the setup wizards #1729: Reachability settings in the setup wizards
  6. refactor: follow-ups to generating Socket facts with Coana #1733: Follow-ups (draft)

Changelog

In CHANGELOG.md under [Unreleased]:

Added

  • Tune reachability per build tool in socket.json for --dynamic-sbom-inference scans: reachability.build compiles the project before the analysis, reachability.javaHome (Maven, Gradle, sbt) sets the JDK the analysis assumes, and reachability.runtimeVersion (.NET) sets the runtime it starts on.

🤖 Generated with Claude Code

@cursor

cursor Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes reachability scan behavior and Coana request payloads; misconfiguration can fail scans early or alter analysis JDK/runtime/compile behavior, but scope is manifest configuration rather than auth or data handling.

Overview
Adds reachability blocks on each JVM/.NET manifest tool section and per-builds entry so reachability scans can differ from plain SBOM generation: whether Coana compiles first (build: "compile" vs "none"), which JDK the analysis assumes (javaHome for Maven/Gradle/sbt), and which .NET runtime to start on (runtimeVersion).

Settings cascade field-by-field (with null clearing inherited values); mergeBuildToolDefaults merges nested reachability when chaining socket.json files. Resolution and validation run in build-root-config (tool-specific fields, .NET SemVer-style runtime strings) and fail the scan before any build when invalid, naming the offending socket.json or build entry.

Only reachability scans (workDir.withFiles) read and forward these values through generateRecursiveManifests, generateAutoManifest, and convertDotnetToFacts into the Coana generate-socket-facts request (run-manifest-facts). Skipped tools (disabled, Gradle/sbt facts: false) are not validated. Docs and changelog describe the new fields.

Reviewed by Cursor Bugbot for commit 4e3d59e. Configure here.

@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) force-pushed the jfblaa/facts-4-reachability-settings branch 3 times, most recently from dd7c9de to eca1122 Compare November 26, 2026 13:17
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) force-pushed the jfblaa/facts-4-reachability-settings branch 2 times, most recently from 442e1b4 to 833d540 Compare November 26, 2026 17:01
A build tool's socket.json section takes a `reachability` object, which
reachability scans send to Coana with each build root's request:

- `build`: "compile" builds the project before the analysis, "none" or
  unset analyses it unbuilt;
- `javaHome`, Maven, Gradle and sbt: the JDK the analysis takes the
  program to run on, as written;
- `runtimeVersion`, .NET: the runtime a framework-dependent build's
  analysis starts on, as major.minor or major.minor.patch[-prerelease].

Each field cascades on its own, a build's own `builds` entry last, and
null clears an inherited one. Only a reachability scan reads them, for the
build tools it runs, so an invalid value never stops another command. It
checks them before any build runs and fails naming the socket.json and
setting, including a field the build tool does not take.
`socket scan create --reach --auto-manifest` read the reachability settings
only from the socket.json in the directory it scans, so a JDK or .NET
runtime set by a parent socket.json was dropped. It now cascades them from
every socket.json down to that directory, as `socket manifest` does, and a
null in a nearer file still clears an inherited value. An invalid setting in
any of those files fails the scan before a build runs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[agent] Approving. The inline comments are simplification opportunities; none of them is a correctness issue. The comments on the resolver's reachability function, checkReachability and socketJsonReachability amount to one change: parse each socket.json's reachability settings once inside the resolver and cache the result. The comment on runCandidate is the larger change, and it involves a decision about auto-manifest inheritance.

Checked and dropped:

  • Speed: nothing beyond the repeated resolver work.
  • semver can't replace the .NET version regex: it rejects 8.0 and accepts v8.0.11 and 8.0.11+b.
  • The cascade correctly reuses the existing merge and its null-clearing behaviour.

Comment thread src/utils/socket-json.mts Resolved
Comment thread src/utils/socket-json.mts Resolved
One table says which reachability fields each build tool takes, and the
socket.json types and the settings sent to Coana derive from it. One parse
checks a value and builds the typed settings as it goes, so the resolver
checks each socket.json once and keeps the result per build. Skips read the
resolved config's skip reason, and a build tool section merges each of its
object-valued fields field by field.
resolveEcosystemConfig resolves the bin, which fails on a bad SOCKET_CLI_*_PATH override, so asking it whether a tool is skipped could fail a scan over a tool it skips. The skip checks call getSkipReason, which the config's skipReason comes from.
The resolver and cascadedReachability share one chain check, and the socket.json merge loops over BUILD_TOOLS, so a new build tool merges field by field too.
--auto-manifest no longer reads or sends them. The dynamic SBOM inference
walk puts a build's settings on its EcosystemBuildConfig on a reachability
scan, so they reach Coana by the one route every other build option takes.
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) merged commit 6a44c1c into v1.x Nov 27, 2026
22 checks passed
@jfblaa
Jeppe Fredsgaard Blaabjerg (jfblaa) deleted the jfblaa/facts-4-reachability-settings branch November 27, 2026 10:32
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.

3 participants