| name | security-scanner |
| description | Security audit and vulnerability scanning workflow. Use when reviewing code for security issues, checking configurations, or validating hardening measures. |
Skill: security-scanner
Description
Provides systematic security review patterns aligned with OWASP Top 10 and NixOS hardening best practices. Focuses on practical, actionable security checks.
When to Use
- Reviewing code changes for security issues
- Auditing service configurations
- Checking for hardcoded secrets
- Validating systemd hardening
- Pre-deployment security checks
Security Audit Protocol
Phase 1: Quick Scan
Fast checks that catch common issues.
grep -rn --include="*.py" --include="*.sh" --include="*.nix" \
-E "(password|secret|api_key|token)\s*=\s*['\"][^'\"]+" .
ss -tlnp | grep -v "127.0.0.1"
find . -type f -perm /go+w -ls 2>/dev/null
env | grep -iE "password|secret|token|key" | grep -v "_FILE="
Phase 2: OWASP Top 10 Checklist
| Risk | Check | Command/Pattern |
|---|
| A01: Broken Access Control | Auth on endpoints | Check middleware, decorators |
| A02: Cryptographic Failures | Secrets management | Env vars, not hardcoded |
| A03: Injection | Input validation | Parameterized queries |
| A05: Security Misconfiguration | Default configs | Service hardening |
| A06: Vulnerable Components | Dependencies | npm audit, pip-audit |
| A09: Security Logging | Audit trails | No secrets in logs |
Phase 3: Service Hardening Check
systemctl show <service>.service --property=PrivateTmp,NoNewPrivileges,ProtectSystem,ProtectHome
aa-status | grep <service>
getcap /usr/bin/<binary>
Phase 4: NixOS-Specific Checks
grep -rn --include="*.nix" -E "port = [0-9]+;" nix/
grep -rn --include="*.nix" "sops\|agenix\|/run/secrets" nix/
find /etc/nixos -name "*.nix" -exec grep -l "password\|secret" {} \;
Quick Commands
Secret Scanning
git log -p | grep -iE "password|secret|api_key|token" | head -20
git diff --cached | grep -iE "(password|secret|token|key)\s*=\s*['\"]"
scripts/governance/tier0.d/check-sops-sync.sh --pre-commit 2>/dev/null || true
rg -nI -e 'AKIA[0-9A-Z]{16}' -e 'ghp_[A-Za-z0-9]{36}' -e 'github_pat_[A-Za-z0-9_]{20,}' \
-e 'sk-[A-Za-z0-9]{20,}' -e 'xox[baprs]-[A-Za-z0-9-]{10,}' \
-e '-----BEGIN (RSA|EC|OPENSSH|DSA|PGP) PRIVATE KEY-----' . 2>/dev/null \
|| echo "no high-signal secrets found"
Dependency Vulnerabilities
pip-audit 2>/dev/null || pip list --outdated
npm audit 2>/dev/null || true
nix-shell -p vulnix --run "vulnix -S" 2>/dev/null || echo "vulnix not available"
Network Security
ss -tlnp
sudo iptables -L -n 2>/dev/null || echo "Check firewall config"
curl -vI https://localhost:<port> 2>&1 | grep -E "SSL|TLS|certificate"
Auth & Access
grep -rn --include="*.py" "X-API-Key\|Authorization\|Bearer" .
ls -la /run/secrets/ 2>/dev/null
sudo -l
Security Hardening Checklist
Service Configuration
Secrets Management
Network Security
Input Validation
AI Stack Security Commands
scripts/testing/check-api-auth-hardening.sh
scripts/testing/check-mcp-health.sh --optional
scripts/testing/smoke-focused-parity.sh
Token Efficiency Rules
- Run quick scan first - catches 80% of issues.
- Use automated scanners before manual review.
- Focus on externally-exposed surfaces first.
- Check secrets before code logic.
- Document all findings with severity and fix.