ci: Add npm security audit gate to deployment pipelines - #189
Conversation
Add `npm audit --audit-level=critical` after dependency installation and before build in all deployment scripts. This stops deployments when critical vulnerabilities are detected while allowing lower-severity warnings to pass through. Affected paths: - GitHub Actions staging deployment - GitHub Actions production deployment - Local deploy-staging.sh script
WalkthroughSecurity audit checks are added to deployment workflows using Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2026-01-04T06:26:12.870ZApplied to files:
📚 Learning: 2026-01-04T06:26:12.870ZApplied to files:
📚 Learning: 2026-01-04T06:26:12.870ZApplied to files:
📚 Learning: 2026-01-04T06:26:12.870ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (4)
Comment |
Summary
npm audit --audit-level=criticalsecurity check to all deployment pathsChanges
.github/workflows/deploy.yml(staging)npm ci, before build.github/workflows/deploy.yml(production)npm ci, before buildscripts/deploy-staging.shBehavior
sequenceDiagram participant Deploy as Deployment Script participant NPM as npm participant Audit as npm audit participant Build as npm build Deploy->>NPM: npm ci (install dependencies) NPM-->>Deploy: Dependencies installed Deploy->>Audit: npm audit --audit-level=critical alt Critical vulnerabilities found Audit-->>Deploy: Exit code 1 Deploy->>Deploy: Stop deployment ❌ else No critical vulnerabilities Audit-->>Deploy: Exit code 0 Deploy->>Build: npm run build Build-->>Deploy: Build complete Deploy->>Deploy: Continue deployment ✅ endTest plan
scripts/deploy-staging.shruns audit step successfullySummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.