Repository navigation
test: pin audit-gate's allowlist to SECURITY.md table rows in both directions - #1345
Merged
Merged
Conversation
…rections The only link between scripts/audit-gate.mjs's ALLOWLISTED_ADVISORIES and SECURITY.md's "Known unpatched dependency advisories" table was a whole-file substring search, which leaves two holes. A prose mention satisfies it. SECURITY.md names GHSA-ch52-4w7c-c8xp twice, in the paragraph recording that the entry was removed once upstream published http-cache-semantics 4.3.0; includes() cannot tell that apart from a live suppression. Re-adding that id to the allowlist leaves the test passing. The reverse direction was unchecked. unusedAllowlistEntries() forces the allowlist side of a removal, but nothing forced the table side, so a row could outlive its entry and tell a reader the gate accepts an advisory it blocks. Parse the ids that have a row in that section and assert parity both ways, plus a guard so a reformatted table fails rather than passing over an empty set -- the silent-pass failure mode audit-gate.mjs already refuses for an unreadable npm audit report. The existing includes() test stays: it still catches an id absent from the file entirely. Signed-off-by: quality <quality@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
tests/audit-gate.test.mjsheldscripts/audit-gate.mjs'sALLOWLISTED_ADVISORIESand SECURITY.md's "Known unpatched dependency advisories" table together with a
whole-file
securityMd.includes(id). That left two holes, both reproduced bymutation before the fix:
GHSA-ch52-4w7c-c8xpatlines 54 and 63 — in the paragraph recording that the entry was removed
after upstream published
http-cache-semantics4.3.0. Adding that id back toALLOWLISTED_ADVISORIESleft the parity test passing.unusedAllowlistEntries()forces theallowlist side of a removal; nothing forced the table side, so an orphaned row
could tell a reader the gate accepts an advisory it would in fact block.
Adding a table row for a non-allowlisted id left the suite green at 30/30.
This PR adds
documentedAdvisoryIds(), which reads the GHSA ids that have a rowinside that
##section, and three tests over it:stops recognising fails instead of iterating over an empty set, the same
silent-pass failure mode
audit-gate.mjsalready refuses for an unreadablenpm auditreportThe existing
includes()test is kept: it still catches an allowlisted id absentfrom the file entirely, with a simpler message. Tests only —
scripts/audit-gate.mjsand
SECURITY.mdare unchanged.Verification
Run at
fb75c1a(this branch's base), node v26.10.0:TZ=UTC node --test tests/audit-gate.test.mjs— 30 pass / 0 failnpm run test:unit:coverage:check— exit 0;src files100.00% lines /100.00% regions,
harness files99.63% regions (unchanged).tests/audit-gate.test.mjsregion coverage goes 85.71% → 86.96%; its one uncovered region is pre-existing
(reported at lines 316-318 before, 398-400 after the insertion).
npx prettier --check tests/audit-gate.test.mjs— cleandeleted table row → 3 fail; prose-only id re-allowlisted → caught by the new
table-row test while the old
includes()test still passed; orphaned table row→ 29 pass / 1 fail, the new reverse check alone.
Related Issue
Closes #1344
Overlap
Touches only
tests/audit-gate.test.mjs, covering thescripts/audit-gate.mjs↔
SECURITY.mdallowlist cluster. Disjoint from the open hold-gated PRs(#1334
mdx-active-content, #1339 devcontainer Features, #1330DirectoryFreshness,#1332
ci.ymltrace upload, #1337docs-contract.test.mjsbroken-link policy,#1341 e2e coverage Node major, #1343
check:linksgate placement) — none of themtouch this file,
scripts/audit-gate.mjs, orSECURITY.md.Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88