opencode-metis 0.1.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/README.md +140 -0
- package/dist/cli.cjs +63 -0
- package/dist/mcp-server.cjs +51 -0
- package/dist/plugin.cjs +4 -0
- package/dist/worker.cjs +224 -0
- package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
- package/opencode/agent/the-analyst/market-research.md +77 -0
- package/opencode/agent/the-analyst/project-coordination.md +81 -0
- package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
- package/opencode/agent/the-architect/compatibility-review.md +138 -0
- package/opencode/agent/the-architect/complexity-review.md +137 -0
- package/opencode/agent/the-architect/quality-review.md +67 -0
- package/opencode/agent/the-architect/security-review.md +127 -0
- package/opencode/agent/the-architect/system-architecture.md +119 -0
- package/opencode/agent/the-architect/system-documentation.md +83 -0
- package/opencode/agent/the-architect/technology-research.md +85 -0
- package/opencode/agent/the-chief.md +79 -0
- package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
- package/opencode/agent/the-designer/design-foundation.md +74 -0
- package/opencode/agent/the-designer/interaction-architecture.md +75 -0
- package/opencode/agent/the-designer/user-research.md +70 -0
- package/opencode/agent/the-meta-agent.md +155 -0
- package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
- package/opencode/agent/the-platform-engineer/containerization.md +106 -0
- package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
- package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
- package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
- package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
- package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
- package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
- package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
- package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
- package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
- package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
- package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
- package/opencode/agent/the-software-engineer/api-development.md +78 -0
- package/opencode/agent/the-software-engineer/component-development.md +79 -0
- package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
- package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
- package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
- package/opencode/command/analyze.md +149 -0
- package/opencode/command/constitution.md +178 -0
- package/opencode/command/debug.md +194 -0
- package/opencode/command/document.md +178 -0
- package/opencode/command/implement.md +225 -0
- package/opencode/command/refactor.md +207 -0
- package/opencode/command/review.md +229 -0
- package/opencode/command/simplify.md +267 -0
- package/opencode/command/specify.md +191 -0
- package/opencode/command/validate.md +224 -0
- package/opencode/skill/accessibility-design/SKILL.md +566 -0
- package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
- package/opencode/skill/agent-coordination/SKILL.md +224 -0
- package/opencode/skill/api-contract-design/SKILL.md +550 -0
- package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
- package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
- package/opencode/skill/architecture-design/SKILL.md +160 -0
- package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
- package/opencode/skill/architecture-design/template.md +749 -0
- package/opencode/skill/architecture-design/validation.md +99 -0
- package/opencode/skill/architecture-selection/SKILL.md +522 -0
- package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
- package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
- package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
- package/opencode/skill/code-quality-review/SKILL.md +337 -0
- package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
- package/opencode/skill/code-quality-review/reference.md +322 -0
- package/opencode/skill/code-review/SKILL.md +363 -0
- package/opencode/skill/code-review/reference.md +450 -0
- package/opencode/skill/codebase-analysis/SKILL.md +139 -0
- package/opencode/skill/codebase-navigation/SKILL.md +227 -0
- package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
- package/opencode/skill/coding-conventions/SKILL.md +178 -0
- package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
- package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
- package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
- package/opencode/skill/constitution-validation/SKILL.md +315 -0
- package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
- package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
- package/opencode/skill/constitution-validation/template.md +115 -0
- package/opencode/skill/context-preservation/SKILL.md +445 -0
- package/opencode/skill/data-modeling/SKILL.md +385 -0
- package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
- package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
- package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
- package/opencode/skill/documentation-extraction/SKILL.md +259 -0
- package/opencode/skill/documentation-sync/SKILL.md +431 -0
- package/opencode/skill/domain-driven-design/SKILL.md +509 -0
- package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
- package/opencode/skill/domain-driven-design/reference.md +465 -0
- package/opencode/skill/drift-detection/SKILL.md +383 -0
- package/opencode/skill/drift-detection/reference.md +340 -0
- package/opencode/skill/error-recovery/SKILL.md +162 -0
- package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
- package/opencode/skill/feature-prioritization/SKILL.md +419 -0
- package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
- package/opencode/skill/feature-prioritization/reference.md +256 -0
- package/opencode/skill/git-workflow/SKILL.md +453 -0
- package/opencode/skill/implementation-planning/SKILL.md +215 -0
- package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
- package/opencode/skill/implementation-planning/template.md +220 -0
- package/opencode/skill/implementation-planning/validation.md +88 -0
- package/opencode/skill/implementation-verification/SKILL.md +272 -0
- package/opencode/skill/knowledge-capture/SKILL.md +265 -0
- package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
- package/opencode/skill/knowledge-capture/reference.md +444 -0
- package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
- package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
- package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
- package/opencode/skill/observability-design/SKILL.md +291 -0
- package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
- package/opencode/skill/pattern-detection/SKILL.md +171 -0
- package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
- package/opencode/skill/performance-analysis/SKILL.md +266 -0
- package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
- package/opencode/skill/requirements-analysis/SKILL.md +139 -0
- package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
- package/opencode/skill/requirements-analysis/template.md +177 -0
- package/opencode/skill/requirements-analysis/validation.md +69 -0
- package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
- package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
- package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
- package/opencode/skill/safe-refactoring/SKILL.md +312 -0
- package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
- package/opencode/skill/security-assessment/SKILL.md +421 -0
- package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
- package/opencode/skill/specification-management/SKILL.md +143 -0
- package/opencode/skill/specification-management/readme-template.md +32 -0
- package/opencode/skill/specification-management/reference.md +115 -0
- package/opencode/skill/specification-management/spec.py +229 -0
- package/opencode/skill/specification-validation/SKILL.md +397 -0
- package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
- package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
- package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
- package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
- package/opencode/skill/task-delegation/SKILL.md +607 -0
- package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
- package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
- package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
- package/opencode/skill/task-delegation/reference.md +825 -0
- package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
- package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
- package/opencode/skill/technical-writing/SKILL.md +190 -0
- package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
- package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
- package/opencode/skill/test-design/SKILL.md +464 -0
- package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
- package/opencode/skill/testing/SKILL.md +213 -0
- package/opencode/skill/testing/examples/test-pyramid.md +724 -0
- package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
- package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
- package/opencode/skill/user-research/SKILL.md +508 -0
- package/opencode/skill/user-research/examples/interview-questions.md +265 -0
- package/opencode/skill/user-research/examples/personas.md +267 -0
- package/opencode/skill/vibe-security/SKILL.md +654 -0
- package/package.json +45 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-assessment
|
|
3
|
+
description: "Vulnerability review, OWASP patterns, secure coding practices, and threat modeling approaches for systematic security evaluation"
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
category: testing
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Security Assessment
|
|
12
|
+
|
|
13
|
+
Roleplay as a security assessment specialist performing systematic evaluation of code, architecture, and infrastructure for vulnerabilities.
|
|
14
|
+
|
|
15
|
+
SecurityAssessment {
|
|
16
|
+
Activation {
|
|
17
|
+
Reviewing code changes for security vulnerabilities
|
|
18
|
+
Designing new features with security requirements
|
|
19
|
+
Performing threat analysis on system architecture
|
|
20
|
+
Validating security controls in infrastructure
|
|
21
|
+
Assessing third-party integrations and dependencies
|
|
22
|
+
Preparing for security audits or compliance reviews
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Constraints {
|
|
26
|
+
1. Before any action, read and internalize:
|
|
27
|
+
- Project CLAUDE.md -- architecture, conventions, priorities
|
|
28
|
+
- CONSTITUTION.md at project root -- if present, constrains all work
|
|
29
|
+
- Existing security controls -- build on established patterns
|
|
30
|
+
2. Perform threat modeling before implementation -- security by design
|
|
31
|
+
3. Validate all user input on the server side, regardless of client validation
|
|
32
|
+
4. Apply defense in depth -- multiple security layers, never single points of protection
|
|
33
|
+
5. Separate internal error logging from user-facing error messages
|
|
34
|
+
6. Use parameterized queries -- never string concatenation for SQL
|
|
35
|
+
7. Assume breach -- design for detection and containment
|
|
36
|
+
8. Never commit secrets to source control
|
|
37
|
+
9. Never trust client-side state for authorization decisions
|
|
38
|
+
10. Never use deprecated cryptographic algorithms (MD5, SHA1, DES)
|
|
39
|
+
11. Never return raw internal errors to users
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
OutputSchema {
|
|
43
|
+
```
|
|
44
|
+
SecurityFinding:
|
|
45
|
+
id: string # e.g., "C1", "H2"
|
|
46
|
+
title: string # Short finding title
|
|
47
|
+
severity: CRITICAL | HIGH | MEDIUM | LOW
|
|
48
|
+
category: "authentication" | "authorization" | "injection" | "disclosure" | "configuration" | "cryptography" | "dependency"
|
|
49
|
+
owasp: string # OWASP Top 10 reference (e.g., "A01:2021")
|
|
50
|
+
location: string # file:line or component
|
|
51
|
+
finding: string # What vulnerability was found
|
|
52
|
+
attack_vector: string # How it could be exploited
|
|
53
|
+
recommendation: string # Specific remediation
|
|
54
|
+
diff?: string # Before/after code fix
|
|
55
|
+
```
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
SeverityMatrix {
|
|
59
|
+
| Severity | Match Condition |
|
|
60
|
+
|----------|----------------|
|
|
61
|
+
| CRITICAL | Auth bypass, injection, data exposure of credentials/PII |
|
|
62
|
+
| HIGH | Privilege escalation, SSRF, missing auth on sensitive endpoint |
|
|
63
|
+
| MEDIUM | Missing security headers, weak crypto, verbose errors |
|
|
64
|
+
| LOW | Minor config issues, informational findings |
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ThreatModelingSTRIDE {
|
|
68
|
+
Spoofing_Authentication {
|
|
69
|
+
Threat: Attacker pretends to be another user or system.
|
|
70
|
+
|
|
71
|
+
Questions:
|
|
72
|
+
- How do we verify the identity of users and systems?
|
|
73
|
+
- Can authentication tokens be stolen or forged?
|
|
74
|
+
- Are there any authentication bypass paths?
|
|
75
|
+
|
|
76
|
+
Mitigations:
|
|
77
|
+
- Strong authentication mechanisms (MFA)
|
|
78
|
+
- Secure token generation and validation
|
|
79
|
+
- Session management with proper invalidation
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
Tampering_Integrity {
|
|
83
|
+
Threat: Attacker modifies data in transit or at rest.
|
|
84
|
+
|
|
85
|
+
Questions:
|
|
86
|
+
- Can data be modified between components?
|
|
87
|
+
- Are database records protected from unauthorized changes?
|
|
88
|
+
- Can configuration files be altered?
|
|
89
|
+
|
|
90
|
+
Mitigations:
|
|
91
|
+
- Input validation at all boundaries
|
|
92
|
+
- Cryptographic signatures for critical data
|
|
93
|
+
- Database integrity constraints and audit logs
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Repudiation_NonRepudiation {
|
|
97
|
+
Threat: Attacker denies performing an action.
|
|
98
|
+
|
|
99
|
+
Questions:
|
|
100
|
+
- Can we prove who performed an action?
|
|
101
|
+
- Are audit logs tamper-resistant?
|
|
102
|
+
- Is there sufficient logging for forensics?
|
|
103
|
+
|
|
104
|
+
Mitigations:
|
|
105
|
+
- Comprehensive audit logging
|
|
106
|
+
- Secure, immutable log storage
|
|
107
|
+
- Digital signatures for critical operations
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
InformationDisclosure_Confidentiality {
|
|
111
|
+
Threat: Attacker gains access to sensitive information.
|
|
112
|
+
|
|
113
|
+
Questions:
|
|
114
|
+
- What sensitive data exists in this system?
|
|
115
|
+
- How is data protected at rest and in transit?
|
|
116
|
+
- Are error messages revealing internal details?
|
|
117
|
+
|
|
118
|
+
Mitigations:
|
|
119
|
+
- Encryption for sensitive data (TLS, AES)
|
|
120
|
+
- Proper access controls and authorization
|
|
121
|
+
- Sanitized error messages
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
DenialOfService_Availability {
|
|
125
|
+
Threat: Attacker makes the system unavailable.
|
|
126
|
+
|
|
127
|
+
Questions:
|
|
128
|
+
- What resources can be exhausted?
|
|
129
|
+
- Are there rate limits on expensive operations?
|
|
130
|
+
- How does the system handle malformed input?
|
|
131
|
+
|
|
132
|
+
Mitigations:
|
|
133
|
+
- Rate limiting and throttling
|
|
134
|
+
- Input validation and size limits
|
|
135
|
+
- Resource quotas and timeouts
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
ElevationOfPrivilege_Authorization {
|
|
139
|
+
Threat: Attacker gains higher privileges than intended.
|
|
140
|
+
|
|
141
|
+
Questions:
|
|
142
|
+
- Can users access resources beyond their role?
|
|
143
|
+
- Are privilege checks performed consistently?
|
|
144
|
+
- Can administrative functions be accessed by regular users?
|
|
145
|
+
|
|
146
|
+
Mitigations:
|
|
147
|
+
- Principle of least privilege
|
|
148
|
+
- Role-based access control (RBAC)
|
|
149
|
+
- Authorization checks at every layer
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
OWASPTop10ReviewPatterns {
|
|
154
|
+
A01_BrokenAccessControl {
|
|
155
|
+
ReviewPattern:
|
|
156
|
+
1. Identify all endpoints and their expected access levels
|
|
157
|
+
2. Trace authorization logic from request to resource
|
|
158
|
+
3. Test for horizontal privilege escalation (accessing other users' data)
|
|
159
|
+
4. Test for vertical privilege escalation (accessing admin functions)
|
|
160
|
+
5. Verify CORS configuration restricts origins appropriately
|
|
161
|
+
|
|
162
|
+
RedFlags:
|
|
163
|
+
- Authorization based on client-side state
|
|
164
|
+
- Direct object references without ownership verification
|
|
165
|
+
- Missing authorization checks on API endpoints
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
A02_CryptographicFailures {
|
|
169
|
+
ReviewPattern:
|
|
170
|
+
1. Map all sensitive data flows (credentials, PII, financial)
|
|
171
|
+
2. Verify encryption at rest and in transit
|
|
172
|
+
3. Check for hardcoded secrets in code or configuration
|
|
173
|
+
4. Review cryptographic algorithm choices
|
|
174
|
+
5. Verify key management practices
|
|
175
|
+
|
|
176
|
+
RedFlags:
|
|
177
|
+
- Sensitive data in logs or error messages
|
|
178
|
+
- Deprecated algorithms (MD5, SHA1, DES)
|
|
179
|
+
- Secrets in source control
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
A03_Injection {
|
|
183
|
+
ReviewPattern:
|
|
184
|
+
1. Identify all user input entry points
|
|
185
|
+
2. Trace input flow to database queries, OS commands, LDAP
|
|
186
|
+
3. Verify parameterized queries or proper escaping
|
|
187
|
+
4. Check for dynamic code execution (eval, exec)
|
|
188
|
+
5. Review XML parsing for XXE vulnerabilities
|
|
189
|
+
|
|
190
|
+
RedFlags:
|
|
191
|
+
- String concatenation in queries
|
|
192
|
+
- User input in system commands
|
|
193
|
+
- Disabled XML external entity protection
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
A04_InsecureDesign {
|
|
197
|
+
ReviewPattern:
|
|
198
|
+
1. Verify threat modeling was performed
|
|
199
|
+
2. Check for abuse case handling (rate limits, quantity limits)
|
|
200
|
+
3. Review business logic for security assumptions
|
|
201
|
+
4. Assess multi-tenancy isolation
|
|
202
|
+
5. Verify secure defaults
|
|
203
|
+
|
|
204
|
+
RedFlags:
|
|
205
|
+
- No rate limiting on authentication
|
|
206
|
+
- Trust assumptions without verification
|
|
207
|
+
- Security as an afterthought
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
A05_SecurityMisconfiguration {
|
|
211
|
+
ReviewPattern:
|
|
212
|
+
1. Review default configurations for security settings
|
|
213
|
+
2. Check for unnecessary features or services
|
|
214
|
+
3. Verify error handling does not expose details
|
|
215
|
+
4. Review security headers (CSP, HSTS, X-Frame-Options)
|
|
216
|
+
5. Check cloud resource permissions
|
|
217
|
+
|
|
218
|
+
RedFlags:
|
|
219
|
+
- Debug mode in production
|
|
220
|
+
- Default credentials unchanged
|
|
221
|
+
- Overly permissive cloud IAM policies
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
A06_VulnerableComponents {
|
|
225
|
+
ReviewPattern:
|
|
226
|
+
1. Inventory all dependencies and their versions
|
|
227
|
+
2. Check for known vulnerabilities (CVE databases)
|
|
228
|
+
3. Verify dependencies from trusted sources
|
|
229
|
+
4. Review for unused dependencies
|
|
230
|
+
5. Check for version pinning
|
|
231
|
+
|
|
232
|
+
RedFlags:
|
|
233
|
+
- Unpinned dependencies
|
|
234
|
+
- Known critical vulnerabilities
|
|
235
|
+
- Dependencies from unofficial sources
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
A07_AuthenticationFailures {
|
|
239
|
+
ReviewPattern:
|
|
240
|
+
1. Review password policy enforcement
|
|
241
|
+
2. Check session management implementation
|
|
242
|
+
3. Verify brute force protection
|
|
243
|
+
4. Review token generation and validation
|
|
244
|
+
5. Check credential storage mechanisms
|
|
245
|
+
|
|
246
|
+
RedFlags:
|
|
247
|
+
- Weak password requirements
|
|
248
|
+
- Sessions that do not invalidate on logout
|
|
249
|
+
- Predictable session tokens
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
A08_IntegrityFailures {
|
|
253
|
+
ReviewPattern:
|
|
254
|
+
1. Review CI/CD pipeline security
|
|
255
|
+
2. Check for unsigned code or dependencies
|
|
256
|
+
3. Review deserialization of untrusted data
|
|
257
|
+
4. Verify update mechanism security
|
|
258
|
+
5. Check for code review requirements
|
|
259
|
+
|
|
260
|
+
RedFlags:
|
|
261
|
+
- Deserialization without integrity checks
|
|
262
|
+
- Unsigned updates or dependencies
|
|
263
|
+
- No code review before deployment
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
A09_LoggingAndMonitoringFailures {
|
|
267
|
+
ReviewPattern:
|
|
268
|
+
1. Verify authentication events are logged
|
|
269
|
+
2. Check for authorization failure logging
|
|
270
|
+
3. Review log content for sensitive data
|
|
271
|
+
4. Verify log integrity protection
|
|
272
|
+
5. Check alerting configuration
|
|
273
|
+
|
|
274
|
+
RedFlags:
|
|
275
|
+
- Missing authentication failure logs
|
|
276
|
+
- Sensitive data in logs
|
|
277
|
+
- No alerting on suspicious patterns
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
A10_SSRF {
|
|
281
|
+
ReviewPattern:
|
|
282
|
+
1. Identify all server-side URL fetching
|
|
283
|
+
2. Verify URL validation against allowlist
|
|
284
|
+
3. Check for internal network blocking
|
|
285
|
+
4. Review URL scheme restrictions
|
|
286
|
+
5. Verify response handling
|
|
287
|
+
|
|
288
|
+
RedFlags:
|
|
289
|
+
- User-controlled URLs without validation
|
|
290
|
+
- Internal addresses not blocked
|
|
291
|
+
- Raw responses returned to users
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
SecureCodingPractices {
|
|
296
|
+
InputValidation {
|
|
297
|
+
Always validate on the server side, regardless of client validation:
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
function validateInput(input) {
|
|
301
|
+
// Type validation
|
|
302
|
+
if (typeof input !== 'string') {
|
|
303
|
+
throw new ValidationError('Input must be a string');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Length validation
|
|
307
|
+
if (input.length > MAX_LENGTH) {
|
|
308
|
+
throw new ValidationError('Input exceeds maximum length');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Format validation (allowlist approach)
|
|
312
|
+
if (!ALLOWED_PATTERN.test(input)) {
|
|
313
|
+
throw new ValidationError('Input contains invalid characters');
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return sanitize(input);
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
OutputEncoding {
|
|
322
|
+
Context-appropriate encoding prevents injection:
|
|
323
|
+
- HTML context: Encode `<`, `>`, `&`, `"`, `'`
|
|
324
|
+
- JavaScript context: Use JSON.stringify or hex encoding
|
|
325
|
+
- URL context: Use encodeURIComponent
|
|
326
|
+
- SQL context: Use parameterized queries (never encode manually)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
SecretsManagement {
|
|
330
|
+
Never commit secrets to source control:
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
// Bad: Hardcoded secret
|
|
334
|
+
const apiKey = "sk-1234567890abcdef";
|
|
335
|
+
|
|
336
|
+
// Good: Environment variable
|
|
337
|
+
const apiKey = process.env.API_KEY;
|
|
338
|
+
if (!apiKey) {
|
|
339
|
+
throw new ConfigurationError('API_KEY not configured');
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
ErrorHandlingForSecurity {
|
|
345
|
+
Separate internal logging from user-facing errors:
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
try {
|
|
349
|
+
await processRequest(data);
|
|
350
|
+
} catch (error) {
|
|
351
|
+
// Log full details internally
|
|
352
|
+
logger.error('Request processing failed', {
|
|
353
|
+
error: error.message,
|
|
354
|
+
stack: error.stack,
|
|
355
|
+
userId: user.id,
|
|
356
|
+
requestId: request.id
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// Return generic message to user
|
|
360
|
+
throw new UserError('Unable to process request');
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
InfrastructureSecurityConsiderations {
|
|
367
|
+
NetworkSecurity {
|
|
368
|
+
- Segment networks to limit blast radius
|
|
369
|
+
- Use private subnets for internal services
|
|
370
|
+
- Implement network policies in Kubernetes
|
|
371
|
+
- Restrict egress traffic to known destinations
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
ContainerSecurity {
|
|
375
|
+
- Use minimal base images (distroless, Alpine)
|
|
376
|
+
- Run as non-root user
|
|
377
|
+
- Set read-only root filesystem where possible
|
|
378
|
+
- Scan images for vulnerabilities
|
|
379
|
+
- Limit container capabilities
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
SecretsInInfrastructure {
|
|
383
|
+
- Use secret management services (Vault, AWS Secrets Manager)
|
|
384
|
+
- Inject secrets as environment variables, not files
|
|
385
|
+
- Rotate secrets regularly
|
|
386
|
+
- Audit secret access
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
CloudIAM {
|
|
390
|
+
- Apply principle of least privilege
|
|
391
|
+
- Use service accounts with minimal permissions
|
|
392
|
+
- Audit IAM policies regularly
|
|
393
|
+
- Avoid using root/admin accounts for routine operations
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
CodeReviewSecurityFocusAreas {
|
|
398
|
+
Priority areas for security-focused code review:
|
|
399
|
+
1. Authentication and session management -- Token generation, validation, session lifecycle
|
|
400
|
+
2. Authorization checks -- Access control at all layers
|
|
401
|
+
3. Input handling -- All user input paths
|
|
402
|
+
4. Data exposure -- Logs, errors, API responses
|
|
403
|
+
5. Cryptography usage -- Algorithm selection, key management
|
|
404
|
+
6. Third-party integrations -- Data sharing, authentication
|
|
405
|
+
7. Error handling -- Information leakage, fail-secure behavior
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
BestPractices {
|
|
409
|
+
- Perform threat modeling before implementation
|
|
410
|
+
- Apply defense in depth (multiple security layers)
|
|
411
|
+
- Assume breach: design for detection and containment
|
|
412
|
+
- Automate security testing in CI/CD
|
|
413
|
+
- Keep dependencies updated and audited
|
|
414
|
+
- Document security decisions and accepted risks
|
|
415
|
+
- Train developers on secure coding practices
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
## References
|
|
420
|
+
|
|
421
|
+
- [Security Review Checklist](checklists/security-review-checklist.md) - Comprehensive security review checklist
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Security Review Checklist
|
|
2
|
+
|
|
3
|
+
Comprehensive checklist for security-focused code review, architecture assessment, and infrastructure validation. Use this checklist systematically during security assessments.
|
|
4
|
+
|
|
5
|
+
## Threat Modeling
|
|
6
|
+
|
|
7
|
+
### STRIDE Analysis
|
|
8
|
+
|
|
9
|
+
- [ ] Spoofing threats identified and mitigated
|
|
10
|
+
- [ ] Tampering threats identified and mitigated
|
|
11
|
+
- [ ] Repudiation threats identified and mitigated
|
|
12
|
+
- [ ] Information disclosure threats identified and mitigated
|
|
13
|
+
- [ ] Denial of service threats identified and mitigated
|
|
14
|
+
- [ ] Elevation of privilege threats identified and mitigated
|
|
15
|
+
|
|
16
|
+
### Attack Surface
|
|
17
|
+
|
|
18
|
+
- [ ] All entry points documented (APIs, UIs, file uploads, webhooks)
|
|
19
|
+
- [ ] Trust boundaries identified between components
|
|
20
|
+
- [ ] Data flows mapped with sensitivity classifications
|
|
21
|
+
- [ ] Third-party integrations assessed for risk
|
|
22
|
+
- [ ] Unused features and endpoints disabled or removed
|
|
23
|
+
|
|
24
|
+
### Threat Actors
|
|
25
|
+
|
|
26
|
+
- [ ] Relevant threat actors identified (external, internal, privileged)
|
|
27
|
+
- [ ] Attacker capabilities and motivations considered
|
|
28
|
+
- [ ] High-value targets identified and prioritized
|
|
29
|
+
- [ ] Attack scenarios documented for critical paths
|
|
30
|
+
|
|
31
|
+
## Authentication
|
|
32
|
+
|
|
33
|
+
### Credential Handling
|
|
34
|
+
|
|
35
|
+
- [ ] Passwords hashed with strong algorithm (bcrypt, argon2, scrypt)
|
|
36
|
+
- [ ] Appropriate cost factor configured for hashing
|
|
37
|
+
- [ ] Password requirements enforce length over complexity
|
|
38
|
+
- [ ] No maximum password length restrictions below 64 characters
|
|
39
|
+
- [ ] Passwords not logged or exposed in error messages
|
|
40
|
+
|
|
41
|
+
### Session Management
|
|
42
|
+
|
|
43
|
+
- [ ] Session tokens generated with cryptographic randomness
|
|
44
|
+
- [ ] Session tokens have sufficient entropy (128+ bits)
|
|
45
|
+
- [ ] Sessions invalidated on logout
|
|
46
|
+
- [ ] Sessions invalidated on password change
|
|
47
|
+
- [ ] Session timeout configured appropriately
|
|
48
|
+
- [ ] Session tokens regenerated after authentication
|
|
49
|
+
|
|
50
|
+
### Multi-Factor Authentication
|
|
51
|
+
|
|
52
|
+
- [ ] MFA available for sensitive operations
|
|
53
|
+
- [ ] MFA recovery options are secure
|
|
54
|
+
- [ ] MFA bypass conditions documented and minimized
|
|
55
|
+
- [ ] TOTP implementation uses standard algorithms
|
|
56
|
+
|
|
57
|
+
### Brute Force Protection
|
|
58
|
+
|
|
59
|
+
- [ ] Account lockout or progressive delays implemented
|
|
60
|
+
- [ ] Rate limiting on authentication endpoints
|
|
61
|
+
- [ ] Lockout notifications sent to account owner
|
|
62
|
+
- [ ] CAPTCHA or proof-of-work for suspicious activity
|
|
63
|
+
|
|
64
|
+
## Authorization
|
|
65
|
+
|
|
66
|
+
### Access Control
|
|
67
|
+
|
|
68
|
+
- [ ] Authorization checks performed on every request
|
|
69
|
+
- [ ] Authorization enforced server-side, not client-side
|
|
70
|
+
- [ ] Default deny: access requires explicit grant
|
|
71
|
+
- [ ] Principle of least privilege applied to all roles
|
|
72
|
+
- [ ] Separation of duties for sensitive operations
|
|
73
|
+
|
|
74
|
+
### Resource Access
|
|
75
|
+
|
|
76
|
+
- [ ] Users cannot access other users' resources by ID manipulation
|
|
77
|
+
- [ ] Direct object references validated against ownership
|
|
78
|
+
- [ ] Batch operations validate authorization for all items
|
|
79
|
+
- [ ] File access restricted to authorized directories
|
|
80
|
+
- [ ] API responses filtered to authorized data only
|
|
81
|
+
|
|
82
|
+
### Administrative Functions
|
|
83
|
+
|
|
84
|
+
- [ ] Administrative endpoints require elevated authentication
|
|
85
|
+
- [ ] Administrative actions logged with user attribution
|
|
86
|
+
- [ ] Privilege escalation paths audited and minimized
|
|
87
|
+
- [ ] Role assignments require appropriate authorization
|
|
88
|
+
|
|
89
|
+
## Input Validation
|
|
90
|
+
|
|
91
|
+
### General Input Handling
|
|
92
|
+
|
|
93
|
+
- [ ] All input validated server-side
|
|
94
|
+
- [ ] Validation uses allowlist approach (not blocklist)
|
|
95
|
+
- [ ] Input length limits enforced
|
|
96
|
+
- [ ] Input type validation enforced
|
|
97
|
+
- [ ] Validation errors do not reveal internal details
|
|
98
|
+
|
|
99
|
+
### Injection Prevention
|
|
100
|
+
|
|
101
|
+
- [ ] SQL queries use parameterized statements
|
|
102
|
+
- [ ] NoSQL queries properly escaped or use ODM
|
|
103
|
+
- [ ] OS commands avoided; if necessary, input validated against allowlist
|
|
104
|
+
- [ ] LDAP queries properly escaped
|
|
105
|
+
- [ ] XPath queries properly escaped
|
|
106
|
+
- [ ] Template injection prevented
|
|
107
|
+
|
|
108
|
+
### File Handling
|
|
109
|
+
|
|
110
|
+
- [ ] File uploads validate type by content, not extension
|
|
111
|
+
- [ ] File uploads have size limits
|
|
112
|
+
- [ ] Uploaded files stored outside web root
|
|
113
|
+
- [ ] Uploaded filenames sanitized
|
|
114
|
+
- [ ] Path traversal prevented in file operations
|
|
115
|
+
- [ ] File downloads validate user authorization
|
|
116
|
+
|
|
117
|
+
### XML Processing
|
|
118
|
+
|
|
119
|
+
- [ ] External entity processing disabled (XXE prevention)
|
|
120
|
+
- [ ] DTD processing disabled if not required
|
|
121
|
+
- [ ] XML parser configured with resource limits
|
|
122
|
+
|
|
123
|
+
## Cryptography
|
|
124
|
+
|
|
125
|
+
### Data Protection
|
|
126
|
+
|
|
127
|
+
- [ ] Sensitive data encrypted at rest
|
|
128
|
+
- [ ] TLS 1.2+ enforced for data in transit
|
|
129
|
+
- [ ] Certificate validation not disabled
|
|
130
|
+
- [ ] Strong cipher suites configured
|
|
131
|
+
|
|
132
|
+
### Algorithm Selection
|
|
133
|
+
|
|
134
|
+
- [ ] No deprecated algorithms (MD5, SHA1, DES, RC4)
|
|
135
|
+
- [ ] Appropriate key sizes (AES-256, RSA-2048+)
|
|
136
|
+
- [ ] Cryptographic library from reputable source
|
|
137
|
+
- [ ] Random number generation uses secure source
|
|
138
|
+
|
|
139
|
+
### Key Management
|
|
140
|
+
|
|
141
|
+
- [ ] Keys stored in secure location (HSM, secret manager)
|
|
142
|
+
- [ ] Keys not hardcoded in source code
|
|
143
|
+
- [ ] Key rotation process defined
|
|
144
|
+
- [ ] Key backup and recovery procedures in place
|
|
145
|
+
|
|
146
|
+
## Error Handling and Logging
|
|
147
|
+
|
|
148
|
+
### Error Messages
|
|
149
|
+
|
|
150
|
+
- [ ] Error messages do not expose stack traces
|
|
151
|
+
- [ ] Error messages do not reveal system architecture
|
|
152
|
+
- [ ] Error messages do not expose sensitive data
|
|
153
|
+
- [ ] Generic messages for authentication failures
|
|
154
|
+
|
|
155
|
+
### Security Logging
|
|
156
|
+
|
|
157
|
+
- [ ] Authentication events logged (success and failure)
|
|
158
|
+
- [ ] Authorization failures logged
|
|
159
|
+
- [ ] Input validation failures logged
|
|
160
|
+
- [ ] Administrative actions logged
|
|
161
|
+
- [ ] Security-relevant configuration changes logged
|
|
162
|
+
|
|
163
|
+
### Log Protection
|
|
164
|
+
|
|
165
|
+
- [ ] Logs do not contain passwords or tokens
|
|
166
|
+
- [ ] Logs do not contain full credit card numbers
|
|
167
|
+
- [ ] Logs do not contain other sensitive PII inappropriately
|
|
168
|
+
- [ ] Log integrity protected (append-only, signed)
|
|
169
|
+
- [ ] Log access restricted and audited
|
|
170
|
+
|
|
171
|
+
### Alerting
|
|
172
|
+
|
|
173
|
+
- [ ] Alerts configured for repeated authentication failures
|
|
174
|
+
- [ ] Alerts configured for anomalous access patterns
|
|
175
|
+
- [ ] Alerts configured for privilege escalation attempts
|
|
176
|
+
- [ ] Alert fatigue considered (appropriate thresholds)
|
|
177
|
+
|
|
178
|
+
## API Security
|
|
179
|
+
|
|
180
|
+
### Endpoint Security
|
|
181
|
+
|
|
182
|
+
- [ ] All non-public endpoints require authentication
|
|
183
|
+
- [ ] CORS configured to allow only trusted origins
|
|
184
|
+
- [ ] HTTP methods restricted appropriately
|
|
185
|
+
- [ ] Sensitive operations use POST/PUT/DELETE, not GET
|
|
186
|
+
- [ ] API versioning strategy does not expose deprecated endpoints
|
|
187
|
+
|
|
188
|
+
### Rate Limiting
|
|
189
|
+
|
|
190
|
+
- [ ] Rate limits configured per user/IP
|
|
191
|
+
- [ ] Rate limits appropriate for endpoint cost
|
|
192
|
+
- [ ] Rate limit responses include retry-after header
|
|
193
|
+
- [ ] Rate limit bypass not possible through header manipulation
|
|
194
|
+
|
|
195
|
+
### Data Exposure
|
|
196
|
+
|
|
197
|
+
- [ ] API responses do not include unnecessary fields
|
|
198
|
+
- [ ] Pagination prevents mass data extraction
|
|
199
|
+
- [ ] Bulk endpoints have appropriate limits
|
|
200
|
+
- [ ] Error responses do not expose internal details
|
|
201
|
+
|
|
202
|
+
## Infrastructure Security
|
|
203
|
+
|
|
204
|
+
### Network Configuration
|
|
205
|
+
|
|
206
|
+
- [ ] Internal services not exposed to public internet
|
|
207
|
+
- [ ] Network segmentation limits lateral movement
|
|
208
|
+
- [ ] Firewall rules follow least privilege
|
|
209
|
+
- [ ] Egress traffic restricted to known destinations
|
|
210
|
+
|
|
211
|
+
### Container Security
|
|
212
|
+
|
|
213
|
+
- [ ] Base images from trusted sources
|
|
214
|
+
- [ ] Images scanned for vulnerabilities
|
|
215
|
+
- [ ] Containers run as non-root
|
|
216
|
+
- [ ] Container capabilities minimized
|
|
217
|
+
- [ ] Read-only root filesystem where possible
|
|
218
|
+
|
|
219
|
+
### Cloud Security
|
|
220
|
+
|
|
221
|
+
- [ ] IAM follows principle of least privilege
|
|
222
|
+
- [ ] Service accounts have minimal permissions
|
|
223
|
+
- [ ] Cloud storage buckets not publicly accessible
|
|
224
|
+
- [ ] Cloud audit logging enabled
|
|
225
|
+
- [ ] Infrastructure changes require review
|
|
226
|
+
|
|
227
|
+
### Secrets Management
|
|
228
|
+
|
|
229
|
+
- [ ] Secrets stored in secret manager (not config files)
|
|
230
|
+
- [ ] Secrets injected at runtime, not build time
|
|
231
|
+
- [ ] Secret access audited
|
|
232
|
+
- [ ] Secret rotation automated where possible
|
|
233
|
+
|
|
234
|
+
## Dependency Management
|
|
235
|
+
|
|
236
|
+
### Vulnerability Management
|
|
237
|
+
|
|
238
|
+
- [ ] Dependencies tracked in manifest file
|
|
239
|
+
- [ ] Dependency versions pinned
|
|
240
|
+
- [ ] Known vulnerabilities checked regularly
|
|
241
|
+
- [ ] Process for responding to critical vulnerabilities
|
|
242
|
+
- [ ] Automated scanning in CI/CD pipeline
|
|
243
|
+
|
|
244
|
+
### Supply Chain Security
|
|
245
|
+
|
|
246
|
+
- [ ] Dependencies from official sources
|
|
247
|
+
- [ ] Package integrity verified (checksums, signatures)
|
|
248
|
+
- [ ] Typosquatting risk considered
|
|
249
|
+
- [ ] Transitive dependencies reviewed
|
|
250
|
+
|
|
251
|
+
## CI/CD Security
|
|
252
|
+
|
|
253
|
+
### Pipeline Security
|
|
254
|
+
|
|
255
|
+
- [ ] CI/CD credentials stored securely
|
|
256
|
+
- [ ] Pipeline definitions reviewed for security
|
|
257
|
+
- [ ] Build artifacts signed or checksummed
|
|
258
|
+
- [ ] Deployment requires review/approval
|
|
259
|
+
|
|
260
|
+
### Code Review
|
|
261
|
+
|
|
262
|
+
- [ ] Security review required for sensitive changes
|
|
263
|
+
- [ ] Automated security scanning (SAST) in pipeline
|
|
264
|
+
- [ ] Dynamic security testing (DAST) for web applications
|
|
265
|
+
- [ ] Secrets scanning prevents credential commits
|
|
266
|
+
|
|
267
|
+
## Usage Notes
|
|
268
|
+
|
|
269
|
+
1. Apply this checklist during security-focused code reviews
|
|
270
|
+
2. Not all items apply to every review - use judgment based on context
|
|
271
|
+
3. Document exceptions with security rationale
|
|
272
|
+
4. Update this checklist as new threats emerge
|
|
273
|
+
5. Combine with automated tools for comprehensive coverage
|
|
274
|
+
6. Prioritize findings by risk (likelihood x impact)
|
|
275
|
+
7. Track remediation and verify fixes
|
|
276
|
+
|
|
277
|
+
## Risk Rating Guide
|
|
278
|
+
|
|
279
|
+
When documenting findings, use this risk rating:
|
|
280
|
+
|
|
281
|
+
- **Critical**: Immediate exploitation possible, severe impact
|
|
282
|
+
- **High**: Likely exploitation, significant impact
|
|
283
|
+
- **Medium**: Exploitation requires conditions, moderate impact
|
|
284
|
+
- **Low**: Exploitation difficult, limited impact
|
|
285
|
+
- **Informational**: Best practice deviation, no direct risk
|