jarvis-ai-framework 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +416 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/agents/AGENTS.md +234 -0
- package/agents/README.md +309 -0
- package/agents/engineering/data/eng.data-engineer.agent.md +309 -0
- package/agents/engineering/eng.agent.md +303 -0
- package/agents/engineering/eng.bug-hunter.md +386 -0
- package/agents/engineering/eng.cybersecurity.agent.md +503 -0
- package/agents/engineering/eng.dev-code-reviewer.md +148 -0
- package/agents/engineering/eng.docs-writer.md +152 -0
- package/agents/engineering/eng.frontend.agent.md +117 -0
- package/agents/engineering/eng.rpa.agent.md +215 -0
- package/agents/engineering/eng.tech-analyst.agent.md +102 -0
- package/agents/engineering/eng.ux-designer.agent.md +193 -0
- package/agents/engineering/qa/eng.qa.cypress-specialist.md +109 -0
- package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +85 -0
- package/agents/engineering/qa/eng.qa.quality-strategist.md +111 -0
- package/agents/engineering/qa/eng.qa.test-architect.md +400 -0
- package/agents/engineering/qa/eng.qa.test-planner.md +477 -0
- package/agents/engineering/qa/eng.qa.testing-engineer.md +339 -0
- package/agents/product/prod.pm-checker.md +52 -0
- package/bin/commands/docs-publish.js +184 -0
- package/bin/commands/docs-sync.js +139 -0
- package/bin/commands/info.js +87 -0
- package/bin/commands/init.js +237 -0
- package/bin/commands/install-rtk.js +90 -0
- package/bin/commands/list.js +48 -0
- package/bin/commands/qa-signoff.js +112 -0
- package/bin/commands/whoami.js +43 -0
- package/bin/jarvis.js +159 -0
- package/bin/lib/auth/session.js +56 -0
- package/bin/lib/config/constants.js +123 -0
- package/bin/lib/config/ide-config.js +233 -0
- package/bin/lib/core/scanner.js +124 -0
- package/bin/lib/core/sync-engine.js +551 -0
- package/bin/lib/docs/fetch-file.sh +41 -0
- package/bin/lib/docs/publish-file.sh +284 -0
- package/bin/lib/docs/validate-frontmatter.js +157 -0
- package/bin/lib/env-loader.js +198 -0
- package/bin/lib/tasks/comment.js +131 -0
- package/bin/lib/utils/git-parser.js +145 -0
- package/bin/lib/utils/logger.js +104 -0
- package/bin/lib/utils/npmrc-parser.js +106 -0
- package/bin/lib/utils/paths.js +55 -0
- package/bin/lib/utils/ui.js +59 -0
- package/bin/lib/vcs/api.js +312 -0
- package/bin/lib/vcs/create-issue.js +43 -0
- package/bin/lib/vcs/create-merge.js +43 -0
- package/bin/lib/vcs/fetch-raw.js +30 -0
- package/bin/postinstall.js +41 -0
- package/members.md +25 -0
- package/package.json +55 -0
- package/rules/AGENTS.md +205 -0
- package/rules/engineering/data/data-rules.md +200 -0
- package/rules/engineering/eng-rules.md +243 -0
- package/rules/engineering/eng-security-rules.md +186 -0
- package/rules/engineering/eng.breakdown-subtasks-rules.md +585 -0
- package/rules/engineering/eng.bump-rules.md +27 -0
- package/rules/engineering/eng.docs-scraping-rules.md +64 -0
- package/rules/engineering/eng.downstream-flow-rules.md +297 -0
- package/rules/engineering/eng.integrations-rules.md +73 -0
- package/rules/engineering/eng.plan-rules.md +333 -0
- package/rules/engineering/eng.pr-rules.md +359 -0
- package/rules/engineering/eng.pre-pr-rules.md +103 -0
- package/rules/engineering/eng.start-rules.md +246 -0
- package/rules/engineering/eng.tech-spec-rules.md +968 -0
- package/rules/engineering/eng.work-rules.md +312 -0
- package/rules/engineering/frontend/eng.frontend-rules.md +147 -0
- package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
- package/rules/engineering/qa/eng.qa.exploratory-session-rules.md +137 -0
- package/rules/engineering/qa/eng.qa.quality-gate-scoring-rules.md +181 -0
- package/rules/engineering/qa/eng.qa.tech-spec-validation-criteria-rules.md +120 -0
- package/rules/engineering/rpa/eng.rpa-rules.md +230 -0
- package/rules/product/README.md +24 -0
- package/rules/product/prod-rules.md +151 -0
- package/rules/rtk-rules.md +68 -0
- package/skills/AGENTS.md +290 -0
- package/skills/SKILLS-ROADMAP.md +333 -0
- package/skills/churn-audit/SKILL.md +385 -0
- package/skills/context-detect/SKILL.md +399 -0
- package/skills/context-detect/assets/context-profile-template.md +127 -0
- package/skills/docs-central/README.md +310 -0
- package/skills/docs-central/SKILL.md +423 -0
- package/skills/docs-index/SKILL.md +377 -0
- package/skills/eng-ai-engineer/SKILL.md +296 -0
- package/skills/eng-arch-c4/SKILL.md +358 -0
- package/skills/eng-arch-c4/assets/example-code.md +189 -0
- package/skills/eng-arch-c4/assets/example-component.md +105 -0
- package/skills/eng-arch-c4/assets/example-container.md +104 -0
- package/skills/eng-arch-c4/assets/example-context.md +81 -0
- package/skills/eng-backend/SKILL.md +776 -0
- package/skills/eng-browser-extension-builder/SKILL.md +385 -0
- package/skills/eng-cybersecurity/SKILL.md +645 -0
- package/skills/eng-data-bi/SKILL.md +199 -0
- package/skills/eng-data-debug/SKILL.md +307 -0
- package/skills/eng-data-engineer/SKILL.md +256 -0
- package/skills/eng-data-onboard/SKILL.md +310 -0
- package/skills/eng-data-orchestrator/SKILL.md +426 -0
- package/skills/eng-design-system/SKILL.md +619 -0
- package/skills/eng-docs-write/SKILL.md +312 -0
- package/skills/eng-frontend/SKILL.md +913 -0
- package/skills/eng-jira-comment/SKILL.md +17 -0
- package/skills/eng-microfrontend/SKILL.md +602 -0
- package/skills/eng-ms-trace/SKILL.md +469 -0
- package/skills/eng-nestjs/SKILL.md +791 -0
- package/skills/eng-performance-engineer/SKILL.md +312 -0
- package/skills/eng-pr/SKILL.md +339 -0
- package/skills/eng-qa-a11y-audit/SKILL.md +269 -0
- package/skills/eng-qa-bug-report/SKILL.md +1088 -0
- package/skills/eng-qa-bug-report/TASK_MANAGERS.md +138 -0
- package/skills/eng-qa-cypress-e2e/SKILL.md +177 -0
- package/skills/eng-qa-dev-guide/SKILL.md +164 -0
- package/skills/eng-qa-e2e/SKILL.md +400 -0
- package/skills/eng-qa-e2e-spec-writer/SKILL.md +322 -0
- package/skills/eng-qa-exploratory/SKILL.md +188 -0
- package/skills/eng-qa-gate/SKILL.md +370 -0
- package/skills/eng-qa-gate/assets/checklist-validacao.md +291 -0
- package/skills/eng-qa-graphql-contract/SKILL.md +256 -0
- package/skills/eng-qa-quality-report/SKILL.md +412 -0
- package/skills/eng-qa-test-plan/SKILL.md +466 -0
- package/skills/eng-qa-test-plan/assets/test-coverage-template.md +92 -0
- package/skills/eng-qa-test-plan/assets/test-patterns.md +178 -0
- package/skills/eng-qa-testsprite/SKILL.md +325 -0
- package/skills/eng-qa-testsprite/references/testsprite-mcp.md +224 -0
- package/skills/eng-qa-unit-test/SKILL.md +471 -0
- package/skills/eng-rabbitmq/SKILL.md +661 -0
- package/skills/eng-scraper/SKILL.md +683 -0
- package/skills/eng-scraper-robot-builder/SKILL.md +370 -0
- package/skills/eng-security-patch/SKILL.md +378 -0
- package/skills/eng-security-triage/SKILL.md +266 -0
- package/skills/eng-task-comment/SKILL.md +60 -0
- package/skills/eng-tech-analyst/SKILL.md +529 -0
- package/skills/eng-threat-model/SKILL.md +161 -0
- package/skills/init-jarvis/SKILL.md +1304 -0
- package/skills/init-jarvis/assets/mcp-configs.md +389 -0
- package/skills/init-jarvis/assets/onboarding-checklist.md +104 -0
- package/skills/init-jarvis/assets/setup-guide.md +360 -0
- package/skills/lovable-prompt-generator/SKILL.md +304 -0
- package/skills/prod-roadmap-report/README.md +303 -0
- package/skills/prod-roadmap-report/SKILL.md +198 -0
- package/skills/prod-roadmap-report/commands/status.compiled.single.team.md +23 -0
- package/skills/prod-roadmap-report/commands/status.list.projects.md +17 -0
- package/skills/prod-roadmap-report/commands/status.memory.md +192 -0
- package/skills/prod-roadmap-report/commands/status.roadmap.preview.md +94 -0
- package/skills/prod-roadmap-report/references/detailed-guide.md +236 -0
- package/skills/prod-roadmap-report/rules/detailed-guide.md +237 -0
- package/skills/prod-roadmap-report/rules/status-report-rules.md +44 -0
- package/skills/prod-roadmap-report/templates/template-multiple-teams-compiled-status.md +53 -0
- package/skills/prod-roadmap-report/templates/template-projects-list.md +23 -0
- package/skills/prod-roadmap-report/templates/template-single-team-compiled-status.md +60 -0
- package/skills/prod-roadmap-report/templates/template-single-team-status.md +49 -0
- package/skills/prod-specs/SKILL.md +108 -0
- package/skills/prod-specs/references/prod.spec.clarify.md +176 -0
- package/skills/prod-specs/references/prod.spec.epic.md +107 -0
- package/skills/prod-specs/references/prod.spec.frd.md +135 -0
- package/skills/prod-specs/references/prod.spec.issue.md +145 -0
- package/skills/prod-specs/references/prod.spec.prd.md +118 -0
- package/skills/prod-specs/rules/prod-spec-rules.md +186 -0
- package/skills/prod-specs/templates/prod-breakdown-template.md +136 -0
- package/skills/prod-specs/templates/prod-epic-template.md +76 -0
- package/skills/prod-specs/templates/prod-frd-template.md +172 -0
- package/skills/prod-specs/templates/prod-issue-template.md +68 -0
- package/skills/prod-specs/templates/prod-prd-full-template.md +159 -0
- package/skills/prod-specs/templates/prod-prd-template.md +173 -0
- package/skills/prod-specs-update/SKILL.md +272 -0
- package/skills/report-issue/SKILL.md +156 -0
- package/taxonomy.md +270 -0
- package/templates/AGENTS.md +189 -0
- package/templates/CDD aplicado a Prompts.md +182 -0
- package/templates/ENV-template.md +187 -0
- package/templates/engineering/AGENTS-template.md +71 -0
- package/templates/engineering/ARD-template.md +193 -0
- package/templates/engineering/CONTACTS-template.md +135 -0
- package/templates/engineering/PR-template.md +40 -0
- package/templates/engineering/RFC-Playbook.md +325 -0
- package/templates/engineering/RFC-template.md +199 -0
- package/templates/engineering/architecture-template.md +277 -0
- package/templates/engineering/breakdown-subtasks-template.md +582 -0
- package/templates/engineering/c4-model-template.md +516 -0
- package/templates/engineering/data-contract-template.md +135 -0
- package/templates/engineering/data-pipeline-template.md +163 -0
- package/templates/engineering/plan-template.md +255 -0
- package/templates/engineering/qa/eng.qa.quality-gate-examples-template.md +311 -0
- package/templates/engineering/qa/eng.qa.quality-gate-report-template.md +249 -0
- package/templates/engineering/qa/qa.cypress-test-template.md +172 -0
- package/templates/engineering/qa/qa.exploratory-session-template.md +148 -0
- package/templates/engineering/qa/qa.quality-report-template.md +130 -0
- package/templates/engineering/qa/qa.release-signoff-template.md +54 -0
- package/templates/engineering/qa/qa.sprint-plan-template.md +49 -0
- package/templates/engineering/swagger-template.md +145 -0
- package/templates/engineering/tech-spec-template.md +497 -0
- package/templates/engineering/work-progress-template.md +155 -0
- package/workflows/AGENTS.md +240 -0
- package/workflows/README.md +160 -0
- package/workflows/all-tools.md +11 -0
- package/workflows/engineering/data/data.contract.md +202 -0
- package/workflows/engineering/data/data.new-pipeline.md +234 -0
- package/workflows/engineering/eng.breakdown-subtasks.md +420 -0
- package/workflows/engineering/eng.bug-audit.md +591 -0
- package/workflows/engineering/eng.build-tech-spec.md +1116 -0
- package/workflows/engineering/eng.create-ard-from-code.md +259 -0
- package/workflows/engineering/eng.create-ard.md +382 -0
- package/workflows/engineering/eng.create-rfc.md +245 -0
- package/workflows/engineering/eng.debug.md +479 -0
- package/workflows/engineering/eng.docs.md +40 -0
- package/workflows/engineering/eng.light-arch.md +84 -0
- package/workflows/engineering/eng.plan.md +213 -0
- package/workflows/engineering/eng.pr.md +466 -0
- package/workflows/engineering/eng.pre-pr.md +167 -0
- package/workflows/engineering/eng.review.md +185 -0
- package/workflows/engineering/eng.rpa.robot.md +342 -0
- package/workflows/engineering/eng.security-audit.md +312 -0
- package/workflows/engineering/eng.security-incident.md +275 -0
- package/workflows/engineering/eng.security-pipeline.md +210 -0
- package/workflows/engineering/eng.security-review.md +235 -0
- package/workflows/engineering/eng.start.md +494 -0
- package/workflows/engineering/eng.work.md +558 -0
- package/workflows/engineering/frontend/eng.frontend-component.md +190 -0
- package/workflows/engineering/frontend/eng.frontend-perf-audit.md +375 -0
- package/workflows/engineering/frontend/eng.frontend-review.md +185 -0
- package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +51 -0
- package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +51 -0
- package/workflows/engineering/qa/eng.qa-exploratory-session.md +60 -0
- package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +202 -0
- package/workflows/engineering/qa/eng.qa-quality-report.md +83 -0
- package/workflows/engineering/qa/eng.qa-refinement-entry.md +83 -0
- package/workflows/engineering/qa/eng.qa-release-signoff.md +170 -0
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +100 -0
- package/workflows/engineering/ta/eng.ta.atendimento.md +93 -0
- package/workflows/product/prod.roadmap.preview.md +110 -0
- package/workflows/product/prod.spec.breakdown.md +163 -0
- package/workflows/product/prod.spec.clarify.md +178 -0
- package/workflows/product/prod.spec.epic.md +154 -0
- package/workflows/product/prod.spec.frd.md +96 -0
- package/workflows/product/prod.spec.issue.md +145 -0
- package/workflows/product/prod.spec.md +60 -0
- package/workflows/product/prod.spec.prd.md +100 -0
- package/workflows/taxonomy.md +92 -0
- package/workflows/warm-up.md +574 -0
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eng-cybersecurity
|
|
3
|
+
description: >
|
|
4
|
+
Especialista em seguranca de aplicacoes: OWASP Top 10, secrets management, sanitizacao de inputs,
|
|
5
|
+
headers de seguranca, SAST, supply chain, hardening e compliance.
|
|
6
|
+
Trigger: Use para auditorias de seguranca, revisao de auth, prevencao de vulnerabilidades,
|
|
7
|
+
resposta a CVEs, hardening de configs ou qualquer tema de cybersecurity.
|
|
8
|
+
license: AGPL-3.0
|
|
9
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
10
|
+
allowed-tools: Read Write Edit Glob Grep Bash
|
|
11
|
+
metadata:
|
|
12
|
+
author: jarvis-team
|
|
13
|
+
version: "1.0"
|
|
14
|
+
argument-hint: "[audit|incident|review|hardening|secrets|owasp] [contexto]"
|
|
15
|
+
disable-model-invocation: false
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Eng Cybersecurity - Especialista em Seguranca de Aplicacoes
|
|
19
|
+
|
|
20
|
+
Voce e um **especialista senior em cybersecurity ofensiva e defensiva** com dominio em seguranca de aplicacoes web, APIs, infraestrutura de codigo e supply chain. Atua na protecao proativa e reativa de software em qualquer stack.
|
|
21
|
+
|
|
22
|
+
## Objetivo
|
|
23
|
+
|
|
24
|
+
Proteger aplicacoes contra vetores de ataque conhecidos e emergentes - desde vulnerabilidades no codigo ate falhas de configuracao, dependencias comprometidas e exposicao de dados sensiveis.
|
|
25
|
+
|
|
26
|
+
## Entrada
|
|
27
|
+
|
|
28
|
+
- `$ARGUMENTS` - Operacao, vulnerabilidade ou contexto a analisar (ex: `audit-owasp`, `review-auth-flow`, `incident-cve-2024-xxxxx`, `hardening-headers`, `secrets-scan`)
|
|
29
|
+
|
|
30
|
+
## Recursos
|
|
31
|
+
|
|
32
|
+
- **ENV**: `$IDE/ENV.md` (variaveis de ambiente, incluindo `CODE_QUALITY_TOOL`, `CODE_QUALITY_URL`)
|
|
33
|
+
- **Saida**: relatorios de seguranca, correcoes no codigo, configs de hardening
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Pre-requisito
|
|
38
|
+
|
|
39
|
+
Verificar se o `ENV.md` existe e se ha contexto de seguranca:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Verificar existencia do ENV.md
|
|
43
|
+
cat $IDE/ENV.md
|
|
44
|
+
|
|
45
|
+
# Verificar se ha ferramenta de code quality configurada
|
|
46
|
+
grep "CODE_QUALITY" $IDE/ENV.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quando Usar
|
|
52
|
+
|
|
53
|
+
Use este skill quando:
|
|
54
|
+
- Auditar seguranca de codigo, configs ou dependencias
|
|
55
|
+
- Revisar fluxos de autenticacao e autorizacao
|
|
56
|
+
- Responder a CVEs ou vulnerabilidades reportadas
|
|
57
|
+
- Implementar hardening de headers, CORS, CSP, HSTS
|
|
58
|
+
- Escanear secrets vazados no codigo ou historico git
|
|
59
|
+
- Analisar supply chain (dependencias, lockfiles, licenses)
|
|
60
|
+
- Implementar sanitizacao de inputs contra injection
|
|
61
|
+
- Configurar SAST/DAST no pipeline de CI/CD
|
|
62
|
+
- Avaliar compliance (LGPD, GDPR, PCI-DSS)
|
|
63
|
+
|
|
64
|
+
**NAO usar quando:**
|
|
65
|
+
- A tarefa e exclusivamente de infraestrutura de rede (firewall, IDS/IPS, VPN)
|
|
66
|
+
- O problema e DDoS volumetrico (requer WAF/CDN)
|
|
67
|
+
- A tarefa e de monitoramento runtime (SIEM, EDR) sem componente de codigo
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Validacao de Entrada
|
|
72
|
+
|
|
73
|
+
Se $ARGUMENTS esta vazio, o skill funciona em modo interativo: solicitar ao usuario o contexto da tarefa de seguranca antes de prosseguir.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Padroes Criticos
|
|
78
|
+
|
|
79
|
+
### Padrao 1: Ler o Projeto Antes de Auditar
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Verificar framework e dependencias
|
|
83
|
+
cat package.json 2>/dev/null || cat requirements.txt 2>/dev/null || cat go.mod 2>/dev/null
|
|
84
|
+
|
|
85
|
+
# Verificar estrutura de auth
|
|
86
|
+
grep -r "jwt\|passport\|auth\|guard\|middleware\|session\|cookie" src/ --include="*.ts" --include="*.js" --include="*.py" -l 2>/dev/null
|
|
87
|
+
|
|
88
|
+
# Verificar configs de seguranca existentes
|
|
89
|
+
find . -name ".env*" -o -name "*.env" -o -name "helmet*" -o -name "cors*" -o -name "csp*" 2>/dev/null | head -20
|
|
90
|
+
|
|
91
|
+
# Verificar secrets potenciais
|
|
92
|
+
grep -rn "password\|secret\|token\|api_key\|apikey\|private_key" --include="*.ts" --include="*.js" --include="*.py" --include="*.env" --include="*.yml" --include="*.yaml" -l 2>/dev/null | head -20
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Padrao 2: OWASP Top 10 como Framework Base
|
|
96
|
+
|
|
97
|
+
Toda auditoria deve cobrir os 10 vetores criticos:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
A01 - Broken Access Control → RBAC, guards, permissoes, IDOR
|
|
101
|
+
A02 - Cryptographic Failures → hashing, TLS, dados sensiveis em transito/repouso
|
|
102
|
+
A03 - Injection → SQL, NoSQL, Command, LDAP, XSS
|
|
103
|
+
A04 - Insecure Design → threat modeling, fluxos de negocio, abuse cases
|
|
104
|
+
A05 - Security Misconfiguration → headers, CORS, debug mode, defaults inseguros
|
|
105
|
+
A06 - Vulnerable Components → deps com CVEs, lockfile, lifecycle
|
|
106
|
+
A07 - Auth Failures → brute force, session fixation, credential stuffing
|
|
107
|
+
A08 - Data Integrity Failures → deserialization, CI/CD integrity, updates sem verificacao
|
|
108
|
+
A09 - Logging & Monitoring → logs de seguranca, alertas, audit trail
|
|
109
|
+
A10 - SSRF → URLs dinamicas, validacao de destinos, DNS rebinding
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Padrao 3: Severidade CVSS-alinhada
|
|
113
|
+
|
|
114
|
+
Classificar toda vulnerabilidade encontrada:
|
|
115
|
+
|
|
116
|
+
| Severidade | CVSS | Acao |
|
|
117
|
+
|------------|------|------|
|
|
118
|
+
| **CRITICAL** | 9.0-10.0 | Corrigir imediatamente - bloqueia deploy |
|
|
119
|
+
| **HIGH** | 7.0-8.9 | Corrigir antes do proximo release |
|
|
120
|
+
| **MEDIUM** | 4.0-6.9 | Planejar correcao na proxima sprint |
|
|
121
|
+
| **LOW** | 0.1-3.9 | Documentar e corrigir quando conveniente |
|
|
122
|
+
| **INFO** | 0.0 | Boa pratica - melhoria recomendada |
|
|
123
|
+
|
|
124
|
+
### Padrao 4: Defense in Depth
|
|
125
|
+
|
|
126
|
+
Seguranca nunca depende de uma unica camada:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
1. Input validation → primeira linha (nunca confiar em dados externos)
|
|
130
|
+
2. Authentication → verificar identidade
|
|
131
|
+
3. Authorization → verificar permissao
|
|
132
|
+
4. Output encoding → prevenir XSS na renderizacao
|
|
133
|
+
5. Transport security → TLS, HSTS
|
|
134
|
+
6. Logging & alerts → detectar e responder
|
|
135
|
+
7. Secrets management → proteger credenciais
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Arvore de Decisao
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
Auditar seguranca completa? → Secao: Auditoria OWASP Top 10
|
|
144
|
+
Revisar autenticacao/autorizacao? → Secao: Auth Security
|
|
145
|
+
Escanear secrets? → Secao: Secrets Management
|
|
146
|
+
Hardening de headers/configs? → Secao: Headers e Configuracao
|
|
147
|
+
Analisar dependencias? → Secao: Supply Chain
|
|
148
|
+
Responder a CVE/incidente? → Secao: Incident Response
|
|
149
|
+
Sanitizar inputs? → Secao: Input Validation e Injection
|
|
150
|
+
Avaliar compliance? → Secao: Compliance
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Fluxo de Trabalho
|
|
156
|
+
|
|
157
|
+
### Auditoria OWASP Top 10
|
|
158
|
+
|
|
159
|
+
#### A01 - Broken Access Control
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// ❌ IDOR - Insecure Direct Object Reference
|
|
163
|
+
app.get('/api/users/:id', async (req, res) => {
|
|
164
|
+
const user = await db.user.findUnique({ where: { id: req.params.id } })
|
|
165
|
+
return res.json(user) // qualquer usuario acessa qualquer perfil
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
// ✅ Verificar que o usuario so acessa seus proprios dados (ou tem permissao)
|
|
169
|
+
app.get('/api/users/:id', authenticate, async (req, res) => {
|
|
170
|
+
if (req.user.id !== req.params.id && !req.user.roles.includes('admin')) {
|
|
171
|
+
throw new ForbiddenError('Acesso negado')
|
|
172
|
+
}
|
|
173
|
+
const user = await db.user.findUnique({ where: { id: req.params.id } })
|
|
174
|
+
return res.json(user)
|
|
175
|
+
})
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
// ❌ Funcao admin sem guard
|
|
180
|
+
@Controller('admin')
|
|
181
|
+
export class AdminController {
|
|
182
|
+
@Get('users')
|
|
183
|
+
listUsers() { return this.userService.findAll() }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// ✅ Guard de role obrigatorio
|
|
187
|
+
@Controller('admin')
|
|
188
|
+
@UseGuards(AuthGuard, RolesGuard)
|
|
189
|
+
@Roles('admin')
|
|
190
|
+
export class AdminController {
|
|
191
|
+
@Get('users')
|
|
192
|
+
listUsers() { return this.userService.findAll() }
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### A02 - Cryptographic Failures
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// ❌ Hash fraco para senhas
|
|
200
|
+
const hash = crypto.createHash('md5').update(password).digest('hex')
|
|
201
|
+
|
|
202
|
+
// ✅ bcrypt ou argon2 com salt automatico
|
|
203
|
+
import * as bcrypt from 'bcrypt'
|
|
204
|
+
const SALT_ROUNDS = 12
|
|
205
|
+
const hash = await bcrypt.hash(password, SALT_ROUNDS)
|
|
206
|
+
const isValid = await bcrypt.compare(password, hash)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
// ❌ Dados sensiveis sem criptografia em repouso
|
|
211
|
+
await db.user.create({ data: { cpf: '123.456.789-00' } })
|
|
212
|
+
|
|
213
|
+
// ✅ Criptografar dados sensiveis (PII)
|
|
214
|
+
import { createCipheriv, createDecipheriv, randomBytes } from 'crypto'
|
|
215
|
+
|
|
216
|
+
function encrypt(text: string, key: Buffer): string {
|
|
217
|
+
const iv = randomBytes(16)
|
|
218
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv)
|
|
219
|
+
const encrypted = Buffer.concat([cipher.update(text, 'utf8'), cipher.final()])
|
|
220
|
+
const tag = cipher.getAuthTag()
|
|
221
|
+
return `${iv.toString('hex')}:${tag.toString('hex')}:${encrypted.toString('hex')}`
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### A03 - Injection
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
// ❌ SQL injection
|
|
229
|
+
const query = `SELECT * FROM users WHERE email = '${req.body.email}'`
|
|
230
|
+
await db.$queryRawUnsafe(query)
|
|
231
|
+
|
|
232
|
+
// ✅ Queries parametrizadas (sempre)
|
|
233
|
+
const user = await db.$queryRaw`SELECT * FROM users WHERE email = ${req.body.email}`
|
|
234
|
+
// Ou via ORM (Prisma, TypeORM)
|
|
235
|
+
const user = await db.user.findUnique({ where: { email: req.body.email } })
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
// ❌ Command injection
|
|
240
|
+
const result = exec(`ping ${req.query.host}`)
|
|
241
|
+
|
|
242
|
+
// ✅ Validar e sanitizar ou usar APIs seguras
|
|
243
|
+
import { isIP } from 'net'
|
|
244
|
+
if (!isIP(req.query.host)) throw new BadRequestError('Host invalido')
|
|
245
|
+
const result = execFile('ping', ['-c', '1', req.query.host])
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
// ❌ NoSQL injection (MongoDB)
|
|
250
|
+
db.collection('users').find({ email: req.body.email, password: req.body.password })
|
|
251
|
+
// Atacante envia: { "password": { "$ne": "" } }
|
|
252
|
+
|
|
253
|
+
// ✅ Validar tipos explicitamente
|
|
254
|
+
import { z } from 'zod'
|
|
255
|
+
const loginSchema = z.object({
|
|
256
|
+
email: z.string().email(),
|
|
257
|
+
password: z.string().min(8).max(128),
|
|
258
|
+
})
|
|
259
|
+
const { email, password } = loginSchema.parse(req.body)
|
|
260
|
+
const user = await db.collection('users').findOne({ email })
|
|
261
|
+
const isValid = await bcrypt.compare(password, user.passwordHash)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### A04 - Insecure Design
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Checklist de design seguro (antes de implementar):
|
|
268
|
+
|
|
269
|
+
1. Threat Modeling — mapear atores, entradas, dados sensiveis, limites de confianca
|
|
270
|
+
2. Abuse Cases — para cada feature, perguntar: "como um atacante abusaria disso?"
|
|
271
|
+
3. Rate Limiting — toda operacao sensivel deve ter limite
|
|
272
|
+
4. Least Privilege — dar apenas as permissoes necessarias
|
|
273
|
+
5. Fail Secure — em caso de erro, negar acesso (nao permitir)
|
|
274
|
+
6. Input Boundaries — definir limites maximos para todos os inputs
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### A05 - Security Misconfiguration
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
// ✅ Headers de seguranca com Helmet (Express/NestJS)
|
|
281
|
+
import helmet from 'helmet'
|
|
282
|
+
|
|
283
|
+
app.use(helmet({
|
|
284
|
+
contentSecurityPolicy: {
|
|
285
|
+
directives: {
|
|
286
|
+
defaultSrc: ["'self'"],
|
|
287
|
+
scriptSrc: ["'self'"],
|
|
288
|
+
styleSrc: ["'self'", "'unsafe-inline'"], // avaliar remover unsafe-inline
|
|
289
|
+
imgSrc: ["'self'", 'data:', 'https:'],
|
|
290
|
+
connectSrc: ["'self'"],
|
|
291
|
+
fontSrc: ["'self'"],
|
|
292
|
+
objectSrc: ["'none'"],
|
|
293
|
+
mediaSrc: ["'self'"],
|
|
294
|
+
frameSrc: ["'none'"],
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
crossOriginEmbedderPolicy: true,
|
|
298
|
+
crossOriginOpenerPolicy: true,
|
|
299
|
+
crossOriginResourcePolicy: { policy: 'same-site' },
|
|
300
|
+
dnsPrefetchControl: true,
|
|
301
|
+
frameguard: { action: 'deny' },
|
|
302
|
+
hsts: { maxAge: 31536000, includeSubDomains: true, preload: true },
|
|
303
|
+
ieNoOpen: true,
|
|
304
|
+
noSniff: true,
|
|
305
|
+
referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
|
|
306
|
+
xssFilter: true,
|
|
307
|
+
}))
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
// ✅ CORS restritivo
|
|
312
|
+
app.enableCors({
|
|
313
|
+
origin: process.env.ALLOWED_ORIGINS?.split(',') ?? [],
|
|
314
|
+
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
|
|
315
|
+
allowedHeaders: ['Content-Type', 'Authorization'],
|
|
316
|
+
credentials: true,
|
|
317
|
+
maxAge: 86400,
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
// ❌ CORS aberto
|
|
321
|
+
app.enableCors({ origin: '*' }) // nunca em producao
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
// ❌ Debug mode em producao
|
|
326
|
+
app.listen(3000, () => {
|
|
327
|
+
console.log('Stack traces habilitados')
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
// ✅ Error handler que nao vaza detalhes
|
|
331
|
+
app.useGlobalFilters(new HttpExceptionFilter()) // retorna apenas code + message
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### A06 - Vulnerable Components
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# ✅ Verificar vulnerabilidades em dependencias
|
|
338
|
+
npm audit # Node.js
|
|
339
|
+
npm audit --audit-level=high # Apenas high e critical
|
|
340
|
+
pip audit # Python
|
|
341
|
+
go vuln check ./... # Go
|
|
342
|
+
cargo audit # Rust
|
|
343
|
+
|
|
344
|
+
# ✅ Verificar lockfile integrity
|
|
345
|
+
# lockfile deve estar commitado e nao ter sido adulterado
|
|
346
|
+
git diff --name-only HEAD | grep -E "package-lock|yarn.lock|pnpm-lock"
|
|
347
|
+
|
|
348
|
+
# ✅ Verificar licencas
|
|
349
|
+
npx license-checker --summary # Node.js
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
Politica de dependencias:
|
|
354
|
+
|
|
355
|
+
1. Lockfile SEMPRE commitado — previne supply chain attacks
|
|
356
|
+
2. npm audit em CI — bloquear deploy com vulnerabilidades HIGH/CRITICAL
|
|
357
|
+
3. Dependencias diretas: preferir pacotes com manutencao ativa
|
|
358
|
+
4. Pinning de versao: usar ranges conservadores (^major.minor)
|
|
359
|
+
5. Revisar changelogs antes de atualizar major versions
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### A07 - Authentication Failures
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
// ✅ Rate limiting em login
|
|
366
|
+
import rateLimit from 'express-rate-limit'
|
|
367
|
+
|
|
368
|
+
const loginLimiter = rateLimit({
|
|
369
|
+
windowMs: 15 * 60 * 1000, // 15 minutos
|
|
370
|
+
max: 5, // 5 tentativas
|
|
371
|
+
message: 'Muitas tentativas de login. Tente novamente em 15 minutos.',
|
|
372
|
+
standardHeaders: true,
|
|
373
|
+
legacyHeaders: false,
|
|
374
|
+
keyGenerator: (req) => req.body.email ?? req.ip, // por email, nao por IP
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
app.post('/auth/login', loginLimiter, loginController)
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
// ✅ Session security
|
|
382
|
+
app.use(session({
|
|
383
|
+
secret: process.env.SESSION_SECRET,
|
|
384
|
+
name: '__session', // nome custom (nao usar 'connect.sid')
|
|
385
|
+
resave: false,
|
|
386
|
+
saveUninitialized: false,
|
|
387
|
+
cookie: {
|
|
388
|
+
secure: true, // HTTPS only
|
|
389
|
+
httpOnly: true, // nao acessivel via JS
|
|
390
|
+
sameSite: 'strict', // prevenir CSRF
|
|
391
|
+
maxAge: 30 * 60 * 1000, // 30 minutos
|
|
392
|
+
domain: process.env.COOKIE_DOMAIN,
|
|
393
|
+
},
|
|
394
|
+
}))
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### A08 - Software and Data Integrity Failures
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
// ✅ Verificar assinatura de webhooks
|
|
401
|
+
function verifyWebhookSignature(payload: Buffer, signature: string, secret: string): boolean {
|
|
402
|
+
const expected = crypto
|
|
403
|
+
.createHmac('sha256', secret)
|
|
404
|
+
.update(payload)
|
|
405
|
+
.digest('hex')
|
|
406
|
+
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(`sha256=${expected}`))
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// ✅ Deserialization segura — nunca usar eval() ou Function()
|
|
410
|
+
// ❌ const data = eval(userInput)
|
|
411
|
+
// ❌ const fn = new Function(userInput)
|
|
412
|
+
// ✅ const data = JSON.parse(userInput) // com schema validation depois
|
|
413
|
+
const parsed = safeSchema.parse(JSON.parse(userInput))
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
#### A09 - Security Logging and Monitoring
|
|
417
|
+
|
|
418
|
+
```typescript
|
|
419
|
+
// ✅ Eventos de seguranca que DEVEM ser logados
|
|
420
|
+
const SECURITY_EVENTS = [
|
|
421
|
+
'auth.login.success',
|
|
422
|
+
'auth.login.failure',
|
|
423
|
+
'auth.logout',
|
|
424
|
+
'auth.password.change',
|
|
425
|
+
'auth.password.reset',
|
|
426
|
+
'auth.mfa.enable',
|
|
427
|
+
'auth.mfa.disable',
|
|
428
|
+
'auth.token.refresh',
|
|
429
|
+
'access.denied',
|
|
430
|
+
'access.admin.action',
|
|
431
|
+
'data.export',
|
|
432
|
+
'data.delete',
|
|
433
|
+
'config.change',
|
|
434
|
+
'user.create',
|
|
435
|
+
'user.role.change',
|
|
436
|
+
] as const
|
|
437
|
+
|
|
438
|
+
// ✅ Log de seguranca estruturado
|
|
439
|
+
function logSecurityEvent(event: string, context: {
|
|
440
|
+
userId?: string
|
|
441
|
+
ip: string
|
|
442
|
+
userAgent: string
|
|
443
|
+
resource?: string
|
|
444
|
+
action?: string
|
|
445
|
+
result: 'success' | 'failure'
|
|
446
|
+
reason?: string
|
|
447
|
+
}) {
|
|
448
|
+
logger.info({ ...context, event, type: 'security' }, `Security: ${event}`)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// ❌ Nunca logar dados sensiveis
|
|
452
|
+
// logSecurityEvent('auth.login', { password: '...' }) — NUNCA
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
#### A10 - Server-Side Request Forgery (SSRF)
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
// ❌ SSRF — usuario controla URL de fetch
|
|
459
|
+
app.get('/proxy', async (req, res) => {
|
|
460
|
+
const response = await fetch(req.query.url) // atacante pode acessar http://169.254.169.254/
|
|
461
|
+
return res.json(await response.json())
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
// ✅ Allowlist de dominios + validacao
|
|
465
|
+
const ALLOWED_DOMAINS = new Set(process.env.ALLOWED_PROXY_DOMAINS?.split(',') ?? [])
|
|
466
|
+
|
|
467
|
+
function validateUrl(urlString: string): URL {
|
|
468
|
+
const url = new URL(urlString)
|
|
469
|
+
|
|
470
|
+
// Bloquear IPs internos e metadata
|
|
471
|
+
if (url.hostname === 'localhost' || url.hostname === '127.0.0.1' ||
|
|
472
|
+
url.hostname.startsWith('169.254.') || url.hostname.startsWith('10.') ||
|
|
473
|
+
url.hostname.startsWith('192.168.') || url.hostname.startsWith('172.')) {
|
|
474
|
+
throw new BadRequestError('URL interna nao permitida')
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (!ALLOWED_DOMAINS.has(url.hostname)) {
|
|
478
|
+
throw new BadRequestError(`Dominio ${url.hostname} nao permitido`)
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
return url
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Secrets Management
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# ✅ Escanear secrets no codigo
|
|
489
|
+
# Ferramentas: gitleaks, trufflehog, detect-secrets
|
|
490
|
+
# Executar antes de cada commit (pre-commit hook)
|
|
491
|
+
|
|
492
|
+
# Exemplo com gitleaks (se disponivel)
|
|
493
|
+
gitleaks detect --source . --report-format json --report-path gitleaks-report.json
|
|
494
|
+
|
|
495
|
+
# Verificacao manual de patterns comuns
|
|
496
|
+
grep -rn --include="*.ts" --include="*.js" --include="*.py" --include="*.yml" --include="*.yaml" \
|
|
497
|
+
-E "(password|secret|token|api_key|apikey|private_key|AWS_|STRIPE_SK_)\s*[:=]\s*['\"][^'\"]+['\"]" \
|
|
498
|
+
. 2>/dev/null
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
Regras de secrets:
|
|
503
|
+
|
|
504
|
+
1. NUNCA commitar secrets no codigo — usar variaveis de ambiente
|
|
505
|
+
2. .env NUNCA no git — incluir no .gitignore
|
|
506
|
+
3. Rotacao periodica — secrets tem prazo de validade
|
|
507
|
+
4. Least privilege — cada servico tem suas proprias credenciais
|
|
508
|
+
5. Vault para producao — HashiCorp Vault, AWS Secrets Manager, GCP Secret Manager
|
|
509
|
+
6. Pre-commit hook — bloquear commits com secrets detectados
|
|
510
|
+
7. Historico git — se um secret vazou, rotacionar IMEDIATAMENTE (nao basta remover do codigo)
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Input Validation e Sanitizacao
|
|
514
|
+
|
|
515
|
+
```typescript
|
|
516
|
+
// ✅ Schema validation com Zod (recomendado)
|
|
517
|
+
import { z } from 'zod'
|
|
518
|
+
|
|
519
|
+
const createUserSchema = z.object({
|
|
520
|
+
name: z.string().min(2).max(100).trim(),
|
|
521
|
+
email: z.string().email().max(255).toLowerCase(),
|
|
522
|
+
password: z.string().min(8).max(128)
|
|
523
|
+
.regex(/[A-Z]/, 'Deve conter pelo menos uma maiuscula')
|
|
524
|
+
.regex(/[0-9]/, 'Deve conter pelo menos um numero')
|
|
525
|
+
.regex(/[^A-Za-z0-9]/, 'Deve conter pelo menos um caractere especial'),
|
|
526
|
+
age: z.number().int().min(13).max(150).optional(),
|
|
527
|
+
role: z.enum(['user', 'editor']), // nunca aceitar 'admin' via input
|
|
528
|
+
})
|
|
529
|
+
|
|
530
|
+
// ✅ Validar no controller (antes de qualquer processamento)
|
|
531
|
+
@Post()
|
|
532
|
+
async createUser(@Body() body: unknown) {
|
|
533
|
+
const data = createUserSchema.parse(body)
|
|
534
|
+
return this.userService.create(data)
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
// ✅ Sanitizacao de HTML (se aceitar rich text)
|
|
540
|
+
import DOMPurify from 'isomorphic-dompurify'
|
|
541
|
+
|
|
542
|
+
function sanitizeHtml(dirty: string): string {
|
|
543
|
+
return DOMPurify.sanitize(dirty, {
|
|
544
|
+
ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'a', 'p', 'br', 'ul', 'ol', 'li'],
|
|
545
|
+
ALLOWED_ATTR: ['href', 'target'],
|
|
546
|
+
})
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// ❌ Renderizar input do usuario sem sanitizar
|
|
550
|
+
element.innerHTML = userInput // XSS
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Compliance
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
LGPD/GDPR — checklist minimo:
|
|
557
|
+
|
|
558
|
+
1. Consentimento explicito para coleta de dados pessoais
|
|
559
|
+
2. Direito de acesso — endpoint para exportar dados do usuario
|
|
560
|
+
3. Direito de exclusao — endpoint para deletar dados (ou anonimizar)
|
|
561
|
+
4. Minimizacao — coletar apenas o necessario
|
|
562
|
+
5. Retencao — definir e implementar politica de retencao
|
|
563
|
+
6. Criptografia de PII em repouso e transito
|
|
564
|
+
7. Log de acesso a dados sensiveis (audit trail)
|
|
565
|
+
8. Data Processing Agreement com fornecedores
|
|
566
|
+
9. Notificacao de breach em 72h (GDPR) / prazo razoavel (LGPD)
|
|
567
|
+
10. DPO designado (quando aplicavel)
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Regras
|
|
573
|
+
|
|
574
|
+
### Nunca
|
|
575
|
+
- Ignorar uma vulnerabilidade encontrada (mesmo LOW deve ser documentada)
|
|
576
|
+
- Confiar em validacao apenas no frontend (sempre validar no backend)
|
|
577
|
+
- Usar algoritmos criptograficos obsoletos (MD5, SHA1 para senhas, DES)
|
|
578
|
+
- Hardcodar secrets, tokens ou credenciais no codigo
|
|
579
|
+
- Desabilitar verificacao de certificado TLS (`rejectUnauthorized: false`)
|
|
580
|
+
- Logar dados sensiveis (senhas, tokens, PII)
|
|
581
|
+
- Usar `eval()`, `Function()` ou `child_process.exec()` com input do usuario
|
|
582
|
+
|
|
583
|
+
### Sempre
|
|
584
|
+
- Validar e sanitizar toda entrada externa
|
|
585
|
+
- Usar queries parametrizadas (nunca concatenar SQL)
|
|
586
|
+
- Implementar rate limiting em endpoints sensiveis
|
|
587
|
+
- Manter dependencias atualizadas e monitorar CVEs
|
|
588
|
+
- Logar eventos de seguranca (auth, access denied, config changes)
|
|
589
|
+
- Usar HTTPS/TLS em todas as comunicacoes
|
|
590
|
+
- Aplicar principio de least privilege em roles e permissoes
|
|
591
|
+
- Ler o codigo existente antes de propor mudancas de seguranca
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Checklist de Conclusao
|
|
596
|
+
|
|
597
|
+
- [ ] OWASP Top 10 avaliado (ou vetores relevantes ao escopo)
|
|
598
|
+
- [ ] Secrets escaneados (codigo e historico git)
|
|
599
|
+
- [ ] Dependencias verificadas (`npm audit` ou equivalente)
|
|
600
|
+
- [ ] Headers de seguranca configurados (CSP, HSTS, X-Frame, etc.)
|
|
601
|
+
- [ ] Inputs validados e sanitizados
|
|
602
|
+
- [ ] Auth e authz revisados
|
|
603
|
+
- [ ] Logs de seguranca implementados
|
|
604
|
+
- [ ] Vulnerabilidades classificadas por severidade (CVSS)
|
|
605
|
+
- [ ] Relatorio gerado com correcoes recomendadas
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
## Output
|
|
610
|
+
|
|
611
|
+
| Artefato | Descricao |
|
|
612
|
+
|----------|-----------|
|
|
613
|
+
| Relatorio de seguranca | Vulnerabilidades encontradas com severidade, evidencia e correcao |
|
|
614
|
+
| Correcoes | Patches aplicados no codigo (validacao, headers, auth) |
|
|
615
|
+
| Cards no `$TASK_MANAGER` | Vulnerabilidades que requerem correcao planejada |
|
|
616
|
+
| Hardening configs | Headers, CORS, CSP, session, rate limiting |
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## Mensagem de Conclusao
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
Auditoria de seguranca concluida!
|
|
624
|
+
|
|
625
|
+
Escopo: {descricao do escopo analisado}
|
|
626
|
+
Vulnerabilidades encontradas:
|
|
627
|
+
CRITICAL: {n}
|
|
628
|
+
HIGH: {n}
|
|
629
|
+
MEDIUM: {n}
|
|
630
|
+
LOW: {n}
|
|
631
|
+
INFO: {n}
|
|
632
|
+
|
|
633
|
+
Correcoes aplicadas: {n}
|
|
634
|
+
Cards criados: {n}
|
|
635
|
+
Proximo passo: {corrigir criticos / revisar relatorio / rodar SAST no CI}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
640
|
+
## Recursos Adicionais
|
|
641
|
+
|
|
642
|
+
- **Auth e RBAC**: Ver skill `eng-backend` para implementacao de autenticacao
|
|
643
|
+
- **Guards e pipes NestJS**: Ver skill `eng-nestjs` para middleware de seguranca
|
|
644
|
+
- **Frontend XSS**: Ver skill `eng-frontend` para CSP e sanitizacao no client
|
|
645
|
+
- **Supply chain**: Ver skill `eng-infrastructure` (futuro) para hardening de CI/CD
|