fix(frontend): resolve the npm-audit security gate - #782
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThe security workflow now produces JSON npm audit results and gates moderate-or-higher advisories through a Python allowlist checker. The allowlist records one react-router advisory, with unit tests covering extraction, filtering, and validation. dompurify is pinned to 3.4.12. ChangesSecurity audit gating
Frontend dependency pin
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant npmAudit
participant AuditGate
participant Allowlist
GitHubActions->>npmAudit: Generate npm-audit.json
GitHubActions->>AuditGate: Check moderate findings
AuditGate->>Allowlist: Load known GHSA IDs
AuditGate-->>GitHubActions: Return pass or fail status
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/npm_audit_known_vulns.py`:
- Around line 38-44: Update load_known_vulns in scripts/npm_audit_known_vulns.py
(lines 38-44) to require reason to be a non-empty string after trimming,
rejecting missing, non-string, and whitespace-only values with ValueError. Add
an ID-only fixture and assert loading raises ValueError in
tests/unit/test_npm_audit_known_vulns.py (lines 69-73).
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 149972cc-d58c-493d-b0d0-cc1300951e82
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
.github/workflows/security.ymlfrontend/package.jsonscripts/npm_audit_known_vulns.pysecurity/npm-audit-known-vulns.jsontests/unit/test_npm_audit_known_vulns.py
Two production advisories were failing the scheduled Security Scan: - dompurify <=3.4.11 (GHSA-c2j3-45gr-mqc4): bumped to 3.4.12, the published fix. - react-router "RSC Mode CSRF Bypass" (GHSA-qwww-vcr4-c8h2): this app is a Vite SPA using <BrowserRouter>, not React Router's RSC mode, so the vector does not apply, and the only published fix is a v7->v8 major upgrade. Track it as a reviewed, non-applicable advisory rather than downgrade to 7.11.0. npm audit has no --ignore-vuln, so scripts/npm_audit_known_vulns.py gates the audit JSON against security/npm-audit-known-vulns.json — mirroring the existing pip-audit known-vulns approach. Every allowlist entry carries a reason and a review date, so it is an audited record, not a silent mute.
2d6d489 to
4fd5bca
Compare
The scheduled Security Scan (Frontend Security / npm audit) fails on two production advisories. This resolves both.
dompurify (GHSA-c2j3-45gr-mqc4)
dompurifywas pinned at3.4.11, the last affected version. Bumped to3.4.12, the published fix.react-router — "RSC Mode CSRF Bypass" (GHSA-qwww-vcr4-c8h2)
The advisory affects React Router's RSC mode. This app is a Vite SPA rendered through
<BrowserRouter>(frontend/src/main.tsx) and never uses RSC, so the vector does not apply. The only published fix isreact-router@8.3.0(a v7→v8 major upgrade), and npm's automatic remediation is a breaking downgrade to7.11.0. Rather than take either, it is tracked as a reviewed, non-applicable advisory.npm-audit allowlist
npm audithas no--ignore-vuln, soscripts/npm_audit_known_vulns.pygates the audit JSON againstsecurity/npm-audit-known-vulns.json— mirroring the existing pip-auditknown-vulnsapproach. Every entry carries areason,reviewed_at, andsource, so the allowlist is an audited record rather than a silent mute.security.yml's npm-audit step now runs the gate. Addstests/unit/test_npm_audit_known_vulns.py.Summary by CodeRabbit
Security
New Features
Tests