Skip to content

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

Draft
Martin Torp (mtorp) wants to merge 1 commit into
v1.xfrom
martin/tier-1-reachability-for-a-specific-set-o
Draft

Martin Torp (mtorp) wants to merge 1 commit into
v1.xfrom
martin/tier-1-reachability-for-a-specific-set-o

Conversation

@mtorp

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 and converts CVE IDs to GHSA IDs with the same GitHub lookup socket fix --id uses. 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 GHSA and CVE format regexps moved from handle-fix.mts to utils/cve-to-ghsa.mts so both commands share them.

Depends on coana-tech/coana-package-manager#2627. The pinned Coana does not know --ghsas yet, so this should merge together with a Coana bump that includes it. Until then the flag only works with --reach-version pointing at a Coana build that has it.

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

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

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