ci(sec): add supply-chain security audit workflow#372
Open
Adiz4415 wants to merge 1 commit into
Open
Conversation
Adds `.github/workflows/security-audit.yml` that, on every PR to main (and on manual `workflow_dispatch`), runs `pnpm install --frozen-lockfile` (gated on `hashFiles(pnpm-lock.yaml) != \"\"` so it does not hard-fail every PR while the lockfile is still in `.gitignore`) followed by `pnpm audit --prod --audit-level=high`, which fails on any high or critical CVE in production dependencies. Workflow has least-privilege permissions (`contents: read` only). Once the maintainer un-ignores and commits `pnpm-lock.yaml`, the strict lockfile check flips on automatically without further edits.
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.
Summary
Adds
.github/workflows/security-audit.yml, a CI workflow that runs two supply-chain hygiene checks (per the SECURITY.md "npm / pnpm Supply Chain" section) on every PR tomainand onworkflow_dispatch:pnpm install --frozen-lockfile— surfaces #NOT-IN-LOCKFILE failures whenever a transitive dep was added without regenerating the lockfile. This step is gated onhashFiles(pnpm-lock.yaml) != ""because the repo currently gitignores the lockfile; until a follow-up removes that line, the workflow falls back to a soft-warning plainpnpm installso PRs aren't blocked.pnpm audit --prod --audit-level=high— exits non-zero if any production dep carries a known high-severity or critical CVE in the GitHub Advisory Database.Permissions are
contents: readonly.Reviewer feedback was integrated: the lockfile step is now conditional on
hashFiles(pnpm-lock.yaml) != ""so the workflow survives the current.gitignorepolicy without blocking PRs. The strict check will flip on automatically the moment a maintainer un-ignores + commitspnpm-lock.yaml.Active today vs. after the lockfile follow-up
pnpm install+ soft::warning::+pnpm audit --prod --audit-level=high. Audit gates PRs; lockfile drift is unmonitored.pnpm-lock.yamlpnpm install --frozen-lockfile(strict) + audit. Both gate PRs.Follow-ups (intentionally out of scope here)
pnpm-lock.yamlline from.gitignoreand commit the current lockfile so the strict lockfile step becomes active.paths:filter (["app/**", "package.json", ".github/dependabot.yml"]) so contract-only Rust PRs do not waste CI minutes onnpm audit.pnpm audit --jsonandupload-sarifto GitHub Code Scanning so findings surface in the Security tab alongside CodeQL.schedule:trigger so freshly-published CVEs are caught between PRs.actions/checkout,pnpm/action-setup, andactions/setup-nodeto commit hashes (per SECURITY.md recommendations).cargo auditworkflow for thecontracts/workspace (Cargo is not covered by Dependabot reliably today).Test / verify
After merge, open any PR; the workflow will appear in the Checks tab. While the lockfile is gitignored, expect a yellow
::warning::annotation on the install step but a green overall pass on the audit step (assuming no current high/critical CVEs).