Docs · Runbook

Local Security Audit Skill

This setup provides a local-first security gate for backend/ and app/ focused on:

Policy:

Files

Open Source Tooling Prerequisites

Required for full coverage:

Optional:

Install examples (macOS with Homebrew + pip):

brew install gitleaks semgrep trivy osv-scanner
python3 -m pip install pip-audit bandit checkov

Ensure executable scripts are set:

chmod +x scripts/security/audit.py

Manual Runs

Changed-scope scan (fast):

python3 scripts/security/audit.py --mode changed

Deep scan across backend + app:

python3 scripts/security/audit.py --mode deep

Write/update a baseline file for known-safe recurring findings:

python3 scripts/security/audit.py --mode deep --write-baseline

Trigger Behavior

If a Critical finding is detected, the audit command exits non-zero and the CI job reports failure. If only High/Medium findings are present, audit exits successfully after warning output.

PostgreSQL Model-Specific Checks

The audit runner includes backend-focused checks for SQLModel/SQLAlchemy patterns:

These checks are heuristic by design and complement Semgrep/Gitleaks, not replace deeper review.

Do We Need a Custom Script?

Short answer: yes, but keep it thin.

Without the script, you lose consistent policy orchestration and local context-specific checks.

Baseline and Signal Tuning

Verification Procedure

  1. Run python3 scripts/security/audit.py --mode changed on a normal code state.
  2. Add a temporary synthetic secret to a local test file (do not commit it), then re-run and confirm critical block behavior.
  3. Remove temporary synthetic data and re-run to confirm pass.

For a faster local loop, use the skill command: