ReviewOS

also looking at this

craft-native/craft

Decide dependency advisories instead of counting them

#320
Merged glennmichael123 wants to merge fix/advisory-retention-policy into main
6 files +324 -1
docs/VULNERABILITY_SCANNING.mdmodified+25-1
Changes to docs/VULNERABILITY_SCANNING.md
@@ -23,7 +23,31 @@ tracks the reviewed High/Critical policy and shipping-scope analysis; issue
2323[#276](https://github.com/craft-native/craft/issues/276) tracks locked dependency
2424advisories. Native binary scanning records exact hashes and detected components,
2525but static Zig code may not be identifiable from the binary alone; retain the
26full-source review. No baseline or vulnerability exemption is added by this workflow.
26full-source review.
27
28## Reviewed advisory retention
29
30Lockfile advisories are decided rather than counted. `scripts/advisory-policy.ts`
31reads `bun audit --json` and fails when an advisory has not been reviewed, when a
32review has passed its expiry, when a retained entry no longer matches any current
33advisory, and on any High or Critical finding, which can never be retained. It runs
34in CI on every pull request and again in `validate-release`, so a release cannot
35carry an unreviewed advisory.
36
37Retentions live in `scripts/retained-advisories.ts`, one entry per advisory, each
38answering a single question: by what path would an installed Craft package reach
39this code? An advisory that reaches a published artifact is fixed instead of
40retained. Entries carry a review date and an expiry so that the reasoning is
41re-examined rather than inherited.
42
43A newly published advisory therefore turns the build red until someone either
44fixes it or writes down why it is unreachable. That is deliberate: the previous
45arrangement reported a count and stayed green, so a new finding was invisible.
46
47`bun audit fix` is not part of any gate. It is willing to *downgrade* a package so
48that it falls below an advisory window rather than upgrading past it, and reports
49that as a fix, so remediation stays a reviewed decision. Dependency updates go
50through buddy-bot.
2751
2852Syft and Grype Linux x64 downloads are pinned by release version and SHA-256 in
2953`.github/workflows/sbom.yml`. Tool updates must update both the asset URL and its