Support path-scoped audit ignores with expiry dates (like audit-ci's allowlist) #15903
skrtheboss
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Contribution
Describe the user story
pnpm auditlets you suppress advisories viaaudit.ignore, a flat list of GHSA IDs inpnpm-workspace.yaml/root manifest. Ignoring a GHSA id suppresses it everywhere, for every module that happens to pull in the vulnerable package, regardless of dependency path.This is too broad for real-world usage:
some-deprecated-plugin > image-size), the same GHSA id also silently suppresses that vulnerability when it's later introduced through a completely different, unreviewed dependency path (e.g. directly as a production dependency, or via an unrelated package). A new, unreviewed occurrence of the same advisory elsewhere in the dependency graph goes unnoticed.audit-ci(https://github.com/IBM/audit-ci) already solves both problems. Its allowlist entries support:GHSA-id|packageorGHSA-id|package>subpackage→ only ignored when the advisory is reached through that specific dependency path (seelib/allowlist.ts, which detects|/>and treats the entry as path-scoped instead of a bare advisory/module match).active,notes, andexpiryfields (lib/nsp-record.ts), so an entry can be documented and automatically stops being honored onceexpirypasses — forcing a re-audit instead of silently ignoring forever.Example from our own
audit-ci.jsonc:{ "GHSA-5p2g-fcmc-qvqq|*docusaurus*>image-size": { "active": true, "notes": "Ignore this until 30th September 2026. The repository is archived and will not receive a security patch; re-evaluate for a replacement/alternative.", "expiry": "2026-09-30T06:00:00.000Z" } }Describe the solution you'd like
Extend
audit.ignoreso entries can, optionally:expirytimestamp, so the ignore automatically stops applying (and the advisory resurfaces) after a given date. A separatenotesfield isn't necessary here —pnpm-workspace.yamlis YAML, so a plain#comment above/beside the entry already covers documenting why something is ignored:Behavior:
expirypasses,pnpm auditshould report the advisory again (and ideally warn/fail loudly that a previously-ignored, now-expired entry needs re-evaluation, rather than silently going back to suppressing it).path/expiry) keep today's global, permanent-ignore behavior — fully backward compatible.audit.ignorePrune: pruning should only drop an entry once it's unused for all of its scoped paths, and expired entries should presumably also be flagged for pruning/review.This mirrors
audit-ci's allowlist model (minus its redundantnotesfield, since YAML comments already serve that purpose) closely enough that a near drop-in migration path could exist for teams (like ours) currently runningaudit-cialongside pnpm just to get this behavior.Describe the drawbacks of your solution
No response
Describe alternatives you've considered
audit-cias a separate tool alongsidepnpm audit— this is what we do today, but it duplicates configuration (audit-ci.jsoncvspnpm-workspace.yaml), duplicates CI steps, and doesn't benefit from pnpm's native audit integration (e.g. lockfile-aware resolution,pnpm audit --fix).All reactions