arkaos 2.0.0 → 2.0.1
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 +100 -74
- package/VERSION +1 -1
- package/bin/arkaos +1 -1
- package/core/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/loader.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/validator.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/advisor_db.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/display.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/matcher.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/persistence.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/profiler.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/prompts.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/governance/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/governance/__pycache__/constitution.cpython-313.pyc +0 -0
- package/core/registry/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/registry/__pycache__/generator.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/base.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/claude_code.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/codex_cli.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/cursor.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/gemini_cli.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/registry.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/subagent.cpython-313.pyc +0 -0
- package/core/specs/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/specs/__pycache__/manager.cpython-313.pyc +0 -0
- package/core/specs/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/loader.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/registry.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/cache.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/engine.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
- package/core/tasks/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/tasks/__pycache__/manager.cpython-313.pyc +0 -0
- package/core/tasks/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/engine.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/loader.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/schema.cpython-313.pyc +0 -0
- package/departments/dev/skills/agent-design/SKILL.md +4 -0
- package/departments/dev/skills/agent-design/references/architecture-patterns.md +223 -0
- package/departments/dev/skills/ai-security/SKILL.md +4 -0
- package/departments/dev/skills/ai-security/references/prompt-injection-catalog.md +230 -0
- package/departments/dev/skills/ci-cd-pipeline/SKILL.md +4 -0
- package/departments/dev/skills/ci-cd-pipeline/references/github-actions-patterns.md +202 -0
- package/departments/dev/skills/db-schema/SKILL.md +4 -0
- package/departments/dev/skills/db-schema/references/indexing-strategy.md +197 -0
- package/departments/dev/skills/dependency-audit/SKILL.md +4 -0
- package/departments/dev/skills/dependency-audit/references/license-matrix.md +191 -0
- package/departments/dev/skills/incident/SKILL.md +4 -0
- package/departments/dev/skills/incident/references/severity-playbook.md +221 -0
- package/departments/dev/skills/observability/SKILL.md +4 -0
- package/departments/dev/skills/observability/references/slo-design.md +200 -0
- package/departments/dev/skills/rag-architect/SKILL.md +5 -0
- package/departments/dev/skills/rag-architect/references/chunking-strategies.md +129 -0
- package/departments/dev/skills/rag-architect/references/evaluation-guide.md +158 -0
- package/departments/dev/skills/red-team/SKILL.md +4 -0
- package/departments/dev/skills/red-team/references/mitre-attack-web.md +165 -0
- package/departments/dev/skills/security-audit/SKILL.md +4 -0
- package/departments/dev/skills/security-audit/references/owasp-2025-deep.md +409 -0
- package/departments/dev/skills/security-compliance/SKILL.md +117 -0
- package/departments/finance/skills/ciso-advisor/SKILL.md +4 -0
- package/departments/finance/skills/ciso-advisor/references/compliance-roadmap.md +172 -0
- package/departments/marketing/skills/programmatic-seo/SKILL.md +4 -0
- package/departments/marketing/skills/programmatic-seo/references/template-playbooks.md +289 -0
- package/departments/ops/skills/gdpr-compliance/SKILL.md +104 -0
- package/departments/ops/skills/iso27001/SKILL.md +113 -0
- package/departments/ops/skills/quality-management/SKILL.md +118 -0
- package/departments/ops/skills/risk-management/SKILL.md +120 -0
- package/departments/ops/skills/soc2-compliance/SKILL.md +120 -0
- package/departments/strategy/skills/cto-advisor/SKILL.md +4 -0
- package/departments/strategy/skills/cto-advisor/references/build-vs-buy-framework.md +190 -0
- package/installer/cli.js +13 -2
- package/installer/index.js +1 -2
- package/installer/migrate.js +123 -0
- package/installer/update.js +28 -15
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/core/agents/__pycache__/registry_gen.cpython-313.pyc +0 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
# OWASP Top 10 (2025) — Deep Reference
|
|
2
|
+
|
|
3
|
+
> Each vulnerability with code examples, testing methodology, automated tools, and impact.
|
|
4
|
+
|
|
5
|
+
## A01: Broken Access Control
|
|
6
|
+
|
|
7
|
+
**Impact:** Unauthorized data access, privilege escalation, account takeover.
|
|
8
|
+
|
|
9
|
+
### Vulnerable Code (Laravel)
|
|
10
|
+
|
|
11
|
+
```php
|
|
12
|
+
// DANGEROUS: No authorization check
|
|
13
|
+
public function show($id)
|
|
14
|
+
{
|
|
15
|
+
return User::findOrFail($id); // Any user can access any profile
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Fixed Code
|
|
20
|
+
|
|
21
|
+
```php
|
|
22
|
+
public function show($id)
|
|
23
|
+
{
|
|
24
|
+
$user = User::findOrFail($id);
|
|
25
|
+
$this->authorize('view', $user); // Policy-based authorization
|
|
26
|
+
return new UserResource($user);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Testing Methodology
|
|
31
|
+
|
|
32
|
+
- [ ] Test every endpoint with unauthenticated request
|
|
33
|
+
- [ ] Test with low-privilege user accessing high-privilege resources
|
|
34
|
+
- [ ] Modify object IDs in requests (IDOR testing)
|
|
35
|
+
- [ ] Test HTTP method override (GET vs POST vs PUT)
|
|
36
|
+
- [ ] Verify deny-by-default on new endpoints
|
|
37
|
+
|
|
38
|
+
**Tools:** Burp Autorize, OWASP ZAP Access Control plugin, custom auth matrix tests.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## A02: Cryptographic Failures
|
|
43
|
+
|
|
44
|
+
**Impact:** Data exposure, credential theft, compliance violations.
|
|
45
|
+
|
|
46
|
+
### Vulnerable Code
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
# DANGEROUS: Weak hashing, no salt
|
|
50
|
+
import hashlib
|
|
51
|
+
password_hash = hashlib.md5(password.encode()).hexdigest()
|
|
52
|
+
|
|
53
|
+
# DANGEROUS: Hardcoded encryption key
|
|
54
|
+
key = "mysecretkey12345"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Fixed Code
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
# SAFE: bcrypt with automatic salting
|
|
61
|
+
from passlib.hash import bcrypt
|
|
62
|
+
password_hash = bcrypt.hash(password)
|
|
63
|
+
|
|
64
|
+
# SAFE: Key from environment, proper algorithm
|
|
65
|
+
from cryptography.fernet import Fernet
|
|
66
|
+
key = os.environ['ENCRYPTION_KEY'] # Generated with Fernet.generate_key()
|
|
67
|
+
cipher = Fernet(key)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Checklist
|
|
71
|
+
|
|
72
|
+
- [ ] TLS 1.2+ on all connections (no fallback to TLS 1.0/1.1)
|
|
73
|
+
- [ ] Passwords hashed with bcrypt/argon2 (never MD5/SHA1)
|
|
74
|
+
- [ ] Sensitive data encrypted at rest (AES-256-GCM)
|
|
75
|
+
- [ ] No secrets in source code or environment variables in containers
|
|
76
|
+
- [ ] Certificate pinning for mobile apps
|
|
77
|
+
|
|
78
|
+
**Tools:** testssl.sh, SSLyze, git-secrets, TruffleHog.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## A03: Supply Chain Failures
|
|
83
|
+
|
|
84
|
+
**Impact:** Malicious code execution, data exfiltration via dependencies.
|
|
85
|
+
|
|
86
|
+
### Vulnerable Setup
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
// DANGEROUS: No lockfile, no integrity checks
|
|
90
|
+
{
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"lodash": "^4.0.0",
|
|
93
|
+
"my-internal-lib": "*"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Fixed Setup
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
// SAFE: Pinned versions, lockfile committed
|
|
102
|
+
{
|
|
103
|
+
"dependencies": {
|
|
104
|
+
"lodash": "4.17.21"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Plus: npm ci (not npm install), package-lock.json committed
|
|
108
|
+
// Plus: .npmrc with registry scope for internal packages
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Checklist
|
|
112
|
+
|
|
113
|
+
- [ ] Lockfiles committed and used in CI (`npm ci`, `composer install --no-dev`)
|
|
114
|
+
- [ ] Automated dependency scanning in CI pipeline
|
|
115
|
+
- [ ] SBOM (Software Bill of Materials) generated per release
|
|
116
|
+
- [ ] Internal package namespace reserved on public registries
|
|
117
|
+
- [ ] Signed commits and artifacts in CI/CD
|
|
118
|
+
|
|
119
|
+
**Tools:** npm audit, Snyk, Dependabot, Socket.dev, Renovate.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## A04: Injection
|
|
124
|
+
|
|
125
|
+
**Impact:** Data theft, data manipulation, complete system compromise.
|
|
126
|
+
|
|
127
|
+
### Vulnerable Code (SQL)
|
|
128
|
+
|
|
129
|
+
```php
|
|
130
|
+
// DANGEROUS: String concatenation in query
|
|
131
|
+
$users = DB::select("SELECT * FROM users WHERE email = '" . $request->email . "'");
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Fixed Code
|
|
135
|
+
|
|
136
|
+
```php
|
|
137
|
+
// SAFE: Parameterized query via Eloquent
|
|
138
|
+
$users = User::where('email', $request->input('email'))->get();
|
|
139
|
+
|
|
140
|
+
// SAFE: Parameterized raw query when needed
|
|
141
|
+
$users = DB::select("SELECT * FROM users WHERE email = ?", [$request->input('email')]);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Vulnerable Code (NoSQL)
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
// DANGEROUS: MongoDB operator injection
|
|
148
|
+
db.users.find({ username: req.body.username, password: req.body.password });
|
|
149
|
+
// Attacker sends: { "password": { "$gt": "" } }
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Fixed Code
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
// SAFE: Type-check and sanitize
|
|
156
|
+
const username = String(req.body.username);
|
|
157
|
+
const password = String(req.body.password);
|
|
158
|
+
db.users.find({ username, password: hashPassword(password) });
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Testing
|
|
162
|
+
|
|
163
|
+
- [ ] Test all inputs with SQL meta-characters (`'`, `"`, `;`, `--`)
|
|
164
|
+
- [ ] Test NoSQL operators in JSON inputs (`$gt`, `$ne`, `$regex`)
|
|
165
|
+
- [ ] Test OS command injection (`;`, `|`, `` ` ``)
|
|
166
|
+
- [ ] Test LDAP injection, XPath injection if applicable
|
|
167
|
+
|
|
168
|
+
**Tools:** SQLMap, Commix, Semgrep (SAST), OWASP ZAP (DAST).
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## A05: Security Misconfiguration
|
|
173
|
+
|
|
174
|
+
**Impact:** Information disclosure, unauthorized access, full compromise.
|
|
175
|
+
|
|
176
|
+
### Common Misconfigurations
|
|
177
|
+
|
|
178
|
+
| Misconfiguration | Risk | Fix |
|
|
179
|
+
|-----------------|------|-----|
|
|
180
|
+
| Debug mode in production | Stack traces expose internals | `APP_DEBUG=false`, custom error pages |
|
|
181
|
+
| Default credentials | Instant admin access | Force password change on first login |
|
|
182
|
+
| Directory listing enabled | Source code/config exposure | Disable in web server config |
|
|
183
|
+
| Unnecessary HTTP methods | PUT/DELETE on static content | Restrict methods per endpoint |
|
|
184
|
+
| Missing security headers | XSS, clickjacking, sniffing | Add all 6 security headers |
|
|
185
|
+
| Cloud storage public by default | Data breach | Private by default, explicit public |
|
|
186
|
+
|
|
187
|
+
### Security Headers (Complete Set)
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors 'none'
|
|
191
|
+
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
|
|
192
|
+
X-Content-Type-Options: nosniff
|
|
193
|
+
X-Frame-Options: DENY
|
|
194
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
195
|
+
Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=()
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Tools:** SecurityHeaders.com, Mozilla Observatory, Nikto, ScoutSuite (cloud).
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## A06: Vulnerable and Outdated Components
|
|
203
|
+
|
|
204
|
+
**Impact:** Known exploits applied automatically, zero-effort compromise.
|
|
205
|
+
|
|
206
|
+
### Automated Scanning Commands
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# JavaScript
|
|
210
|
+
npm audit --production
|
|
211
|
+
npx audit-ci --high
|
|
212
|
+
|
|
213
|
+
# PHP
|
|
214
|
+
composer audit
|
|
215
|
+
|
|
216
|
+
# Python
|
|
217
|
+
pip-audit
|
|
218
|
+
safety check
|
|
219
|
+
|
|
220
|
+
# Ruby
|
|
221
|
+
bundle audit check --update
|
|
222
|
+
|
|
223
|
+
# General
|
|
224
|
+
trivy fs . --severity HIGH,CRITICAL
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Policy
|
|
228
|
+
|
|
229
|
+
| Severity | Action | Timeline |
|
|
230
|
+
|----------|--------|----------|
|
|
231
|
+
| Critical (CVSS 9.0+) | Patch immediately | 24 hours |
|
|
232
|
+
| High (CVSS 7.0-8.9) | Patch urgently | 7 days |
|
|
233
|
+
| Medium (CVSS 4.0-6.9) | Patch in next sprint | 30 days |
|
|
234
|
+
| Low (CVSS 0.1-3.9) | Backlog | 90 days |
|
|
235
|
+
|
|
236
|
+
**Tools:** Dependabot, Renovate, Snyk, Trivy, OWASP Dependency-Check.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## A07: Authentication Failures
|
|
241
|
+
|
|
242
|
+
**Impact:** Account takeover, identity theft, unauthorized access.
|
|
243
|
+
|
|
244
|
+
### Vulnerable Code
|
|
245
|
+
|
|
246
|
+
```php
|
|
247
|
+
// DANGEROUS: No rate limiting, no MFA, weak session
|
|
248
|
+
Route::post('/login', function (Request $request) {
|
|
249
|
+
if (Auth::attempt($request->only('email', 'password'))) {
|
|
250
|
+
return response()->json(['token' => Str::random(40)]);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Fixed Code
|
|
256
|
+
|
|
257
|
+
```php
|
|
258
|
+
// SAFE: Rate limited, proper session management
|
|
259
|
+
Route::post('/login', function (LoginRequest $request) {
|
|
260
|
+
RateLimiter::hit('login:' . $request->ip(), 5); // 5 attempts per minute
|
|
261
|
+
|
|
262
|
+
if (Auth::attempt($request->validated())) {
|
|
263
|
+
$request->session()->regenerate(); // Prevent session fixation
|
|
264
|
+
if ($request->user()->mfa_enabled) {
|
|
265
|
+
return response()->json(['requires_mfa' => true]);
|
|
266
|
+
}
|
|
267
|
+
return response()->json(['token' => $request->user()->createToken('api')->plainTextToken]);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
throw ValidationException::withMessages(['email' => 'Invalid credentials.']);
|
|
271
|
+
})->middleware('throttle:5,1');
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Checklist
|
|
275
|
+
|
|
276
|
+
- [ ] Rate limiting on login (5 attempts/min), registration, password reset
|
|
277
|
+
- [ ] MFA available and enforced for admin accounts
|
|
278
|
+
- [ ] Session regeneration after login
|
|
279
|
+
- [ ] Secure cookie flags (HttpOnly, Secure, SameSite=Lax)
|
|
280
|
+
- [ ] Password policy (12+ chars, breach check via HIBP API)
|
|
281
|
+
- [ ] Account lockout after repeated failures (with notification)
|
|
282
|
+
|
|
283
|
+
**Tools:** Hydra, Burp Intruder, custom auth test suite.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## A08: Data Integrity Failures
|
|
288
|
+
|
|
289
|
+
**Impact:** Code execution via deserialization, CI/CD pipeline compromise, tampered updates.
|
|
290
|
+
|
|
291
|
+
### Vulnerable Code
|
|
292
|
+
|
|
293
|
+
```php
|
|
294
|
+
// DANGEROUS: Unvalidated deserialization
|
|
295
|
+
$data = unserialize($request->input('data'));
|
|
296
|
+
|
|
297
|
+
// DANGEROUS: Unsigned CI/CD pipeline
|
|
298
|
+
// .github/workflows/deploy.yml with no artifact verification
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Fixed Code
|
|
302
|
+
|
|
303
|
+
```php
|
|
304
|
+
// SAFE: Use JSON instead of native serialization
|
|
305
|
+
$data = json_decode($request->input('data'), true, 512, JSON_THROW_ON_ERROR);
|
|
306
|
+
|
|
307
|
+
// SAFE: Validate schema
|
|
308
|
+
$validated = Validator::make($data, [
|
|
309
|
+
'name' => 'required|string|max:255',
|
|
310
|
+
'quantity' => 'required|integer|min:1',
|
|
311
|
+
])->validated();
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Checklist
|
|
315
|
+
|
|
316
|
+
- [ ] Never use native deserialization on user input (PHP `unserialize`, Java `ObjectInputStream`)
|
|
317
|
+
- [ ] Signed artifacts in CI/CD pipeline
|
|
318
|
+
- [ ] Integrity verification for third-party data (checksums, signatures)
|
|
319
|
+
- [ ] Immutable infrastructure (no runtime modifications)
|
|
320
|
+
|
|
321
|
+
**Tools:** Semgrep (detect unsafe deserialization), Sigstore/cosign, CI/CD audit.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## A09: Logging and Monitoring Failures
|
|
326
|
+
|
|
327
|
+
**Impact:** Attacks go undetected, no forensic evidence, compliance failures.
|
|
328
|
+
|
|
329
|
+
### What to Log (Minimum)
|
|
330
|
+
|
|
331
|
+
| Event | Priority | Fields |
|
|
332
|
+
|-------|----------|--------|
|
|
333
|
+
| Authentication success/failure | High | user_id, IP, timestamp, user_agent |
|
|
334
|
+
| Authorization failures | High | user_id, resource, action, IP |
|
|
335
|
+
| Input validation failures | Medium | endpoint, input_field, violation_type |
|
|
336
|
+
| Payment transactions | High | amount, user_id, status, transaction_id |
|
|
337
|
+
| Admin actions | High | admin_id, action, target, before/after |
|
|
338
|
+
| Rate limit hits | Medium | IP, endpoint, limit_type |
|
|
339
|
+
|
|
340
|
+
### What NOT to Log
|
|
341
|
+
|
|
342
|
+
- Passwords (even hashed)
|
|
343
|
+
- Full credit card numbers (log last 4 only)
|
|
344
|
+
- Session tokens or API keys
|
|
345
|
+
- PII beyond what is needed for investigation
|
|
346
|
+
|
|
347
|
+
**Tools:** ELK Stack, Loki+Grafana, Datadog, Sentry (errors).
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## A10: Exceptional Conditions (Server-Side Request Forgery)
|
|
352
|
+
|
|
353
|
+
**Impact:** Internal network scanning, cloud metadata theft, service abuse.
|
|
354
|
+
|
|
355
|
+
### Vulnerable Code
|
|
356
|
+
|
|
357
|
+
```python
|
|
358
|
+
# DANGEROUS: User-controlled URL fetched server-side
|
|
359
|
+
import requests
|
|
360
|
+
url = request.args.get('url')
|
|
361
|
+
response = requests.get(url) # Attacker can reach internal services
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Fixed Code
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
# SAFE: URL allowlist + block internal ranges
|
|
368
|
+
from urllib.parse import urlparse
|
|
369
|
+
import ipaddress
|
|
370
|
+
|
|
371
|
+
ALLOWED_HOSTS = {'api.example.com', 'cdn.example.com'}
|
|
372
|
+
|
|
373
|
+
def safe_fetch(url):
|
|
374
|
+
parsed = urlparse(url)
|
|
375
|
+
if parsed.hostname not in ALLOWED_HOSTS:
|
|
376
|
+
raise ValueError("Host not in allowlist")
|
|
377
|
+
# Resolve DNS and verify IP is not internal
|
|
378
|
+
ip = socket.gethostbyname(parsed.hostname)
|
|
379
|
+
if ipaddress.ip_address(ip).is_private:
|
|
380
|
+
raise ValueError("Internal IP not allowed")
|
|
381
|
+
return requests.get(url, timeout=5, allow_redirects=False)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Checklist
|
|
385
|
+
|
|
386
|
+
- [ ] URL allowlist for server-side requests
|
|
387
|
+
- [ ] Block RFC1918 and link-local addresses
|
|
388
|
+
- [ ] Disable HTTP redirects in server-side requests
|
|
389
|
+
- [ ] Network segmentation (web servers cannot reach metadata endpoints)
|
|
390
|
+
- [ ] Cloud metadata endpoint blocked (169.254.169.254)
|
|
391
|
+
|
|
392
|
+
**Tools:** SSRFmap, Burp Collaborator, custom SSRF test payloads.
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## Vulnerability Severity Quick Reference
|
|
397
|
+
|
|
398
|
+
| Vulnerability | Typical CVSS | Business Impact |
|
|
399
|
+
|--------------|-------------|-----------------|
|
|
400
|
+
| A01 Broken Access Control | 7.5-9.8 | Data breach, regulatory fines |
|
|
401
|
+
| A02 Cryptographic Failures | 7.0-9.1 | Data exposure, compliance failure |
|
|
402
|
+
| A03 Supply Chain | 8.0-10.0 | Full system compromise |
|
|
403
|
+
| A04 Injection | 8.6-10.0 | Data theft, system takeover |
|
|
404
|
+
| A05 Misconfiguration | 5.0-8.0 | Information disclosure, unauthorized access |
|
|
405
|
+
| A06 Vulnerable Components | Varies (known CVE) | Depends on component |
|
|
406
|
+
| A07 Auth Failures | 7.0-9.8 | Account takeover, identity theft |
|
|
407
|
+
| A08 Data Integrity | 6.0-9.8 | Code execution, pipeline compromise |
|
|
408
|
+
| A09 Logging Failures | 4.0-6.0 | Undetected attacks, no forensics |
|
|
409
|
+
| A10 SSRF | 7.0-9.8 | Internal network access, cloud compromise |
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dev/security-compliance
|
|
3
|
+
description: >
|
|
4
|
+
Security audit preparation, ISMS gap analysis, control assessment, and ISO 27001 certification support for engineering teams.
|
|
5
|
+
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch, WebSearch]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Security Compliance — `/dev security-compliance`
|
|
9
|
+
|
|
10
|
+
> **Agent:** Bruno (Security Engineer) | **Framework:** ISO 27001 Audit, ISMS Assessment, ISO 27002
|
|
11
|
+
|
|
12
|
+
## Audit Readiness Assessment
|
|
13
|
+
|
|
14
|
+
| Area | What to Verify | Evidence Required |
|
|
15
|
+
|------|---------------|-------------------|
|
|
16
|
+
| ISMS Scope | Scope document approved, boundaries defined | Signed scope statement |
|
|
17
|
+
| Security Policy | Policy current, signed by management, communicated | Signed policy, distribution records |
|
|
18
|
+
| Risk Assessment | Methodology defined, assessment completed | Risk register with owners |
|
|
19
|
+
| Statement of Applicability | All 93 Annex A controls addressed | SoA document |
|
|
20
|
+
| Access Control | Access reviews completed, least privilege enforced | Review logs, access matrices |
|
|
21
|
+
| Change Management | All changes authorized, tested, approved | Change tickets, approval records |
|
|
22
|
+
| Incident Response | Plan documented, tested, team trained | IR plan, drill reports |
|
|
23
|
+
| Business Continuity | DR plan tested, RTO/RPO validated | DR test results |
|
|
24
|
+
| Security Awareness | Training completed, phishing tests run | Training records, test results |
|
|
25
|
+
| Supplier Security | Vendor assessments current, contracts include security | Assessment reports, DPAs |
|
|
26
|
+
|
|
27
|
+
## Gap Analysis Workflow
|
|
28
|
+
|
|
29
|
+
1. **Collect documentation** — Gather all ISMS policies, procedures, and records
|
|
30
|
+
2. **Map to clauses** — Verify each ISO 27001 clause (4-10) has documented evidence
|
|
31
|
+
3. **Assess Annex A** — Check each applicable control against SoA
|
|
32
|
+
4. **Test effectiveness** — Sample controls for operating evidence
|
|
33
|
+
5. **Score maturity** — Rate each area (0=Absent, 1=Initial, 2=Managed, 3=Defined, 4=Measured, 5=Optimizing)
|
|
34
|
+
6. **Produce gap report** — Prioritized findings with remediation recommendations
|
|
35
|
+
|
|
36
|
+
## Control Assessment by Domain
|
|
37
|
+
|
|
38
|
+
### Organizational Controls (A.5)
|
|
39
|
+
|
|
40
|
+
| Control | Check | Evidence |
|
|
41
|
+
|---------|-------|---------|
|
|
42
|
+
| A.5.1 Policies | Published, reviewed annually | Policy register, review records |
|
|
43
|
+
| A.5.2 Roles | IS responsibilities defined | Job descriptions, RACI |
|
|
44
|
+
| A.5.3 Segregation | Conflicting duties separated | Access matrix |
|
|
45
|
+
| A.5.23 Cloud security | Cloud usage governed | Cloud security policy |
|
|
46
|
+
|
|
47
|
+
### Technological Controls (A.8)
|
|
48
|
+
|
|
49
|
+
| Control | Check | Evidence |
|
|
50
|
+
|---------|-------|---------|
|
|
51
|
+
| A.8.1 Endpoints | Endpoints protected and managed | EDR dashboard, config |
|
|
52
|
+
| A.8.5 Authentication | MFA enforced, strong passwords | IAM config, policy |
|
|
53
|
+
| A.8.9 Config management | Baseline configs, hardening | CIS benchmarks, scans |
|
|
54
|
+
| A.8.15 Logging | Security events logged centrally | SIEM config, log samples |
|
|
55
|
+
| A.8.24 Cryptography | Encryption at rest and transit | TLS config, key management |
|
|
56
|
+
|
|
57
|
+
## Finding Classification
|
|
58
|
+
|
|
59
|
+
| Severity | Definition | Response Time | Certification Impact |
|
|
60
|
+
|----------|-----------|---------------|---------------------|
|
|
61
|
+
| Major NC | Control failure creating significant risk | 30 days | Blocks certification |
|
|
62
|
+
| Minor NC | Isolated deviation with limited impact | 90 days | Must resolve before next audit |
|
|
63
|
+
| Observation | Improvement opportunity, not a failure | Next audit cycle | Noted, no action required |
|
|
64
|
+
|
|
65
|
+
## Technical Security Verification
|
|
66
|
+
|
|
67
|
+
| Area | Automated Check | Tool |
|
|
68
|
+
|------|----------------|------|
|
|
69
|
+
| Dependencies | Known CVE scan | `npm audit` / `composer audit` / `pip-audit` |
|
|
70
|
+
| Secrets | Leaked credentials in code | `gitleaks detect` |
|
|
71
|
+
| Infrastructure | Misconfiguration scan | CIS benchmarks, cloud security tools |
|
|
72
|
+
| Network | Open ports, TLS config | `nmap`, `testssl.sh` |
|
|
73
|
+
| Application | OWASP Top 10 vulnerabilities | DAST/SAST scanners |
|
|
74
|
+
|
|
75
|
+
## Proactive Triggers
|
|
76
|
+
|
|
77
|
+
Surface these issues WITHOUT being asked:
|
|
78
|
+
|
|
79
|
+
- Penetration test older than 12 months or never conducted -> flag as A.8.8 control gap requiring immediate scheduling
|
|
80
|
+
- Missing security policies (IS policy, access control, acceptable use) -> flag as A.5.1 nonconformity blocking certification
|
|
81
|
+
- No incident response plan or plan never tested -> flag as A.5.24-A.5.28 gap creating unmanaged breach risk
|
|
82
|
+
|
|
83
|
+
## Output
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
## Security Compliance Assessment: <project/organization>
|
|
87
|
+
|
|
88
|
+
### Overall Maturity: X/5 — <Maturity Level>
|
|
89
|
+
|
|
90
|
+
### Clause Compliance (ISO 27001)
|
|
91
|
+
| Clause | Status | Maturity | Gaps |
|
|
92
|
+
|--------|--------|----------|------|
|
|
93
|
+
|
|
94
|
+
### Annex A Control Status
|
|
95
|
+
- Applicable controls: X/93
|
|
96
|
+
- Implemented: X | Partial: X | Missing: X
|
|
97
|
+
|
|
98
|
+
### Critical Findings
|
|
99
|
+
- [F1] Severity — Control Ref — Description — Remediation
|
|
100
|
+
|
|
101
|
+
### Technical Scan Results
|
|
102
|
+
- Dependency vulnerabilities: X critical, X high
|
|
103
|
+
- Secrets detected: X
|
|
104
|
+
- Misconfigurations: X
|
|
105
|
+
|
|
106
|
+
### Certification Readiness: X%
|
|
107
|
+
### Estimated Time to Certification: X months
|
|
108
|
+
|
|
109
|
+
### Remediation Roadmap
|
|
110
|
+
| Priority | Finding | Action | Owner | Target |
|
|
111
|
+
|----------|---------|--------|-------|--------|
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## References
|
|
115
|
+
|
|
116
|
+
- [iso27001-audit-methodology.md](references/iso27001-audit-methodology.md) — Audit program structure, risk-based scheduling, certification support procedures
|
|
117
|
+
- [security-control-testing.md](references/security-control-testing.md) — Technical verification procedures for ISO 27002 controls, evidence requirements
|
|
@@ -111,3 +111,7 @@ Surface these issues WITHOUT being asked:
|
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
## Output -> Obsidian: `WizardingCode/Finance/Security/CISO-<topic>-<date>.md`
|
|
114
|
+
|
|
115
|
+
## References
|
|
116
|
+
|
|
117
|
+
- [compliance-roadmap.md](references/compliance-roadmap.md) — SOC 2, ISO 27001, GDPR, HIPAA, PCI-DSS comparison with timelines, costs, control overlap matrix, and audit preparation checklist
|