security.md
65 lines · review/specialists/security.md at 3f79d81
1# Security Specialist Review Checklist
3Scope: When SCOPE_AUTH=true OR (SCOPE_BACKEND=true AND diff > 100 lines)
4Output: JSON objects, one finding per line. Schema:
5{"severity":"CRITICAL|INFORMATIONAL","confidence":N,"path":"file","line":N,"category":"security","summary":"...","fix":"...","fingerprint":"path:line:security","specialist":"security"}
6Optional: line, fix, fingerprint, evidence, test_stub.
7If no findings: output `NO FINDINGS` and nothing else.
9---
11This checklist goes deeper than the main CRITICAL pass. The main agent already checks SQL injection, race conditions, LLM trust, and enum completeness. This specialist focuses on auth/authz patterns, cryptographic misuse, and attack surface expansion.
Security Specialist Review Checklist
Scope: When SCOPE_AUTH=true OR (SCOPE_BACKEND=true AND diff > 100 lines) Output: JSON objects, one finding per line. Schema: {"severity":"CRITICAL|INFORMATIONAL","confidence":N,"path":"file","line":N,"category":"security","summary":"...","fix":"...","fingerprint":"path:line:security","specialist":"security"} Optional: line, fix, fingerprint, evidence, test_stub. If no findings: output NO FINDINGS and nothing else.
This checklist goes deeper than the main CRITICAL pass. The main agent already checks SQL injection, race conditions, LLM trust, and enum completeness. This specialist focuses on auth/authz patterns, cryptographic misuse, and attack surface expansion.
Raw lines 1 to 12Categories
Raw lines 13 to 1415### Input Validation at Trust Boundaries
16- User input accepted without validation at controller/handler level
17- Query parameters used directly in database queries or file paths
18- Request body fields accepted without type checking or schema validation
19- File uploads without type/size/content validation
20- Webhook payloads processed without signature verification
Input Validation at Trust Boundaries
- User input accepted without validation at controller/handler level
- Query parameters used directly in database queries or file paths
- Request body fields accepted without type checking or schema validation
- File uploads without type/size/content validation
- Webhook payloads processed without signature verification
22### Auth & Authorization Bypass
23- Endpoints missing authentication middleware (check route definitions)
24- Authorization checks that default to "allow" instead of "deny"
25- Role escalation paths (user can modify their own role/permissions)
26- Direct object reference vulnerabilities (user A accesses user B's data by changing an ID)
27- Session fixation or session hijacking opportunities
28- Token/API key validation that doesn't check expiration
29- Error pages that leak past a correct guard: the shared 403/404/500 renderer builds its body outside the authorization path, so a blocked request still returns internal names, counts or navigation the role must not see. Read the error template and its context builder, not just the guard
30- Ownership that survives a role downgrade: a grant recorded at creation still opens the object after the user's role is reduced and they sign in again. Ownership must be re-checked against the current role on every read
31- List, detail and file/download access to one object audited as a single entry: each usually resolves the object through a different code path, so check each against the role matrix separately
32- Account or identity switch that clears, regenerates or rebinds the session before validating the callback's single-use state value: any forced navigation to that URL logs the user out (CSRF). Also check the denied, cancelled and error branches, where leaving the prior session live keeps the user acting as the previous identity
Auth & Authorization Bypass
- Endpoints missing authentication middleware (check route definitions)
- Authorization checks that default to "allow" instead of "deny"
- Role escalation paths (user can modify their own role/permissions)
- Direct object reference vulnerabilities (user A accesses user B's data by changing an ID)
- Session fixation or session hijacking opportunities
- Token/API key validation that doesn't check expiration
- Error pages that leak past a correct guard: the shared 403/404/500 renderer builds its body outside the authorization path, so a blocked request still returns internal names, counts or navigation the role must not see. Read the error template and its context builder, not just the guard
- Ownership that survives a role downgrade: a grant recorded at creation still opens the object after the user's role is reduced and they sign in again. Ownership must be re-checked against the current role on every read
- List, detail and file/download access to one object audited as a single entry: each usually resolves the object through a different code path, so check each against the role matrix separately
- Account or identity switch that clears, regenerates or rebinds the session before validating the callback's single-use state value: any forced navigation to that URL logs the user out (CSRF). Also check the denied, cancelled and error branches, where leaving the prior session live keeps the user acting as the previous identity
34### Injection Vectors (beyond SQL)
35- Command injection via subprocess calls with user-controlled arguments
36- Template injection (Jinja2, ERB, Handlebars) with user input
37- LDAP injection in directory queries
38- SSRF via user-controlled URLs (fetch, redirect, webhook targets)
39- Path traversal via user-controlled file paths (../../etc/passwd)
40- Header injection via user-controlled values in HTTP headers
Injection Vectors (beyond SQL)
- Command injection via subprocess calls with user-controlled arguments
- Template injection (Jinja2, ERB, Handlebars) with user input
- LDAP injection in directory queries
- SSRF via user-controlled URLs (fetch, redirect, webhook targets)
- Path traversal via user-controlled file paths (../../etc/passwd)
- Header injection via user-controlled values in HTTP headers
42### Cryptographic Misuse
43- Weak hashing algorithms (MD5, SHA1) for security-sensitive operations
44- Predictable randomness (Math.random, rand()) for tokens or secrets
45- Non-constant-time comparisons (==) on secrets, tokens, or digests
46- Hardcoded encryption keys or IVs
47- Missing salt in password hashing
Cryptographic Misuse
- Weak hashing algorithms (MD5, SHA1) for security-sensitive operations
- Predictable randomness (Math.random, rand()) for tokens or secrets
- Non-constant-time comparisons (==) on secrets, tokens, or digests
- Hardcoded encryption keys or IVs
- Missing salt in password hashing
49### Secrets Exposure
50- API keys, tokens, or passwords in source code (even in comments)
51- Secrets logged in application logs or error messages
52- Credentials in URLs (query parameters or basic auth in URL)
53- Sensitive data in error responses returned to users
54- PII stored in plaintext when encryption is expected
Secrets Exposure
- API keys, tokens, or passwords in source code (even in comments)
- Secrets logged in application logs or error messages
- Credentials in URLs (query parameters or basic auth in URL)
- Sensitive data in error responses returned to users
- PII stored in plaintext when encryption is expected
56### XSS via Escape Hatches
57- Rails: .html_safe, raw() on user-controlled data
58- React: dangerouslySetInnerHTML with user content
59- Vue: v-html with user content
60- Django: |safe, mark_safe() on user input
61- General: innerHTML assignment with unsanitized data
XSS via Escape Hatches
- Rails: .html_safe, raw() on user-controlled data
- React: dangerouslySetInnerHTML with user content
- Vue: v-html with user content
- Django: |safe, mark_safe() on user input
- General: innerHTML assignment with unsanitized data
63### Deserialization
64- Deserializing untrusted data (pickle, Marshal, YAML.load, JSON.parse of executable types)
65- Accepting serialized objects from user input or external APIs without schema validation
Deserialization
- Deserializing untrusted data (pickle, Marshal, YAML.load, JSON.parse of executable types)
- Accepting serialized objects from user input or external APIs without schema validation