Repository navigation
🌱 ci: gate devDependency advisories in npm audit - #519
Conversation
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
❌ Deploy Preview for hivecommons-docs failed. Why did it fail? →
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
Netlify deploy preview (6ae3dae51d7e483200500d9d) is the only red check; every GitHub Actions check on this head is green and the diff touches only .github/workflows/npm-audit.yml, which Netlify never reads. Treating as an external deploy-infrastructure failure, not a PR defect — deferring; no retry from this side. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Reviewed (correctness) — no blocking findings.
Advisory, non-blocking: both gate steps read the same .github/npm-audit-exceptions.json (scripts/npm-audit-gate.ts:216-221). Once a dev-only exception is added, the production step (.github/workflows/npm-audit.yml:46-47) will emit ::warning::Unused npm audit exception … on every run (scripts/npm-audit-gate.ts:239-241) because that advisory is absent from the --omit=dev report. Harmless noise now; worth a scope field or a second exceptions file when the gate is enforced.
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the full workflow and scripts/npm-audit-gate.ts at merge-base, then ran the new step locally on this head. Looks correct to me; nothing blocking.
What I verified:
scripts/npm-audit-gate.ts:67-83(validateAuditReport) and:96-115(collectAdvisories) only need avulnerabilitiesobject, so a fullnpm audit --jsonreport works unchanged, as #515 claims. The gate reads.github/npm-audit-exceptions.jsonfromprocess.cwd()(:208-212), which is the same path the production step already relies on.npm ciat.github/workflows/npm-audit.yml:38installs dev deps (no--omit=dev), so the unfilterednpm auditat the new step actually sees the dev tree.npm audit --jsonon49fef2dreports 0 advisories (there2js >=2.8.7override from #516 is inpackage.json:85), so the gate starts from an empty baseline — "fail only on increases" and "fail on any un-excepted high" are the same thing here. Baseline tracking is the (currently empty) exceptions file, which already carries an expiry.permissions: contents: readand the SHA-pinned actions are untouched; the diff adds two steps and no new secrets or tokens.
Two notes, not defects:
continue-on-error: trueis the only thing making this warning-only; nothing will remind anyone to drop it after one release. A follow-up issue (or aexpires-style date in the YAML comment) would keep the ratchet honest.- The red Netlify checks (deploy-preview / Header rules / Redirect rules / Pages changed) cannot be caused by a change confined to
.github/workflows/npm-audit.yml; worth re-running before reading them as a signal.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me; implements the ratchet exactly as decided on #515 (warning-only for one release via continue-on-error, then enforce by dropping it).
What I verified on head 49fef2d:
- The job's
permissions: contents: readis unchanged and the two new steps only invoke the repo's ownscripts/npm-audit-gate.ts(.github/workflows/npm-audit.yml:14-15,:56-59). No new actions, secrets, or triggers. npm audit --json(no--omit=dev) against this tree's lockfile reportstotal: 0, so the new dev gate passes with the current empty.github/npm-audit-exceptions.json. That empty file is the recorded baseline the decision asks for — there is nothing to list yet.scripts/npm-audit-gate.ts:200-209already validates the report shape, so a registry error in the dev run fails (soft, for now) rather than passing silently — same behaviour as the prod step.
One low-severity observation, not a blocker: both steps read the same exceptions file (scripts/npm-audit-gate.ts:224-229), and main emits ::warning::Unused npm audit exception … for any active entry the current report didn't use (:244-246). Once a dev-only exception (e.g. the re2js one from #515) is added, the production step will warn it is unused on every run, and vice versa. Harmless noise today; if it gets annoying, a --exceptions=<file> flag or a scope field on entries would separate them.
Suggestion: when this merges, open a tracker to remove continue-on-error after the next release so the "one release" clock is visible somewhere other than a YAML comment.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Ratchets the warning-only devDependency audit step added in #519 (closing the gate proposed in #515) to a hard gate: the "one release" condition in the ratchet comment never fires because this repo cuts no tags/releases (continuous Netlify deploy), so the soft gate could never go red. Verified safe at main@6a4fa59: npm-audit-gate.ts passes at --level=high on the full tree, the latest npm-audit workflow run is green, and .github/npm-audit-exceptions.json is empty. Hive-Run: #530 Hive-Plan: Enforce the devDependency npm audit gate Hive-Spec: npm-audit-gate#ratchet-515-519 Signed-off-by: onkar717 <[email protected]> Co-authored-by: onkar717 <[email protected]>
Why: the sixth dev-tree advisory (re2js) went undetected because the audit uses --omit=dev. Adds a second audit step covering devDependencies, using .github/npm-audit-exceptions.json (with expiry) so unpatched upstreams don't block. Per the approved ratchet decision, the new gate is warning-only (continue-on-error) for one release, then enforced.
Closes #515
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88