Tpl situacao security audit

From artubss/SKILLS-CLAUDE-CODE · View interactive version

Tpl situacao security audit is an AI agent skill from the GitHub repository artubss/SKILLS-CLAUDE-CODE. Template do pack (situacao/04-security-audit.md). Orienta o agente em tarefas situacionais como debug, seguranca e refactor alinhado a esse contexto.

How to use this skill

Skill file

SITUATION: Security Audit & Vulnerability Review

Skill gerado a partir do pack templates-claude-code. Arquivo de origem: situacao/04-security-audit.md. Use como baseline e adapte ao projeto antes de mudancas grandes.

Conteudo do template

CONTEXT

Use this configuration when reviewing code for security vulnerabilities — either as a pre-launch audit, after a dependency alert, during a penetration test, or as part of a compliance requirement (SOC2, GDPR, PCI-DSS). This is a systematic, adversarial review: think like an attacker, not a developer. Every input is malicious until proven otherwise.

OBJECTIVES

APPROACH RULES

  1. Think like an attacker. For every user input, ask: what happens if I send 10,000 characters? A null byte? SQL syntax? A script tag? A relative path like ../../etc/passwd?
  1. Never trust client-side validation. Always verify that server-side validation exists for every constraint enforced on the frontend.
  1. Defense in depth. A vulnerability that requires two mistakes to exploit is better than one, but both should still be fixed. Do not accept "it's protected by X" as a reason not to fix Y.
  1. Severity before quantity. A single Critical/High vulnerability matters more than 20 Low/Informational ones. Prioritize ruthlessly.
  1. Authentication vs Authorization. AuthN = who are you? AuthZ = what can you do? Test both independently. Broken AuthZ (IDOR, privilege escalation) is often harder to find than AuthN bugs.
  1. Secret scanning is mandatory. Run git log --all -p | grep -E "(password|secret|key|token)" --no-index or use trufflehog/gitleaks on the full repo history, not just HEAD.

ROUTING TABLE

| If you encounter | Then |

|-----------------|------|

| User input going to SQL query | Check for parameterized queries. If string interpolation exists anywhere, it's CRITICAL. Flag immediately. |

| User input rendered in HTML | Check for innerHTML, dangerouslySetInnerHTML, eval. If unescaped, it's XSS — CRITICAL |

| File path constructed from user input | Path traversal risk. Must use path.basename() + allowlist of directories. Never concatenate directly |

| Passwords in code, config, or git history | Rotate immediately. Move to environment variables. Audit who had access to the repo |

| JWT implementation | Check: algorithm validation (reject alg: none), expiry enforced, signature verified on every request |

| CORS configuration | Access-Control-Allow-Origin: * is OK for public APIs, never for authenticated APIs. Check credentials header |

| Dependencies with CVEs | Classify by CVSS score. ≥7.0 = High (fix within sprint). ≥9.0 = Critical (fix today) |

| Authentication token in URL parameter | High severity. Tokens in URLs end up in logs, browser history, Referer headers. Move to headers |

| Missing rate limiting on auth endpoints | Brute force risk. Add rate limiting: max 5 attempts per IP per minute on login/reset |

| eval() or Function() with user data | Remote Code Execution potential. Critical. Remove immediately. |

OWASP Top 10 Checklist

DO NOT

OUTPUT FORMAT

Security Audit Report format:

## Security Audit Report
Date: [date]
Scope: [what was reviewed]
Auditor: [name]

### Executive Summary
[2-3 sentences: overall posture, critical count, recommendation]

### Findings

#### [CRITICAL-001] SQL Injection in /api/search
- Severity: Critical (CVSS 9.8)
- Location: src/api/search.ts:47
- Description: User input `q` parameter concatenated directly into SQL query
- Proof of Concept: GET /api/search?q='; DROP TABLE users; --
- Remediation: Use parameterized query: db.query("SELECT * FROM items WHERE name = $1", [q])
- Status: Open / Fixed / Accepted

### Remediation Priority
| Finding | Severity | Effort | Fix By |
|---------|----------|--------|--------|
| SQL Injection | Critical | 1h | Immediately |

QUALITY GATES

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.