Skip to content

supply_chain_check: reachability tags on osv rows - #2110

Merged
remigiusz-antczak merged 1 commit into
mainfrom
land/wave-1029aq
Oct 29, 2026
Merged

remigiusz-antczak merged 1 commit into
mainfrom
land/wave-1029aq

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Summary

osv-scanner rows from supply_chain_check.sh now carry a reachability tag, which closes the pilot gap where flagged npm packages gave no signal about whether app code uses them.

  • imported: a JS/TS/Vue/Svelte/Astro/MDX file outside node_modules, .git and root-level vendor/venv/.venv imports or requires the package (static, dynamic or backtick form).
  • dev-only: every lockfile occurrence is "dev": true, or osv puts it in a dev/build/test group (npm prod keys never fall through to the osv group).
  • transitive: everything else.

Only dev-only rows skip the --fail-on gate (SUPPLY_CHAIN_STRICT=1 gates them too); imported and transitive both gate, since a prod transitive dependency is reachable through the direct dependency that imports it. The summary says how many rows were downgraded. An unreadable file, a lockfile without a packages map (v1), or a non-npm ecosystem fails closed. PyPI is downgraded only by a dev group, never by missing imports, because distribution names differ from module names. The osv API fallback now emits the ecosystem so the same tags apply.

Verification

  • python3 scripts/test_supply_chain_reach.py: 5/5 locally (v1 lockfile, backtick import, .astro, nested vendor, prod key vs osv dev group).
  • test-scanner-offline-db.sh, test-supply-chain-osv-fallback, test-supply-chain-check pass locally.
  • skill_index.py --check, ci-gates.sh size-ratchet --base origin/main and fragments pass locally.
  • Independent review: 1 red (prod transitive rows skipped the gate) and 5 yellows fixed in this commit; symlinked source directories are not followed (noted in the code).

🤖 Generated with Claude Code

…itive)

An osv row for an npm package no source file imports now prints
"(reach: dev-only|transitive)". Only dev-only rows skip the --fail-on
gate (unless SUPPLY_CHAIN_STRICT=1); transitive rows still gate because a
direct dependency may reach them. Unknown reach (unreadable file, lockfile
without a packages map, non-npm ecosystem, PyPI without a dev group) is
gated. The lockfile is authoritative for npm dev-ness. Only a root-level
.venv/venv/vendor is pruned from the import scan; .astro and .mdx files and
backtick specifiers are scanned. Replaces the old dev-only cap at moderate.
The osv API fallback now emits the ecosystem so it gets the same tags.

Tests: 5/5 (test_supply_chain_reach 5; test-scanner-offline-db, test-supply-chain-osv-fallback, test-supply-chain-check pass)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remigiusz-antczak
remigiusz-antczak merged commit f628d25 into main Oct 29, 2026
8 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the land/wave-1029aq branch October 29, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant