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

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

.github/workflows/ci.ymlmodified+9-0
Changes to .github/workflows/ci.yml
@@ -297,6 +297,15 @@ jobs:
297297 - name: Test agent environment briefing
298298 run: bun test scripts/agents-guidelines.test.ts
299299
300 - name: Test dependency advisory policy
301 run: bun test scripts/advisory-policy.test.ts
302
303 # Reads the registry, so this is the step that turns a newly published
304 # advisory into a red build rather than a larger number in a report.
305 # Clearing it is one reviewed entry in scripts/retained-advisories.ts.
306 - name: Review dependency advisories
307 run: bun scripts/advisory-policy.ts
308
300309 - name: Test merged SBOM inventory
301310 run: bun test scripts/merge-sbom.test.ts
302311
.github/workflows/release.ymlmodified+5-0
Changes to .github/workflows/release.yml
@@ -22,6 +22,11 @@ jobs:
2222 - name: Validate tag and workspace versions
2323 run: bun scripts/release-version.ts
2424
25 # A release must not carry an advisory nobody has reviewed, or a review
26 # that expired while the release was being prepared.
27 - name: Review dependency advisories
28 run: bun scripts/advisory-policy.ts
29
2530 release-sbom:
2631 needs: validate-release
2732 uses: ./.github/workflows/sbom.yml
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