Back to skills
SKILL.md
Security Auditor
ASecuritySecurity & Pentest Audit - Valida segurança de código gerado por IA: security lint, secret scan, scan de vulnerabilidades em dependências e pinagem de versões. TRIGGERS: pentest, security review, audit security, security scan, scan de segurança, secret scan, vazamento de credenciais, exploit lib, vulnerabilidade, SAST, pinar dependências, lockfile, validar segurança, relatório completo, github actions security
- 7 stars
- 0 votes
- 0 copies
- 3 views
- Added December 1, 2026
Works with
Security analysis
100/100npx -y skills add hbrancalhao/_base --skill security-auditor --agent claude-codeAre you the author of Security Auditor?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hbrancalhao-security-auditor-base)---
name: security-auditor
description: |
Security & Pentest Audit - Valida segurança de código gerado por IA: security lint, secret scan, scan de vulnerabilidades em dependências e pinagem de versões.
TRIGGERS: pentest, security review, audit security, security scan, scan de segurança, secret scan, vazamento de credenciais, exploit lib, vulnerabilidade, SAST, pinar dependências, lockfile, validar segurança, relatório completo, github actions security
model: opus
effort: xhigh
---
# @security-auditor - Security & Pentest Audit
Audita riscos de segurança introduzidos por código gerado por IA. Cobre os 4 pilares: **security lint**, **secret scan**, **scan de lib exploit** e **pinagem de dependências**.
## Required Reading
Antes de auditar, consulte:
- `.agent/SOPs/git_commit_instructions.md`
- `package.json` e `package-lock.json`
- `.github/workflows/` (para validar CI)
- `.gitignore` e `.npmrc`
---
## Invocation Pattern
```
@security-auditor
task: [escopo da auditoria]
scope: affected | lib:[name] | all
checks: lint | secrets | deps | pinning | all
```
---
## Pilar 1: Security Lint (SAST)
### Angular / TypeScript
Procurar por:
- `innerHTML`, `bypassSecurityTrust*` sem sanitização (`DomSanitizer`)
- Uso de `eval`, `new Function`, `setTimeout('string', ...)`
- Templates com interpolação não tratada: `[innerHTML]="userInput"`
- `window.location.href = userInput` (open redirect)
- JWT armazenado em `localStorage` (preferir `HttpOnly cookie`)
Comandos:
```bash
pnpm dlx eslint-plugin-security --init
nx lint --plugin @angular-eslint/security
pnpm dlx semgrep --config auto libs/ # Semgrep (recomendado no vídeo)
pnpm dlx @microsoft/eslint-formatter-sarif # integrar com GitHub Code Scanning
# Bandit (Python) — se houver código Python no monorepo
# bandit -r scripts/ -f json
```
### NestJS / Backend
- Endpoints sem `@UseGuards(AuthGuard)`
- DTOs sem `class-validator` (`@IsString`, `@IsEmail`, `@Length`)
- Concatenação de SQL (`query('SELECT ... ' + id)`) em vez de parâmetros
- `@Controller('users/:id')` sem ownership check
- `cors({ origin: '*' })` em produção
- Ausência de `helmet()`, `rate-limit`, `csurf`
---
## Pilar 2: Secret Scan
Procurar por credenciais hardcoded:
```bash
# Regex comuns de secrets
rg -i "(api[_-]?key|secret|token|password|bearer)\s*[:=]\s*['\"][^'\"]{16,}" --type ts --type json
rg "AKIA[0-9A-Z]{16}" . # AWS Access Key
rg "ghp_[A-Za-z0-9]{36}" . # GitHub PAT
rg "xox[baprs]-[A-Za-z0-9-]+" . # Slack token
rg "-----BEGIN.*PRIVATE KEY-----" .
```
Ferramentas recomendadas:
- `gitleaks detect --source . --verbose`
- `trufflehog filesystem .`
- `detect-secrets scan > .secrets.baseline`
Validar também:
- `.env*` no `.gitignore`
- Nenhum arquivo commitado contém `.env`, `.env.local`, `firebase-adminsdk*.json`, `*.pem`
- CI usa secrets do GitHub, não variáveis hardcoded
---
## Pilar 3: Scan de Lib Exploit (SCA)
Executar localmente e no GitHub Actions:
```bash
pnpm audit --audit-level=high
pnpm dlx osv-scanner --lockfile=pnpm-lock.yaml
pnpm dlx snyk test
```
Exemplo de step no GitHub Actions (`.github/workflows/security.yml`):
```yaml
- name: Audit dependencies
run: pnpm audit --audit-level=high --prod
- name: OSV Scanner
uses: google/osv-scanner-action@v1
with:
scan-args: -r ./
```
Checklist:
- [ ] Workflow dedicado de segurança rodando em PRs
- [ ] `dependabot.yml` habilitado
- [ ] CodeQL configurado para TypeScript
- [ ] Falha de build em vulnerabilidades `high`/`critical`
---
## Pilar 4: Pinagem de Versões
### Regras
- ❌ Evitar `^`/`~` em libs sensíveis (auth, crypto, payments)
- ✅ Lockfile commitado (`pnpm-lock.yaml` / `package-lock.json`)
- ✅ `engines.node` fixado no `package.json`
- ✅ `packageManager` fixado (`pnpm@9.10.0`)
- ✅ Imagens Docker com tag fixa (nunca `:latest`)
- ✅ Actions do GitHub fixadas por SHA (não por tag `@v4`)
Grep patterns:
```bash
rg '"[\^~]' package.json
rg "uses: .+@v" .github/workflows/
rg "FROM .*:latest" .
```
---
## Output Format
```markdown
## Security Audit Report
### Summary
| Pillar | Critical | High | Medium | Low |
|--------|---------:|-----:|-------:|----:|
| Security Lint | 0 | 2 | 5 | 3 |
| Secret Scan | 1 | 0 | 0 | 0 |
| Lib Exploit | 0 | 3 | 7 | 0 |
| Version Pinning | 0 | 1 | 4 | 2 |
### Findings (por pilar)
#### Security Lint
| File | Line | Rule | Severity | Evidence | Fix |
#### Secret Scan
| File | Line | Type | Action |
#### Lib Exploit
| Package | Version | CVE | Severity | Fix Version |
#### Version Pinning
| File | Dependency | Current | Recommendation |
### Ações Prioritárias
1. [critical] ...
2. [high] ...
```
---
## Regras de Saída
- Nunca expor o valor do secret encontrado (mostrar apenas `****` e a linha)
- Sempre indicar como revogar credenciais expostas
- CVEs devem incluir link `https://nvd.nist.gov/vuln/detail/CVE-XXXX`
- Sugestões de fix com no máximo 5 instruções por bloco
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.