Skip to content

feat(scan): scope reachability analysis to chosen advisories - #1640

Merged
Martin Torp (mtorp) merged 4 commits into
v1.xfrom
martin/tier-1-reachability-for-a-specific-set-o
Oct 26, 2026
Merged

Martin Torp (mtorp) merged 4 commits into
v1.xfrom
martin/tier-1-reachability-for-a-specific-set-o

Conversation

@mtorp

@mtorp Martin Torp (mtorp) commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

socket scan create --reach and socket scan reach get a --reach-advisories flag that limits reachability analysis to a set of advisories. It takes GHSA and CVE IDs, comma-separated or repeated. Every advisory outside the list gets unknown reachability, and it costs no analysis time.

How it works:

  • resolveReachAdvisories (new, src/commands/scan/reach-advisories.mts) normalizes the IDs, rejects anything that is not a GHSA or CVE ID before any lookup, and converts CVE IDs to GHSA IDs. Socket-mode vulnerabilities in Coana only carry GHSA IDs, so the conversion has to happen here. An ID that is malformed or has no GHSA fails the command with an InputError. Dropping it silently would quietly leave that advisory unanalyzed.
  • The resolved GHSAs go to Coana as --ghsas. Nothing is passed when the flag is not used.
  • On scan create, the flag counts as a reach flag, so it needs --reach like the others.
  • The ID conversion loop moved out of handle-fix.mts into resolveAdvisoryIds in src/utils/advisory-ids.mts, and both commands call it. socket fix --id behaves exactly as before: case-sensitive IDs, PURL support, the same messages and logs, and sequential lookups. The GHSA and CVE format regexps moved to utils/cve-to-ghsa.mts.

Coana support for --ghsas landed in coana-tech/coana-package-manager#2627 and ships in Coana 15.13.0, which v1.x now pins.

Tests: unit tests for the ID resolution and for the --ghsas forwarding, plus updated --help snapshots. The Coana PR has a full-cycle test for the analysis side. I have not run the two together against the real API.

Expected reviewer effort: High-level design decisions


Note

Medium Risk
Changes reachability CLI behavior and Coana invocation (--ghsas), with strict fail-fast ID resolution and a dependency on Coana support for advisory scoping.

Overview
Adds --reach-advisories to socket scan create --reach and socket scan reach so reachability analysis can target specific GHSA or CVE IDs (comma-separated or repeated). Advisories outside the list keep unknown reachability instead of being fully analyzed; omitting the flag keeps the current “all advisories” behavior.

resolveReachAdvisories normalizes IDs, allows only GHSA/CVE (no PURLs), converts CVEs via GitHub, and fails the command on any bad or unresolvable ID rather than silently skipping. Resolved GHSAs are passed to Coana as --ghsas when the list is non-empty. On scan create, setting advisories counts as a reach modifier and requires --reach.

Refactors advisory ID conversion into shared resolveAdvisoryIds (src/utils/advisory-ids.mts); socket fix now calls it with the same CVE/GHSA/PURL behavior as before. GHSA/CVE format regexps move to cve-to-ghsa.mts. Changelog documents the flag; tests cover resolution, Coana arg forwarding, and help text.

Reviewed by Cursor Bugbot for commit ba8022e. Configure here.

`--reach-advisories` on `socket scan create --reach` and `socket scan reach`
takes GHSA and CVE IDs. CVE IDs are converted to GHSA IDs through the GitHub
API, the same way `socket fix --id` does, and an ID that cannot be resolved
fails the command. The GHSA IDs go to Coana as `--ghsas`, which only analyzes
those advisories and gives every other one unknown reachability.
Move the CVE/GHSA/PURL conversion loop out of `socket fix` into
`src/utils/advisory-ids.mts` and have `--reach-advisories` resolution
call it. `socket fix --id` keeps its behavior: case-sensitive IDs,
PURL support, the same messages and logs, and sequential lookups.
The reach path still normalizes case and rejects anything that is not
a GHSA or CVE ID before any lookup, then throws on conversion errors.

Also drop a `reach ? ... : []` guard in `scan create` that could never
take its else branch, since reach flags already require `--reach`.
…ility-for-a-specific-set-o

# Conflicts:
#	CHANGELOG.md
#	src/commands/scan/cmd-scan-reach.test.mts
…ility-for-a-specific-set-o

# Conflicts:
#	CHANGELOG.md
@mtorp
Martin Torp (mtorp) merged commit 5b66023 into v1.x Oct 26, 2026
11 checks passed
@mtorp
Martin Torp (mtorp) deleted the martin/tier-1-reachability-for-a-specific-set-o branch October 26, 2026 17:30
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