sinapse-ai 9.3.0 → 9.4.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.
Files changed (192) hide show
  1. package/.claude/CLAUDE.md +56 -343
  2. package/.claude/rules/agent-authority.md +6 -0
  3. package/.claude/rules/agent-handoff.md +5 -0
  4. package/.claude/rules/cross-squad-routing.md +5 -0
  5. package/.claude/rules/hook-governance.md +6 -0
  6. package/.claude/rules/mcp-usage.md +3 -1
  7. package/.claude/rules/safe-collaboration.md +10 -0
  8. package/.claude/rules/security-data-protection.md +9 -0
  9. package/.claude/rules/squad-awareness.md +3 -1
  10. package/.claude/rules/tool-examples.md +6 -0
  11. package/.claude/rules/workflow-execution.md +7 -0
  12. package/.codex/agents/analyst.md +253 -72
  13. package/.codex/agents/architect.md +455 -68
  14. package/.codex/agents/data-engineer.md +492 -106
  15. package/.codex/agents/developer.md +560 -0
  16. package/.codex/agents/devops.md +518 -69
  17. package/.codex/agents/product-lead.md +335 -0
  18. package/.codex/agents/project-lead.md +377 -0
  19. package/.codex/agents/quality-gate.md +449 -0
  20. package/.codex/agents/sinapse-orqx.md +9 -7
  21. package/.codex/agents/sprint-lead.md +287 -0
  22. package/.codex/agents/squad-creator.md +344 -0
  23. package/.codex/agents/ux-design-expert.md +495 -0
  24. package/.codex/delegation-matrix.json +756 -44
  25. package/.codex/handoff-packet.schema.json +30 -6
  26. package/.sinapse-ai/data/entity-registry.yaml +175 -363
  27. package/.sinapse-ai/data/registry-update-log.jsonl +16 -0
  28. package/.sinapse-ai/development/agents/analyst.md +90 -0
  29. package/.sinapse-ai/development/agents/architect.md +73 -0
  30. package/.sinapse-ai/development/agents/developer.md +69 -0
  31. package/.sinapse-ai/development/agents/devops.md +117 -0
  32. package/.sinapse-ai/development/agents/quality-gate.md +85 -0
  33. package/.sinapse-ai/development/checklists/agent-quality-gate.md +27 -0
  34. package/.sinapse-ai/development/checklists/brownfield-compatibility-checklist.md +20 -0
  35. package/.sinapse-ai/development/checklists/code-review-checklist.md +106 -0
  36. package/.sinapse-ai/development/checklists/issue-triage-checklist.md +9 -0
  37. package/.sinapse-ai/development/checklists/memory-audit-checklist.md +16 -0
  38. package/.sinapse-ai/development/checklists/pr-quality-checklist.md +72 -0
  39. package/.sinapse-ai/development/checklists/security-deployment-checklist.md +54 -0
  40. package/.sinapse-ai/development/checklists/self-critique-checklist.md +19 -1
  41. package/.sinapse-ai/development/skills/debug.md +57 -0
  42. package/.sinapse-ai/development/skills/fast-review.md +69 -0
  43. package/.sinapse-ai/development/skills/research-synthesis.md +77 -0
  44. package/.sinapse-ai/development/skills/security-scan.md +73 -0
  45. package/.sinapse-ai/development/skills/verify.md +53 -0
  46. package/.sinapse-ai/development/templates/squad/agent-template.md +17 -4
  47. package/.sinapse-ai/development/templates/squad/checklist-template.md +13 -5
  48. package/.sinapse-ai/development/templates/squad/task-template.md +7 -0
  49. package/.sinapse-ai/development/templates/squad/workflow-template.yaml +7 -0
  50. package/.sinapse-ai/development/workflows/fast-track.yaml +87 -0
  51. package/.sinapse-ai/infrastructure/scripts/validate-codex-delegation.js +3 -1
  52. package/.sinapse-ai/install-manifest.yaml +71 -35
  53. package/docs/codex-integration-process.md +22 -0
  54. package/docs/codex-parity-program.md +27 -0
  55. package/docs/ide-integration.md +36 -0
  56. package/package.json +1 -1
  57. package/squads/claude-code-mastery/knowledge-base/claude-code-internals-reference.md +927 -0
  58. package/squads/squad-brand/knowledge-base/archetype-brand-mapping.md +12 -1
  59. package/squads/squad-brand/knowledge-base/brand-activism-cultural-branding.md +216 -0
  60. package/squads/squad-brand/knowledge-base/brand-audit-criteria.md +58 -0
  61. package/squads/squad-brand/knowledge-base/brand-digital-strategy.md +188 -0
  62. package/squads/squad-brand/knowledge-base/brand-legal-ip.md +222 -0
  63. package/squads/squad-brand/knowledge-base/brand-naming-framework.md +163 -0
  64. package/squads/squad-brand/knowledge-base/branding-master-reference.md +1001 -0
  65. package/squads/squad-brand/knowledge-base/color-psychology.md +25 -12
  66. package/squads/squad-brand/knowledge-base/employer-personal-branding.md +206 -0
  67. package/squads/squad-brand/knowledge-base/routing-catalog.md +34 -0
  68. package/squads/squad-brand/knowledge-base/sonic-branding-principles.md +6 -1
  69. package/squads/squad-brand/knowledge-base/typography-personality.md +34 -0
  70. package/squads/squad-claude/knowledge-base/context-window-optimization.md +334 -0
  71. package/squads/squad-claude/knowledge-base/knowledge-architecture-reference.md +403 -0
  72. package/squads/squad-claude/knowledge-base/memory-systems-reference.md +412 -0
  73. package/squads/squad-claude/knowledge-base/obsidian-claude-integration.md +423 -0
  74. package/squads/squad-claude/knowledge-base/retrieval-augmented-generation.md +320 -0
  75. package/squads/squad-claude/knowledge-base/skill-creation-patterns.md +380 -0
  76. package/squads/squad-claude/knowledge-base/swarm-orchestration-patterns.md +411 -0
  77. package/squads/squad-cloning/knowledge-base/clone-quality-assurance.md +211 -0
  78. package/squads/squad-cloning/knowledge-base/confidence-scoring.md +51 -0
  79. package/squads/squad-cloning/knowledge-base/cross-squad-deployment.md +47 -0
  80. package/squads/squad-cloning/knowledge-base/ethical-guidelines.md +237 -0
  81. package/squads/squad-cloning/knowledge-base/knowledge-graph-for-clones.md +295 -0
  82. package/squads/squad-cloning/knowledge-base/memory-architecture-for-clones.md +229 -0
  83. package/squads/squad-cloning/knowledge-base/multi-agent-deployment-patterns.md +320 -0
  84. package/squads/squad-cloning/knowledge-base/skill-standard-for-clones.md +262 -0
  85. package/squads/squad-cloning/knowledge-base/sop-extraction-guide.md +243 -0
  86. package/squads/squad-commercial/knowledge-base/account-based-selling.md +206 -0
  87. package/squads/squad-commercial/knowledge-base/ai-as-competitive-infrastructure.md +14 -0
  88. package/squads/squad-commercial/knowledge-base/ai-in-sales.md +199 -0
  89. package/squads/squad-commercial/knowledge-base/brazilian-sales-context.md +195 -0
  90. package/squads/squad-commercial/knowledge-base/customer-success-operations.md +83 -2
  91. package/squads/squad-commercial/knowledge-base/prospecting-pipeline-generation.md +69 -0
  92. package/squads/squad-commercial/knowledge-base/sales-enablement-playbook.md +260 -0
  93. package/squads/squad-commercial/knowledge-base/sales-methodology-comparison.md +185 -0
  94. package/squads/squad-commercial/knowledge-base/sales-revenue-master-reference.md +1123 -0
  95. package/squads/squad-content/knowledge-base/brazilian-content-context.md +176 -0
  96. package/squads/squad-content/knowledge-base/competitor-analysis-methods.md +40 -1
  97. package/squads/squad-content/knowledge-base/content-architecture-taxonomy.md +206 -0
  98. package/squads/squad-content/knowledge-base/content-formats-encyclopedia.md +58 -1
  99. package/squads/squad-content/knowledge-base/content-references-bibliography.md +130 -0
  100. package/squads/squad-content/knowledge-base/content-strategy-master-reference.md +1097 -0
  101. package/squads/squad-content/knowledge-base/content-tech-stack.md +150 -0
  102. package/squads/squad-content/knowledge-base/copywriting-formulas-library.md +188 -0
  103. package/squads/squad-content/knowledge-base/email-newsletter-strategy.md +161 -0
  104. package/squads/squad-content/knowledge-base/platform-algorithm-intelligence.md +86 -1
  105. package/squads/squad-content/knowledge-base/social-algorithms-master-reference.md +1007 -0
  106. package/squads/squad-content/knowledge-base/video-audio-content-playbook.md +218 -0
  107. package/squads/squad-copy/knowledge-base/ai-copy-production.md +254 -0
  108. package/squads/squad-copy/knowledge-base/brazilian-copywriting-context.md +242 -0
  109. package/squads/squad-copy/knowledge-base/email-copywriting-system.md +299 -0
  110. package/squads/squad-copy/knowledge-base/landing-page-copy-architecture.md +267 -0
  111. package/squads/squad-copy/knowledge-base/power-words-catalog.md +205 -0
  112. package/squads/squad-copy/knowledge-base/seo-copywriting.md +255 -0
  113. package/squads/squad-copy/knowledge-base/video-script-copywriting.md +239 -0
  114. package/squads/squad-council/knowledge-base/brand-strategy-models.md +193 -0
  115. package/squads/squad-council/knowledge-base/growth-strategy-models.md +267 -0
  116. package/squads/squad-council/knowledge-base/innovation-disruption-frameworks.md +193 -0
  117. package/squads/squad-council/knowledge-base/market-analysis-frameworks.md +240 -0
  118. package/squads/squad-council/knowledge-base/organizational-leadership-models.md +212 -0
  119. package/squads/squad-council/knowledge-base/sales-strategy-models.md +215 -0
  120. package/squads/squad-courses/knowledge-base/course-launch-strategy.md +251 -0
  121. package/squads/squad-courses/knowledge-base/domain-advocacia-curriculum.md +385 -0
  122. package/squads/squad-courses/knowledge-base/domain-contabilidade-curriculum.md +266 -0
  123. package/squads/squad-courses/knowledge-base/platform-comparison.md +68 -0
  124. package/squads/squad-courses/knowledge-base/video-production-guide.md +70 -0
  125. package/squads/squad-cybersecurity/knowledge-base/cloud-security-reference.md +363 -0
  126. package/squads/squad-cybersecurity/knowledge-base/compliance-frameworks.md +273 -0
  127. package/squads/squad-cybersecurity/knowledge-base/database-security.md +438 -0
  128. package/squads/squad-cybersecurity/knowledge-base/incident-response-playbook.md +420 -0
  129. package/squads/squad-cybersecurity/knowledge-base/network-security-reference.md +477 -0
  130. package/squads/squad-cybersecurity/knowledge-base/penetration-testing-methodology.md +350 -0
  131. package/squads/squad-cybersecurity/knowledge-base/vulnerability-management.md +349 -0
  132. package/squads/squad-design/knowledge-base/brazilian-design-context.md +223 -0
  133. package/squads/squad-design/knowledge-base/component-api-patterns.md +208 -4
  134. package/squads/squad-design/knowledge-base/design-system-master-reference.md +1302 -0
  135. package/squads/squad-design/knowledge-base/design-systems-frameworks.md +91 -1
  136. package/squads/squad-design/knowledge-base/responsive-modern-css.md +96 -4
  137. package/squads/squad-design/knowledge-base/wcag-aria-reference.md +117 -5
  138. package/squads/squad-design/knowledge-base/web-performance-reference.md +127 -4
  139. package/squads/squad-finance/knowledge-base/brazilian-taxation.md +263 -0
  140. package/squads/squad-finance/knowledge-base/contabilidade-master-reference.md +998 -0
  141. package/squads/squad-finance/knowledge-base/finance-master-reference.md +946 -0
  142. package/squads/squad-finance/knowledge-base/financial-reporting-analysis.md +316 -0
  143. package/squads/squad-finance/knowledge-base/fintech-brazilian-context.md +242 -0
  144. package/squads/squad-finance/knowledge-base/fpa-planning-frameworks.md +286 -0
  145. package/squads/squad-finance/knowledge-base/ma-and-transactions.md +285 -0
  146. package/squads/squad-finance/knowledge-base/risk-management.md +233 -0
  147. package/squads/squad-finance/knowledge-base/startups-venture-capital.md +337 -0
  148. package/squads/squad-growth/knowledge-base/ai-growth-playbook.md +216 -0
  149. package/squads/squad-growth/knowledge-base/attribution-models.md +78 -0
  150. package/squads/squad-growth/knowledge-base/brazilian-growth-context.md +208 -0
  151. package/squads/squad-growth/knowledge-base/community-led-growth.md +175 -0
  152. package/squads/squad-growth/knowledge-base/content-marketing-flywheel.md +190 -0
  153. package/squads/squad-growth/knowledge-base/email-lifecycle-framework.md +192 -0
  154. package/squads/squad-growth/knowledge-base/growth-frameworks-catalog.md +82 -0
  155. package/squads/squad-growth/knowledge-base/growth-master-reference.md +1168 -0
  156. package/squads/squad-growth/knowledge-base/routing-catalog.md +53 -11
  157. package/squads/squad-paidmedia/knowledge-base/audiences-segmentation-deep.md +285 -0
  158. package/squads/squad-paidmedia/knowledge-base/creative-strategy-deep.md +294 -0
  159. package/squads/squad-paidmedia/knowledge-base/google-ads-account-architecture.md +87 -0
  160. package/squads/squad-paidmedia/knowledge-base/meta-ads-campaign-architecture.md +76 -0
  161. package/squads/squad-paidmedia/knowledge-base/paid-media-metrics-reference.md +117 -0
  162. package/squads/squad-paidmedia/knowledge-base/paid-traffic-master-reference.md +1308 -0
  163. package/squads/squad-paidmedia/knowledge-base/routing-catalog.md +95 -18
  164. package/squads/squad-paidmedia/knowledge-base/traffic-masters-frameworks.md +71 -0
  165. package/squads/squad-product/knowledge-base/brazilian-product-context.md +284 -0
  166. package/squads/squad-product/knowledge-base/discovery-methodology-playbook.md +141 -0
  167. package/squads/squad-product/knowledge-base/pm-frameworks-reference.md +125 -9
  168. package/squads/squad-product/knowledge-base/product-analytics-formulas.md +72 -0
  169. package/squads/squad-product/knowledge-base/product-led-growth-reference.md +155 -13
  170. package/squads/squad-product/knowledge-base/product-market-fit-framework.md +222 -0
  171. package/squads/squad-product/knowledge-base/routing-catalog.md +32 -0
  172. package/squads/squad-research/knowledge-base/agentic-second-brain-reference.md +591 -0
  173. package/squads/squad-research/knowledge-base/ai-augmented-research.md +212 -0
  174. package/squads/squad-research/knowledge-base/brazilian-market-research-sources.md +197 -0
  175. package/squads/squad-research/knowledge-base/community-platforms-reference.md +786 -0
  176. package/squads/squad-research/knowledge-base/community-research-methods.md +194 -0
  177. package/squads/squad-research/knowledge-base/mixed-methods-research-design.md +168 -0
  178. package/squads/squad-research/knowledge-base/network-effects-analysis.md +192 -0
  179. package/squads/squad-research/knowledge-base/qualitative-research-deep-methods.md +202 -0
  180. package/squads/squad-research/knowledge-base/quantitative-research-methods.md +208 -0
  181. package/squads/squad-research/knowledge-base/research-frameworks-encyclopedia.md +40 -0
  182. package/squads/squad-research/knowledge-base/research-synthesis-frameworks.md +223 -0
  183. package/squads/squad-storytelling/knowledge-base/brand-mythology-framework.md +236 -0
  184. package/squads/squad-storytelling/knowledge-base/brazilian-storytelling-context.md +237 -0
  185. package/squads/squad-storytelling/knowledge-base/data-storytelling.md +232 -0
  186. package/squads/squad-storytelling/knowledge-base/improv-storytelling.md +226 -0
  187. package/squads/squad-storytelling/knowledge-base/persuasion-narrative-techniques.md +269 -0
  188. package/squads/squad-storytelling/knowledge-base/social-movement-narratives.md +191 -0
  189. package/squads/squad-storytelling/knowledge-base/video-storytelling.md +252 -0
  190. package/squads/claude-code-mastery/data/swarm-orchestration-patterns.yaml +0 -378
  191. package/squads/squad-animations/knowledge-base/framer-motion-complete-reference.md +0 -710
  192. package/squads/squad-animations/knowledge-base/web-animations-api-view-transitions.md +0 -478
@@ -0,0 +1,420 @@
1
+ # Incident Response Playbook
2
+
3
+ ## Purpose
4
+
5
+ Structured incident response methodology and communication templates for Rapid (incident-responder). Based on NIST SP 800-61 Rev. 2, SANS IR Process, and practical web application context including LGPD notification requirements.
6
+
7
+ ---
8
+
9
+ ## IR Framework Overview
10
+
11
+ Two complementary frameworks inform this playbook:
12
+
13
+ | Framework | Phases | Best For |
14
+ |-----------|--------|---------|
15
+ | **NIST SP 800-61** | Preparation → Detection & Analysis → Containment/Eradication/Recovery → Post-Incident | Comprehensive, government-aligned |
16
+ | **SANS 6-Step** | Preparation → Identification → Containment → Eradication → Recovery → Lessons Learned | Practical, widely adopted |
17
+
18
+ This playbook uses NIST structure with SANS terminology for clarity.
19
+
20
+ ---
21
+
22
+ ## Severity Classification
23
+
24
+ Before executing the playbook, classify severity using the Fortress severity matrix:
25
+
26
+ | Level | Indicators | Response SLA | Escalation |
27
+ |-------|-----------|-------------|------------|
28
+ | **CRITICAL** | Active data exfiltration, ransomware deployed, zero-day exploited in production | 15 minutes to initial response | Rapid + Sentinel + Wire immediately |
29
+ | **HIGH** | Confirmed unauthorized access, credentials compromised, significant data exposed | 1 hour to initial assessment | Rapid primary, Sentinel support |
30
+ | **MEDIUM** | Suspicious activity confirmed, policy violation, limited exposure | 24 hours to initial assessment | Rapid assessment |
31
+ | **LOW** | Anomaly detected, potential policy violation | 5 business days | Scheduled review |
32
+
33
+ ---
34
+
35
+ ## Phase 1: Preparation (Before Any Incident)
36
+
37
+ The effectiveness of incident response is determined almost entirely by preparation quality.
38
+
39
+ ### Preparation Checklist
40
+
41
+ ```
42
+ Documentation
43
+ [ ] Incident response plan approved and tested
44
+ [ ] Contact list current: CISO, legal, PR, DPO, ANPD contact
45
+ [ ] Asset inventory current — know what you're protecting
46
+ [ ] Data classification documented — know what data you hold
47
+ [ ] LGPD breach notification procedure documented
48
+
49
+ Technical Readiness
50
+ [ ] Centralized logging operational (SIEM, CloudWatch, Datadog)
51
+ [ ] Alerting rules configured and tuned
52
+ [ ] Forensic tools available (disk images, memory capture)
53
+ [ ] Out-of-band communication channel exists (separate from primary systems)
54
+ [ ] Backup integrity verified and restoration tested within 90 days
55
+
56
+ Legal and Compliance
57
+ [ ] Legal counsel identified and on retainer (or internal legal briefed)
58
+ [ ] Cyber insurance policy reviewed — coverage understood
59
+ [ ] ANPD (Brazil) notification procedure documented — 3 business days SLA
60
+ [ ] Regulatory notification requirements identified per data type
61
+ [ ] Evidence preservation procedures documented
62
+
63
+ Training
64
+ [ ] IR team trained on procedures
65
+ [ ] Tabletop exercise conducted in last 12 months
66
+ [ ] After-hours escalation procedure known to all team members
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Phase 2: Detection and Analysis
72
+
73
+ ### Detection Sources
74
+
75
+ | Source | What It Detects | Priority |
76
+ |--------|----------------|---------|
77
+ | SIEM alerts | Anomalous access patterns, known attack signatures | High |
78
+ | User reports | Unusual behavior, phishing reports, lockout issues | High |
79
+ | Automated scans | Vulnerability confirmations, configuration changes | Medium |
80
+ | Third-party notification | Vendor/partner breach affecting your data | High |
81
+ | Threat intelligence | IOCs matching your environment | Medium |
82
+ | Audit log review | Scheduled review finds anomalies | Low |
83
+
84
+ ### Initial Triage Questions
85
+
86
+ When an alert fires or report arrives, answer in order:
87
+
88
+ 1. **What is the affected system/data?** — identify scope
89
+ 2. **What is the timeline?** — when did this start?
90
+ 3. **Is this still ongoing?** — active vs. historical incident
91
+ 4. **What data could be exposed?** — PII, credentials, financial, IP
92
+ 5. **Is the attacker still present?** — look for persistence indicators
93
+ 6. **What is the business impact?** — revenue, reputation, legal
94
+
95
+ ### Evidence Collection (Do This First)
96
+
97
+ Preserve evidence before taking containment actions that might destroy it:
98
+
99
+ ```bash
100
+ # Capture volatile memory before shutdown or isolation
101
+ # Linux
102
+ sudo avml /media/evidence/memory.lime
103
+
104
+ # Windows
105
+ # Use WinPmem or DumpIt
106
+
107
+ # Capture running processes
108
+ ps aux > /evidence/processes.txt
109
+ netstat -natp > /evidence/network.txt
110
+ last > /evidence/last-logins.txt
111
+
112
+ # Capture logs before they rotate
113
+ cp /var/log/auth.log /evidence/
114
+ cp /var/log/nginx/access.log /evidence/
115
+ cp /var/log/nginx/error.log /evidence/
116
+
117
+ # Create filesystem image (if forensic analysis needed)
118
+ sudo dd if=/dev/sda of=/media/evidence/disk.img bs=4M status=progress
119
+ # Hash the image
120
+ sha256sum /media/evidence/disk.img > /media/evidence/disk.img.sha256
121
+ ```
122
+
123
+ ### IOC Analysis
124
+
125
+ When examining suspicious artifacts:
126
+
127
+ ```bash
128
+ # Check file hash against VirusTotal
129
+ sha256sum suspicious_file | awk '{print $1}' | xargs -I{} curl -s \
130
+ "https://www.virustotal.com/api/v3/files/{}" -H "x-apikey: $VT_API_KEY"
131
+
132
+ # Check IP against threat intel
133
+ curl "https://api.abuseipdb.com/api/v2/check?ipAddress=1.2.3.4" \
134
+ -H "Key: $ABUSEIPDB_API_KEY" -H "Accept: application/json"
135
+
136
+ # Analyze network connections
137
+ netstat -natp | grep ESTABLISHED
138
+ ss -tulpn
139
+
140
+ # Check for web shells (common indicator for web app compromises)
141
+ find /var/www -name "*.php" -newer /var/www/index.php -exec ls -la {} \;
142
+ grep -r "eval(base64_decode" /var/www/ --include="*.php"
143
+ grep -r "system($_" /var/www/ --include="*.php"
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Phase 3: Containment
149
+
150
+ ### Containment Decision Tree
151
+
152
+ ```
153
+ Is the attacker actively present and causing damage?
154
+ YES → Emergency containment (isolate immediately, accept service disruption)
155
+ NO → Coordinated containment (observe and gather evidence while containing)
156
+
157
+ Can you contain without losing all evidence?
158
+ YES → Contain first, preserve evidence
159
+ NO → Preserve evidence first (set time limit: max 2 hours)
160
+
161
+ Is this a web application compromise?
162
+ YES → See Web App Containment below
163
+
164
+ Is this a cloud account compromise?
165
+ YES → See Cloud Account Containment below
166
+ ```
167
+
168
+ ### Web Application Containment
169
+
170
+ ```bash
171
+ # 1. Preserve logs before any action
172
+ # Copy all access logs, error logs, application logs
173
+
174
+ # 2. Revoke compromised sessions immediately
175
+ # Supabase: invalidate all user sessions
176
+ # In Supabase dashboard → Authentication → Users → Invalidate session
177
+ # Or via API:
178
+ curl -X DELETE "https://api.supabase.io/v1/projects/$PROJECT_ID/auth/users/$USER_ID/sessions" \
179
+ -H "Authorization: Bearer $SERVICE_ROLE_KEY"
180
+
181
+ # 3. Rotate compromised credentials
182
+ # API keys, database passwords, JWT secrets
183
+
184
+ # 4. Block malicious IPs at WAF/Cloudflare
185
+ # In Cloudflare Dashboard → Security → WAF → Custom Rules
186
+ # Or via API:
187
+ curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/firewall/rules" \
188
+ -H "Authorization: Bearer $CF_TOKEN" \
189
+ -d '{"action":"block","filter":{"expression":"ip.src eq 1.2.3.4"}}'
190
+
191
+ # 5. Enable forced MFA if credentials leaked
192
+ # Force re-authentication for all users
193
+
194
+ # 6. Deploy emergency WAF rules (temporary, until fix deployed)
195
+ # Block attack pattern that was exploited
196
+ ```
197
+
198
+ ### Cloud Account Containment
199
+
200
+ ```bash
201
+ # AWS: Disable compromised IAM user immediately
202
+ aws iam update-user --user-name compromised-user
203
+ aws iam delete-access-key --user-name compromised-user --access-key-id AKID...
204
+
205
+ # Revoke all active sessions for a role
206
+ aws iam put-role-policy --role-name MyRole --policy-name DenyAll \
207
+ --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Action":"*","Resource":"*"}]}'
208
+
209
+ # GCP: Disable service account
210
+ gcloud iam service-accounts disable compromised-sa@project.iam.gserviceaccount.com
211
+
212
+ # Azure: Disable user account
213
+ az ad user update --id compromised@tenant.com --account-enabled false
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Phase 4: Eradication
219
+
220
+ After containment, remove the attacker's foothold:
221
+
222
+ ### Eradication Checklist
223
+
224
+ ```
225
+ [ ] Identified and removed all malicious files (web shells, backdoors, malware)
226
+ [ ] Compared current application code against known-good baseline
227
+ [ ] Closed all unauthorized accounts or access paths
228
+ [ ] Rotated all credentials that could be compromised
229
+ [ ] Removed all persistence mechanisms (cron jobs, startup scripts, scheduled tasks)
230
+ [ ] Identified and patched the vulnerability that was exploited
231
+ [ ] Scanned all systems in same network segment for related compromise
232
+ [ ] Verified no exfiltration pathways remain
233
+ ```
234
+
235
+ ### Web Shell Detection
236
+
237
+ ```bash
238
+ # Common web shell indicators
239
+ find /var/www -name "*.php" -type f | xargs grep -l "eval\|base64_decode\|system\|exec\|passthru"
240
+ find /var/www -name "*.php" -newer /etc/passwd # Recently modified PHP files
241
+ find /var/www -name "*.php.jpg" # Double extension files
242
+ find /uploads -name "*.php" # PHP in upload directories (should never exist)
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Phase 5: Recovery
248
+
249
+ ### Recovery Sequence
250
+
251
+ 1. **Verify eradication** — ensure attacker has no remaining access
252
+ 2. **Restore from clean backup** if system was compromised at the file/OS level
253
+ 3. **Deploy patched code** with the vulnerability fixed
254
+ 4. **Monitor intensively** for first 48-72 hours after recovery
255
+ 5. **Gradually restore access** — don't turn everything on at once
256
+ 6. **Validate functionality** — confirm application works correctly
257
+ 7. **Communicate recovery** to affected users and stakeholders
258
+
259
+ ### Backup Restoration
260
+
261
+ ```bash
262
+ # Verify backup integrity before restoration
263
+ sha256sum backup.tar.gz
264
+ # Compare with stored hash from when backup was created
265
+
266
+ # For Supabase:
267
+ # Restore from backup via Supabase Dashboard
268
+ # Settings → Database → Backups → Select backup → Restore
269
+
270
+ # For self-managed PostgreSQL:
271
+ pg_restore -h localhost -U postgres -d mydb clean_backup.dump
272
+
273
+ # For filesystem:
274
+ tar xzf clean_backup.tar.gz --directory /var/www/html/
275
+ # Verify file hashes after restoration
276
+ ```
277
+
278
+ ---
279
+
280
+ ## Phase 6: Post-Incident Review
281
+
282
+ Conduct within 7 days of resolution.
283
+
284
+ ### Post-Mortem Template (Blameless)
285
+
286
+ ```markdown
287
+ # Post-Mortem: [Incident Name] — [Date]
288
+
289
+ ## Impact Summary
290
+ - Duration:
291
+ - Systems affected:
292
+ - Users affected:
293
+ - Data exposed (if any):
294
+ - Business impact:
295
+
296
+ ## Root Cause
297
+ [What was the underlying vulnerability or failure that enabled the incident?]
298
+
299
+ ## Timeline
300
+ [When events were, accurate to the minute]
301
+
302
+ ## What Went Well
303
+ - Detection was fast because...
304
+ - Containment was effective because...
305
+
306
+ ## What Could Improve
307
+ - We could have detected faster if...
308
+ - Containment was slow because...
309
+
310
+ ## Action Items
311
+ | Action | Owner | Due Date | Priority |
312
+ |--------|-------|----------|---------|
313
+ | [Specific fix] | [Person] | [Date] | [P1/P2/P3] |
314
+
315
+ ## Lessons Learned
316
+ [3-5 key takeaways for the broader team]
317
+ ```
318
+
319
+ ---
320
+
321
+ ## LGPD Breach Notification
322
+
323
+ Brazilian law requires notification within 3 business days of becoming aware of a breach involving personal data.
324
+
325
+ ### Decision Tree: Do I Need to Notify?
326
+
327
+ ```
328
+ Was personal data accessed, exposed, or stolen?
329
+ YES → Was the data encrypted in a way that prevents access?
330
+ NO → Notification required
331
+ YES → May not be required (consult legal)
332
+ NO → No notification required
333
+
334
+ Is this a security incident without personal data exposure?
335
+ → No LGPD notification required (but document for internal records)
336
+ ```
337
+
338
+ ### ANPD Notification Requirements
339
+
340
+ ```
341
+ Timeframe: 3 business days from discovery
342
+ Channel: ANPD portal (https://www.gov.br/anpd/pt-br)
343
+ Email: anpd@anpd.gov.br
344
+
345
+ Required Information:
346
+ - Description of what happened
347
+ - Date of incident and date of discovery
348
+ - Categories and volume of personal data affected
349
+ - Categories of data subjects affected
350
+ - Potential consequences of the incident
351
+ - Technical and organizational measures adopted
352
+ - DPO contact information
353
+ - Measures implemented to mitigate effects
354
+ ```
355
+
356
+ ### Notification to Data Subjects
357
+
358
+ ```
359
+ Timeline: As soon as reasonably practicable after ANPD notification
360
+ Content:
361
+ - Plain language description of what happened
362
+ - What personal data was involved
363
+ - What risks exist for the individual
364
+ - What the organization has done
365
+ - What the individual can do to protect themselves
366
+ - Contact information for questions
367
+ ```
368
+
369
+ ### Communication Templates
370
+
371
+ **Initial internal notification (within 1 hour of detection):**
372
+ ```
373
+ SUBJECT: [CONFIDENTIAL] Security Incident Alert — [Severity Level]
374
+
375
+ Incident detected at [time] on [date].
376
+ Type: [breach/unauthorized access/data exposure]
377
+ Affected systems: [list]
378
+ Currently investigating.
379
+
380
+ Initial IR team activated: [names]
381
+ Next update at: [time]
382
+ War room: [location/link]
383
+ ```
384
+
385
+ **User notification template:**
386
+ ```
387
+ Dear [User],
388
+
389
+ We are writing to inform you about a security incident that may have affected
390
+ your account on [Application Name].
391
+
392
+ What happened:
393
+ On [date], we discovered [brief description of incident].
394
+
395
+ What information was involved:
396
+ [Specific data types: email, name, etc. — be specific, not vague]
397
+
398
+ What we have done:
399
+ - [Action 1]
400
+ - [Action 2]
401
+
402
+ What you should do:
403
+ - Change your password immediately at [URL]
404
+ - Enable two-factor authentication
405
+ - Monitor your email for unusual activity
406
+
407
+ If you have questions, contact us at [security@example.com]
408
+
409
+ Sincerely,
410
+ [Organization]
411
+ ```
412
+
413
+ ---
414
+
415
+ ## Sources
416
+
417
+ - NIST SP 800-61 Rev. 2: https://csrc.nist.gov/publications/detail/sp/800-61/rev-2/final
418
+ - CISA Federal IR Playbooks: https://www.cisa.gov/sites/default/files/2024-08/Federal_Government_Cybersecurity_Incident_and_Vulnerability_Response_Playbooks_508C.pdf
419
+ - LGPD Art. 48: http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2018/lei/l13709.htm
420
+ - ANPD Breach Notification: https://www.gov.br/anpd/pt-br/assuntos/noticias/anpd-publica-resolucao-sobre-comunicacao-de-incidentes