Skip to content

Fix npm audit findings and add audit gate - #2725

Merged
chalin merged 8 commits into
docsy:mainfrom
chalin:chalin-m24-npm-audit-2026-0818
Aug 18, 2026
Merged

chalin merged 8 commits into
docsy:mainfrom
chalin:chalin-m24-npm-audit-2026-0818

Conversation

@chalin

@chalin chalin commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator
  • adm-zip override: clears the transitive unzipper finding, with a tripwire that forces the override out when upstream Hugo catches up.
    • Keeps this change interim; the upstream bump stays the durable fix.
  • Name-matched advisory: records the accepted critical as a registry-name hit, not a fetched package in this repo.
    • The package stays GitHub-pinned for now; the name-recovery and advisory-scoping work remains external.
  • Audit gate: adds a CI check so new advisories fail fast and stale exceptions cannot go quiet.
    • Red-first proof: the new test goes red on an unaccepted advisory, a stale exception, and a stale override before going green.

chalin added 2 commits August 18, 2026 15:48
- Clears both npm audit highs: the advisory and its hugo-extended chain entry (hugo-extended pins adm-zip ^0.5.17; its own bump is open upstream as jakejarvis/hugo-extended#256, making this override interim)
- Adds a supply-chain assertion that goes red once hugo-extended's declared range moves past the vulnerable one, so the stale override gets dropped in that bump PR
- Carries the lock entry by hand (matching a fresh resolve's output) because npm trusts an in-sync lock and applies overrides only while re-resolving
- Complements the offline structural audit: npm audit must report nothing outside a reviewed-advisory allowlist, and allowlisted advisories no longer reported go red too (a stale exception is a silent hole)
- Accepts GHSA-q3xp-j858-q9xf, which matches the registry name markdownlint-rule-link-pattern only: this repo installs the package commit-pinned from its author's GitHub tag, so the flagged registry code is never fetched
@chalin chalin changed the title Fix npm audit findings and gate future advisories Fix npm audit findings and add audit gate Aug 18, 2026
chalin added 6 commits August 18, 2026 16:01
Windows CI fails when spawnSync tries to invoke npm.cmd directly, since
batch files require shell execution. Use 'npm' on all platforms with
shell: true on Windows; Windows PATH resolves npm to npm.cmd. Add error
checking for spawnSync failures.
Extract audit validation into a testable helper function and add five fixture
tests that fail-close on schema evolution and exception staleness:

- Add auditReportVersion === 2 check to fail-closed on npm audit v3 format change
- Validate string via entries resolve to keys in vulnerabilities (no dangling chains)
- Exclude null from via type check (fail-closed rather than throwing mid-loop)
- Fixture: valid report with accepted advisory parses correctly
- Fixture: unreviewed advisory is rejected (proof of acceptance check)
- Fixture: missing accepted advisory fails (proof of stale-exception detection)
- Fixture: format version change is rejected (proof of version pinning)
- Fixture: dangling string via is rejected (proof of chain validation)

With the allowlist empty (once npm scopes GHSA-q3xp-j858-q9xf), the version
check and string-chain validation become the only proof that advisory objects
were parsed. Red-first verified: latent holes confirmed to fail on old parser.

Fixes concerns from adversarial review re: false-clean after allowlist drain.
- Replace truthy check (allVulns[via]) with Object.hasOwn to close
  prototype-key bypass (constructor, __proto__, toString, etc.)
- Add F6: mixed-advisory fixture (allowlisted + unreviewed GHSA in same
  report) to catch early-exit shortcuts and order-dependent regressions
- Add F7: valid transitive chain (string via → allowlisted advisory)
  to verify success path for npm v2 chained reports

Red-first verified: old truthy check falsely passes on prototype keys;
new fixtures would fail on early-exit regression. All 8 audit-gate
fixtures now pass on current parser.
@chalin
chalin merged commit a1e8fc7 into docsy:main Aug 18, 2026
17 checks passed
@chalin
chalin deleted the chalin-m24-npm-audit-2026-0818 branch August 18, 2026 21:00
chalin added a commit to chalin/docsy that referenced this pull request Aug 18, 2026
Sweep of the messages inherited with docsy#2725, per the repo's
assert-message guidance: expected-condition phrasing (no 'still',
'unexpected', 'must'), and values that assert.equal already prints on
failure dropped from messages. The parser fixture regexes that match
these messages are updated in step; the full suite is the proof.
chalin added a commit to chalin/docsy that referenced this pull request Aug 21, 2026
- Drops retirement history (the GHSA match, docsy#2725 lineage) from the
  audit-test comments: the commit/PR record owns it; the gate mechanism
  is stated in the file header and the code
@chalin chalin added this to the 0.17.0 milestone Aug 26, 2026
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