Skip to content

Security Audit

Grant includes shell scripts for dependency vulnerability scanning across the entire monorepo.

Commands

bash
pnpm audit:quick    # Fast check for HIGH/CRITICAL only (CI gate)
pnpm audit          # Full audit with detailed report
pnpm audit:fix      # Attempt automatic fixes with backup
pnpm audit:pnpm     # Raw pnpm audit across all workspaces

Scripts

All scripts are in /scripts and work on Linux, macOS, WSL, and Docker:

ScriptPurposeOutput
audit-quick.shFast pass/fail for high/critical vulnerabilitiesaudit-reports/quick-audit-latest.json
audit-security.shFull audit, outdated packages, lock file integrityaudit-reports/audit-YYYYMMDD-HHMMSS.txt
audit-fix.shAuto-fix with backup and post-fix reportaudit-reports/post-fix-audit-*.json

Reports are stored in audit-reports/ (git-ignored, auto-created).

Severity Levels

SeverityAction
CriticalFix immediately before any deployment
HighFix before production release
ModerateFix in next update cycle
LowFix when convenient

Daily: Run pnpm audit:quick before committing.

Weekly: Run pnpm audit for a full report.

After dependency updates:

bash
pnpm audit
pnpm build
pnpm test

When vulnerabilities are found:

  1. Try pnpm audit:fix
  2. If auto-fix fails, update specific packages: pnpm update <package>@latest
  3. Verify: pnpm audit && pnpm build && pnpm test
  4. If no fix exists, document the accepted risk

CI/CD Integration

GitHub Actions

An automated workflow at .github/workflows/security-audit.yml runs on pushes to main, all PRs, and weekly (Mondays at 9am UTC). It uploads audit artifacts and fails on high/critical findings.

Generic CI/CD

bash
pnpm install --frozen-lockfile
pnpm audit:quick    # Exit code 1 if vulnerabilities found

Post-Fix Checklist

After running pnpm audit:fix:

  1. pnpm build — ensure everything compiles
  2. pnpm test — verify functionality
  3. Review pnpm-lock.yaml changes
  4. Test critical features manually
  5. Commit if all checks pass

Related:

Released under the MIT License.