ae39e45460
NOVAS SKILLS: - next-best-practices v0.1.0 (CLEAN) — Next.js App Router, RSC, caching, data - nextjs-patterns v1.0.0 (CLEAN) — Next.js 15: Server Actions, route handlers - vite v1.0.0 (CLEAN) — env vars, aliases, proxy, CJS compat - uncle-bob v1.0.0 (CLEAN) — Clean Code, SOLID, Clean Architecture - clean-code-review v1.0.0 (CLEAN) — naming, guard clauses, anti-patterns, refactoring - vue v1.0.0 (CLEAN) — Vue framework - vue-composition-api-best-practices v1.0.0 (CLEAN) — composables, Pinia, reactivity BIBLIOTECA INTELIGENTE libs/ (10 dominios, 11 arquivos): - typescript/ — TS safe + generics gotchas - react/ — Next.js App Router + Vite config - vue/ — Composition API + Pinia - linux/ — System diagnostic cheatsheet - database/ — PostgreSQL + MySQL patterns - browser/ — Chromium CLI + E2E testing - security/ — SAST audit (OWASP Top 10) - best-practices/ — Clean Code + SOLID + Clean Architecture - deploy/ — Docker multi-stack + OpenClaw ops - + INDEX.md como guia de navegacao .learnings/ — LRN-20260519-003 criado (biblioteca compartilhada)
63 lines
2.4 KiB
Markdown
63 lines
2.4 KiB
Markdown
# SAST — Security Audit Guide
|
|
|
|
> Use APENAS quando o usuário explicitamente pedir análise de segurança.
|
|
|
|
## Severidade
|
|
| Nível | Impacto |
|
|
|-------|---------|
|
|
| Critical | RCE, exfiltração de dados, instruction override |
|
|
| High | Leitura/modificação de dados sensíveis, bypass de ACL |
|
|
| Medium | Dados limitados, engano de usuário |
|
|
| Low | Impacto mínimo |
|
|
|
|
## Categorias de Vulnerabilidade
|
|
|
|
### 1. Hardcoded Secrets
|
|
```
|
|
🔴 API_KEY=sk-... PASSWORD=... SECRET=... TOKEN=... PRIVATE_KEY=<base64...>
|
|
```
|
|
|
|
### 2. Injection
|
|
| Tipo | Exemplo |
|
|
|------|---------|
|
|
| SQL Injection | `query("SELECT * FROM t WHERE id=" + userInput)` |
|
|
| XSS | `<div dangerouslySetInnerHTML={{ __html: userInput }} />` |
|
|
| Command Injection | `` exec(`convert ${userInput} file.png`) `` |
|
|
| SSRF | `fetch(userProvidedUrl)` sem allowlist |
|
|
|
|
### 3. Broken Access Control
|
|
- IDOR — recurso acessado por id inserido pelo usuário sem verificar ownership
|
|
- Missing function-level AC — sem check de auth antes de operação sensível
|
|
- Path traversal — input de usuário em caminho de arquivo sem sanitização
|
|
|
|
### 4. LLM/Prompt Safety
|
|
- **Prompt Injection** — input não confiável concatenado em prompts sem boundary
|
|
- **Unsafe Execution** — output de LLM passado para `eval()`, `exec`, shell commands
|
|
- **Output Injection** — output flui para sinks de SQLi, XSS, command injection
|
|
- **Flawed Security Logic** — decisões de segurança baseadas em output não validado de LLM
|
|
|
|
## SKILL.md Review Checklist
|
|
```
|
|
✓ Sem instruction override ("Ignore previous instructions...")
|
|
✓ Sem exfiltração de dados (enviar dados para URL externa)
|
|
✓ Sem falsas claims de privilégio ("Você tem root access...")
|
|
✓ Sem conteúdo escondido (base64, zero-width chars)
|
|
✓ Tool usage seguro (sem eval(user_input), sem writes em /etc/*)
|
|
✓ Sem engano (não dizer que é humano)
|
|
✓ Scoped ao propósito
|
|
```
|
|
|
|
## OWASP Top 10 Mapping
|
|
| OWASP | Categoria na skill |
|
|
|-------|-------------------|
|
|
| A01 Broken Access Control | Access Control |
|
|
| A02 Cryptographic Failures | Hardcoded Secrets |
|
|
| A03 Injection | SQL Injection, XSS, Command Injection, SSRF |
|
|
| A04 Insecure Design | Clean Architecture review |
|
|
| A05 Security Misconfiguration | Env vars, default credentials |
|
|
| A06 Vulnerable Components | npm audit equivalent check |
|
|
| A07 Auth Failures | Authentication weaknesses |
|
|
| A08 Data Integrity Failures | Unsafe deserialization |
|
|
| A09 Logging Failures | PII em logs |
|
|
| A10 SSRF | Já em A03 |
|