Skip to content

Stop a registry outage from failing the audit gate - #1

Closed
Hijanhv wants to merge 1 commit into
mainfrom
fix/audit-gate-registry-outage
Closed

Hijanhv wants to merge 1 commit into
mainfrom
fix/audit-gate-registry-outage

Conversation

@Hijanhv

@Hijanhv Hijanhv commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Deploy run #12 failed on Verify frontend with a 503 from registry.npmjs.org/-/npm/v1/security/audits/quick. No advisory was found; npm could not be asked. npm audit exits 1 for both cases, so a registry blip gated the deploy and the "Name Unichain as the partner" commit never reached Pages. CI passed on the same commit, which is the tell: the tree was fine.

.github/scripts/npm-audit-gate.sh now reads the JSON report instead of trusting the exit code:

  • {"error": ...} from the registry: retry up to three times 15s apart, then ::warning:: and pass
  • empty or unparsable report: ::warning:: and pass
  • metadata.vulnerabilities.critical > 0: ::error:: and fail
  • everything else: print the per-severity counts and pass

Both workflows call it, so the critical threshold and the reason behind it live in one place rather than in a comment duplicated in each file. The script is added to the deploy path filter so a change to the gate rebuilds the site it gates.

Verified against the real lockfile: npm audit advisories -> critical: 0, high: 0, moderate: 0, low: 0, info: 0, exit 0. The report-parsing branches were exercised separately with mocked reports for the 503, string-error, clean, moderate/high-only, critical, and garbage cases.

Merging this re-triggers the deploy, which is what gets the site back in sync with main.

https://claude.ai/code/session_01XBecXxjFsZoeLPFsaebhwS

Run #12 of the deploy workflow failed with a 503 from the npm audit
endpoint. Nothing was wrong with the tree: npm could not reach the
service, and `npm audit` exits non-zero for that exactly as loudly as it
does for a real advisory. The commit was therefore never published, so
the site kept serving the previous revision while the repo had moved on.

Both workflows now call one script that reads the JSON report rather
than the exit code. A transport error becomes a warning after three
attempts, an unparsable report becomes a warning, and a critical
advisory still fails the build. The critical threshold and the reason
for it now live in one place instead of a comment duplicated in each
workflow.

Claude-Session: https://claude.ai/code/session_01XBecXxjFsZoeLPFsaebhwS
@Hijanhv Hijanhv closed this Sep 4, 2026
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
knot-hook-web Ready Ready Preview Sep 4, 2026 1:59am UTC

@Hijanhv
Hijanhv deleted the fix/audit-gate-registry-outage branch September 4, 2026 01:59

This branch was successfully deployed

1 active deployment
Preview — 1f611150 Deployed Sep 4, 2026 by vercel[bot]
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