Repository navigation
feat(manifest): add socket.json reachability settings for the build tools - #1728
Conversation
2c50fc1 to
4019231
Compare
4019231 to
4e3d59e
Compare
PR SummaryMedium Risk Overview Settings cascade field-by-field (with Only reachability scans ( Reviewed by Cursor Bugbot for commit 4e3d59e. Configure here. |
4e3d59e to
ca1a152
Compare
687be27 to
db94aec
Compare
db94aec to
e24fc2b
Compare
e24fc2b to
700bf18
Compare
15420b3 to
19378f5
Compare
122f249 to
88d63e8
Compare
88d63e8 to
e7916e8
Compare
e7916e8 to
5b24559
Compare
dd7c9de to
eca1122
Compare
442e1b4 to
833d540
Compare
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.
833d540 to
1eba228
Compare
Oskar Haarklou Veileborg (BarrensZeppelin)
left a comment
There was a problem hiding this comment.
[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.
semvercan't replace the .NET version regex: it rejects8.0and acceptsv8.0.11and8.0.11+b.- The cascade correctly reuses the existing merge and its null-clearing behaviour.
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.
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
reachabilitysettings 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
buildsentry, take areachabilityobject that--dynamic-sbom-inferencereachability 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-manifestignores 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.minortakes its latest installed patch,major.minor.patch[-prerelease]exactly that runtime.Cascade and validation
buildsentry last;nullclears an inherited value.--dynamic-sbom-inferencereachability scans read them, for the builds they run and don't skip, so an invalid value never stops another command.Stack
Changelog
In
CHANGELOG.mdunder[Unreleased]:Added
socket.jsonfor--dynamic-sbom-inferencescans:reachability.buildcompiles the project before the analysis,reachability.javaHome(Maven, Gradle, sbt) sets the JDK the analysis assumes, andreachability.runtimeVersion(.NET) sets the runtime it starts on.🤖 Generated with Claude Code