Security Scanning and Vulnerability Testing
Your dependency audit shows 14 high-severity vulnerabilities, three of which are in packages you import directly and eleven are transitive. The security team wants a remediation plan by Friday. You could spend two days reading CVE reports and tracing dependency chains, or you could have an AI tool analyze the entire dependency tree, assess which vulnerabilities are actually exploitable in your codebase, and generate a prioritized fix plan in 30 minutes.
What You’ll Walk Away With
Section titled “What You’ll Walk Away With”- Automated OWASP Top 10 scanning workflows integrated into your development cycle
- Dependency vulnerability auditing with AI-assisted risk assessment
- Prompt patterns for security-focused code review that catch real threats
- CI pipeline integration for continuous security scanning
- Penetration testing patterns that developers can run without security expertise
OWASP Top 10 Automated Scanning
Section titled “OWASP Top 10 Automated Scanning”Dependency Vulnerability Management
Section titled “Dependency Vulnerability Management”Audit our project dependencies for security vulnerabilities:
1. Run npm audit and analyze the results2. For each high/critical vulnerability: - Is it in a direct dependency or transitive? - Is the vulnerable code path actually reachable in our application? - What is the fix (upgrade, replace, or accept risk)?3. Create a prioritized remediation plan: - P0: Exploitable in our code, fix immediately - P1: Potentially exploitable, fix this sprint - P2: Not exploitable but should fix for hygiene - P3: Accept risk with documentation
Check package-lock.json for the full dependency tree.Show the upgrade path for each fixable vulnerability.claude "Run a complete dependency security audit:1. Execute: npm audit --json > /tmp/audit.json2. Analyze the results and categorize by exploitability3. For each critical/high finding, check if our code actually calls the vulnerable function (trace the import chain)4. Generate a fix script that upgrades safe dependencies5. For breaking upgrades, document what changes are needed6. Create a summary report in /docs/security-audit.md
Run the fix script after generating it. Verify the build still passes."Perform a dependency security audit:1. Analyze all dependencies for known vulnerabilities2. Trace each vulnerability to determine if it's reachable in our code3. Generate safe dependency upgrades4. Run the test suite after upgrades to verify nothing broke5. Create a PR with the fixes and an audit report
Prioritize exploitable vulnerabilities over theoretical ones.Security-Focused Code Review
Section titled “Security-Focused Code Review”CI Pipeline Security Integration
Section titled “CI Pipeline Security Integration”Use Background Agent to run security checks before pushing:
Before I push this branch, run a security checklist:1. npm audit - any new vulnerabilities introduced?2. Check the diff for hardcoded secrets (API keys, passwords, tokens)3. Verify all new API endpoints have authentication middleware4. Check that no new SQL queries use string interpolation5. Verify new dependencies are from trusted publishers
If any check fails, tell me what to fix before pushing.Integrate into CI with headless mode:
security-scan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci - name: Dependency audit run: npm audit --audit-level=high - name: Secret scanning run: | claude -p "Scan the git diff for secrets, credentials, or API keys: $(git diff origin/main...HEAD) Check for: AWS keys (AKIA), GitHub tokens (ghp_), generic API keys, passwords in config files, private keys, connection strings with passwords. Output JSON: {found: boolean, secrets: [{type, file, line}]} Exit 1 if any secrets found." - name: Security review run: | claude -p "Review changed files for security vulnerabilities: $(git diff --name-only origin/main...HEAD) Focus on: injection, auth bypass, IDOR, XSS. Output JSON with severity ratings. Exit 1 if critical issues found."Configure Codex for automated security review on PRs:
When reviewing PRs, check for security issues:1. Scan changed files for common vulnerability patterns2. Check new dependencies against vulnerability databases3. Verify authentication on new endpoints4. Flag any secrets or credentials in the diff5. Post findings as PR review comments with severity labelsPenetration Testing Patterns
Section titled “Penetration Testing Patterns”When This Breaks
Section titled “When This Breaks”“npm audit shows vulnerabilities but we cannot upgrade without breaking changes.” Use npm audit --omit=dev to filter to production dependencies only. For transitive vulnerabilities, check if the vulnerable path is reachable. Use npm audit fix --force with caution and a solid test suite as your safety net.
“Security scans produce too many false positives.” Tune your scanning rules. Exclude test files, mock data, and documentation from security scans. Customize the AI prompt to “only report vulnerabilities that could be exploited with a concrete attack scenario, not theoretical issues.”
“Developers resist security testing because it slows them down.” Make security scanning invisible. Run it in CI, not as a manual step. Only block PRs for critical and high severity issues. Let medium and low severity accumulate in a security backlog reviewed monthly.
“We do not have security expertise on the team.” This is exactly where AI shines. The prompts in this guide encode security expertise into a repeatable process. Start with the OWASP Top 10 scan and dependency audit — these catch the most common vulnerabilities with minimal expertise required.