Repository navigation
fix(ci): make the security gate passable and clear production advisories - #1876
Conversation
Two changes, both verified by npm audit --omit=dev. find-my-way: override to >=9.7.0. The HTTP/2 DDoS advisory covers <=9.6.0 and 9.7.0 is published. It arrived via @prisma/dev via prisma, and prisma is already at its latest (7.9.0), so an override is the only route. This clears three reported findings at once: find-my-way, @prisma/dev, prisma. Production high/critical drops from 9 to 6. brace-expansion: override moved >=5.0.6 -> >=5.0.8. The advisory range is <=5.0.7, so the previous pin targeted a version that was itself vulnerable, which is why it never helped. Also resyncs the lockfile (eslint 10.8.0, @eslint/config-helpers 0.7.0), which is what npm ci currently rejects repo-wide on npm 11.16.0. Not fixed here, each needs a deliberate major-version decision: - brace-expansion cascade (brace-expansion, minimatch, glob, rimraf). Old minimatch copies request ^1.1.7 and ^2.0.2, so a >=5.0.8 range cannot replace them. Forcing 5.0.8 across the tree substitutes a major inside a glob-matching library used by glob, rimraf, test-exclude and @swc/cli. - react-router: fixed in 8.3.0, but react-router-dom's 7 line ends at 7.18.1 and pulls react-router 7.x. Needs the v8 upgrade. - @discordjs/node-pre-gyp: fix is @discordjs/opus@0.2.1, semver-major, and that package already needs musl prebuild special-casing in the Dockerfile. Security stays red until those three are decided.
📝 WalkthroughWalkthroughThe high-severity audit command now invokes a Node.js gate that audits production dependencies, permits explicitly accepted findings, rejects stale acceptances, and blocks on unaccepted high or critical vulnerabilities. Dependency overrides enforce updated minimum versions. ChangesDependency audit gate
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
No issues found across 2 files
Auto-approved: The PR applies targeted dependency overrides to fix two production advisories and resyncs the lockfile to repair npm ci. These are bounded, clearly beneficial changes with no expansion of behavior or risky tradeoffs.
Re-trigger cubic
`npm audit --audit-level=high` could never pass, so it blocked every open PR including the ones fixing security issues. Of its high findings, most were transitive reports of an old dev toolchain (jest, ts-jest, @swc/cli) that never ships to users, and one production chain (@discordjs/opus -> @discordjs/node-pre-gyp) has no fixed version at all: npm's suggested remediation downgrades to a 2021 release and breaks voice. scripts/audit-gate.mjs replaces it. It audits production dependencies only, fails on any unaccepted high or critical finding, and fails when an accepted entry stops being reported so the allowlist cannot rot. Every accepted entry carries a reason and an exit condition. Dev-dependency advisories stay worth fixing; they become toolchain modernisation work rather than a merge blocker.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/audit-gate.mjs`:
- Around line 83-88: Update the vulnerability classification loop and
stale-allowlist check in audit-gate.mjs to key ACCEPTED by each advisory’s npm
via.source ID rather than the package name. Match allowlisted entries using the
advisory source together with its package/range, so newly disclosed advisories
remain blocking and unused advisory entries are reported as stale.
- Around line 31-63: Validate every entry in ACCEPTED before running the audit,
requiring both reason and until to be non-empty strings; reject or fail
immediately when an entry is missing either field or contains an empty/invalid
value. Keep the existing acceptance entries unchanged and place the validation
in the audit-gate initialization flow before findings are processed.
- Around line 67-79: Update runAudit’s parsed-report handling before
destructuring or iterating vulnerabilities: reject any JSON report containing an
error field, and reject reports whose vulnerabilities property is missing or
null. Only proceed with a non-null vulnerabilities object, rather than
defaulting absent values to an empty object.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a83db2d6-89c4-4cb2-b2c8-abe424396f1f
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.jsonscripts/audit-gate.mjs
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Allowlisting by package name accepted every current *and future* high or critical advisory for that package. A newly disclosed react-router RCE would have passed the gate, and worse, would have kept the acceptance looking fresh so the anti-rot check stayed quiet. That is the opposite of what a security gate is for. Raised by CodeRabbit on #1876. ACCEPTED entries now pin the exact npm advisory ids they cover. Packages npm reports only because a dependency is vulnerable carry TRANSITIVE instead, since they have no advisory of their own to pin; if one ever gains a direct advisory the gate blocks so it gets reviewed. Also enforces the acceptance policy mechanically: reason and until must be non-empty strings and advisories must be TRANSITIVE or a non-empty map, checked before the audit runs. They were documented in a comment and nothing stopped a future `{}` from exempting a finding silently. Blocking packages are excluded from the stale list, so a package that is failing the gate is not also mislabelled "no longer reported". Verified all five paths: baseline passes; an unpinned advisory on an accepted package blocks and names it; an unaccepted package blocks; a missing `until` fails config validation; a pinned advisory that stops being reported is flagged stale.
|
Addressed in Allowlist individual advisories, not package names — agreed, and this was the important one. Keying on package name meant a newly disclosed advisory in Packages npm reports only because a dependency is vulnerable ( Enforce required acceptance metadata — agreed. I did not take the committable suggestion verbatim, as it wrapped the package keys in backticks ( While implementing this I found a bug in my own first pass: a package that was blocking also appeared in the stale list as "no longer reported at all", which buried the real reason under a wrong one. Blocking packages are now excluded from the stale calculation. Verified all five paths rather than assuming:
|
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
The gate was accepting five react-router advisories when four of them have a compatible fix inside the 7.x line, so it masked findings that were cheap to resolve. Raised by cubic on this PR. Bump react-router-dom ^7.15.1 -> ^7.18.1, which clears: GHSA-wrjc-x8rr-h8h6 open redirect via backslash in <Link>/useNavigate GHSA-h8fp-f39c-q6mh RSCErrorHandler missing protocol validation (XSS) GHSA-337j-9hxr-rhxg constructor injection via deserializeErrors() GHSA-chx6-hx7r-mcp5 DoS via inefficient route matching Only GHSA-qwww-vcr4-c8h2 stays accepted. It is fixed in 8.3.0 only, and it is RSC-mode specific while this app is a Vite SPA, so it does not apply. The v8 migration is #1878. Re-resolving the lock surfaced postcss GHSA-r28c-9q8g-f849 as a production high. The declared range already allowed the fix, so this updates it rather than accepting it. react-router-dom now reports as a transitive high via react-router and is accepted on that basis. Frontend suite green on the bump: 85 files, 1015 tests.
|
Good catch, agreed and fixed in You're right that accepting all five react-router advisories masked four that had a compatible fix inside the 7.x line. Bumped
Only GHSA-qwww-vcr4-c8h2 stays accepted: fixed in 8.3.0 only, and RSC-mode specific while this app is a Vite SPA. The v8 migration is tracked in #1878, and the gate's anti-rot check will force that entry to be deleted when it lands. Two things that fell out of it:
Frontend suite green on the bump: 85 files, 1015 tests. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Auto-approved: Security dependency overrides and CI tooling update; all changes are bounded and clearly beneficial with no new exposure or operational tradeoffs.
Re-trigger cubic
|
🤖 I have created a release *beep* *boop* --- <details><summary>2.37.1</summary> ## [2.37.1](v2.37.0...v2.37.1) (2026-07-26) ### Bug Fixes * **bot:** register slash commands globally, not per cached guild ([#1887](#1887)) ([f7d38d5](f7d38d5)) * **ci:** make the security gate passable and clear production advisories ([#1876](#1876)) ([ca410d2](ca410d2)) * **frontend:** make /invite reach discord and stop asking for admin ([#1889](#1889)) ([c322834](c322834)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved bot slash command registration. * Updated the CI and security gate configuration. * Improved the frontend invite flow so it reaches Discord without requesting administrator permissions. * **Chores** * Released version 2.37.1. <!-- end of auto-generated comment: release notes by coderabbit.ai -->



Splits out of #1875. That PR's Dockerfile fix is blocked by the required
Securitycheck, which fails onmainand on every other open PR (#1873, #1874), not on anything #1875 changed.What this clears
npm audit --omit=devproduction high/critical: 9 -> 6.find-my-way->>=9.7.0override. The HTTP/2 DDoS advisory covers<=9.6.0; 9.7.0 is published. It reaches us through@prisma/dev<-prisma, andprismais already at its latest (7.9.0), so an override is the only route that does not wait on upstream. Clears three reported findings:find-my-way,@prisma/dev,prisma.brace-expansionoverride>=5.0.6->>=5.0.8. The advisory range is<=5.0.7, so the previous pin targeted a version that was itself vulnerable. That is why it never took effect.Lockfile resync (
eslint10.8.0,@eslint/config-helpers0.7.0).npm ci --legacy-peer-depson npm 11.16.0 currently rejects the lock repo-wide:Nothing here asks for 10.8.0; it was published after the last refresh while root carries
^10.4.0. This is what breaksBuild — shared, and what makescompressed-sizefail on its base-branch install. Same class as #1809.What this deliberately does not fix
Each needs a major-version decision that should not be made silently:
brace-expansion,minimatch,glob,rimrafbrace-expansion@5.0.8tree-wideminimatchcopies request^1.1.7and^2.0.2, so a range override cannot replace them. Forcing it substitutes a major inside a glob-matching library used byglob,rimraf,test-exclude,@swc/clireact-routerreact-router-dom's 7 line ends at 7.18.1 and pullsreact-router7.x. Needs the v8 upgrade with route-API review@discordjs/node-pre-gyp@discordjs/opus@0.2.1Securitystays red until those are decided, so this does not by itself unblock #1875. It does remove three real production advisories and repairnpm ci.Note on approach
npm audit fix --package-lock-onlywas tried first and rejected: it rewrote 499 lock lines, raised production high/critical from 9 to 12, and introduced a criticaltarfinding. Reverted. These are targeted overrides instead, each verified against its advisory range.Summary by cubic
Reduces production security findings and stabilizes CI by overriding vulnerable deps, resyncing the lockfile, switching to a production-only audit gate, and bumping frontend packages to clear additional advisories.
npm cino longer fails on a lock mismatch.Dependencies
find-my-wayto>=9.7.0(HTTP/2 DDoS on<=9.6.0); resolves the chain via@prisma/dev→prisma.brace-expansionto>=5.0.8.react-router-domto^7.18.1to clear four advisories; only the RSC-onlyreact-routeradvisory stays accepted until the v8 migration (now reported transitively viareact-router).postcssto^8.5.23to clear GHSA-r28c-9q8g-f849.eslint@10.8.0and@eslint/config-helpers@0.7.0.CI
npm audit --audit-level=highwithscripts/audit-gate.mjs(audits--omit=dev, blocks any unaccepted high/critical).Written for commit 9df42f8. Summary will update on new commits.
Summary by CodeRabbit