Data Exposure Review
1 — Map sensitive data
From recon, identify what the project considers sensitive: PII (names, emails, phones, addresses), auth data (tokens, passwords, SSNs, card numbers), health/financial records, internal identifiers. Check models/schemas/DTOs for field names to build this list before grepping flows.
2 — Logs
rg -n "console\.(log|error|info)|logger\.(info|warn|error)|logging\.|print\(" | rg -i "password|token|secret|ssn|card|authorization|api.?key|session"
- Tokens/passwords/full PII logged → HIGH (logs ship to aggregators with broader access and longer retention than the DB)
- Full request/response bodies logged (debug middleware like morgan
dev+body, axios interceptors logging config) → HIGH if auth flows pass through
- Stack traces with SQL → MEDIUM
- Recommend structured logging with field-level redaction/allowlists.
- Deep A09 checks (audit-event coverage, log forging, verbosity, monitoring):
references/logging-a09.md.
3 — API responses
rg -n "res\.(json|send)\(|JSONResponse|serializer|to_json|to_dict|as_dict|@JsonProperty"
- Endpoints returning full ORM objects (
res.json(user) instead of a DTO) → HIGH when the model has password hashes, tokens, reset codes, or PII beyond need — even if "unused today"
to_json/__dict__ serialization on models with sensitive fields → same
- Over-returning list endpoints (100+ records/page without pagination) → LOW
- IDs that are sequential integers for sensitive objects → LOW/MEDIUM (enumeration, see
../auth-review/SKILL.md)
4 — Data at rest & in transit
- DB files / SQLite in repo or mounted volumes without encryption → MEDIUM (judged by data class)
- Backups/exports (
dump.sql, *.csv exports) committed → HIGH if real data, LOW if synthetic
- Sensitive data in URLs (GET query params:
?token=, ?email=, ?ssn=) → HIGH (URLs hit logs, proxies, browser history, referrers)
- Internal service calls over plain HTTP inside the cluster → MEDIUM
- Sensitive data sent to third parties (analytics/error trackers capture request bodies: Sentry
send_default_pii, loggers to SaaS) → MEDIUM/HIGH
5 — Files, history, fixtures
git ls-files | rg -i '\.(sql|csv|xlsx?|dump|bak|sqlite3?|db)$'
rg -n -i "lorem|john.?doe|test@test|555-|4111 ?1111 ?1111 ?1111|0000-0000" tests/ fixtures/ 2>/dev/null | head -20
- Real-looking PII in fixtures/tests (real emails, real card numbers beyond obvious test patterns) → MEDIUM
- Git history secrets — already covered by
../secrets-detection/SKILL.md; here verify large data files aren't in history: git rev-list --objects --all | head + look for big blobs
- Temp files written to shared/world-readable locations,
/tmp with predictable names → MEDIUM
TODO/FIXME near data handling mentioning "encrypt"/"hash later" → report as confirmation of known debt
6 — Compliance overlays (optional, if project context implies)
If the stack/domain implies a regime, add a short mapping section: GDPR (lawful basis hints, right-to-erasure reachability of PII), HIPAA (PHI at rest/in transit), PCI-DSS (card data scope). Keep it a checklist of "likely gaps" — not legal advice — and recommend expert review.
Reporting
Per finding: data class involved, where it's exposed (file:line), exposure path (logs/response/history), severity by data class, and the fix (redact, DTO-allowlist, encrypt, purge). Include a one-paragraph "sensitive data inventory" summary — teams usually don't have one and it's instantly useful.
1---2name: data-exposure3description: Finds sensitive data exposure risks — PII/secrets written to logs, over-returning API responses, data at rest without encryption, sensitive data in URLs, test fixtures with real data, secrets in git history, and temporary/backup file leaks. Use when auditing how a project handles, stores, logs, or transmits sensitive data.4license: MIT5metadata:6 source: https://skillmd.com/skills/jiayaoqijia/data-exposure7---89# Data Exposure Review1011## 1 — Map sensitive data1213From recon, identify what the project considers sensitive: PII (names, emails, phones, addresses), auth data (tokens, passwords, SSNs, card numbers), health/financial records, internal identifiers. Check models/schemas/DTOs for field names to build this list before grepping flows.1415## 2 — Logs1617```bash18rg -n "console\.(log|error|info)|logger\.(info|warn|error)|logging\.|print\(" | rg -i "password|token|secret|ssn|card|authorization|api.?key|session"19```20- Tokens/passwords/full PII logged → HIGH (logs ship to aggregators with broader access and longer retention than the DB)21- Full request/response bodies logged (debug middleware like morgan `dev`+body, axios interceptors logging config) → HIGH if auth flows pass through22- Stack traces with SQL → MEDIUM23- Recommend structured logging with field-level redaction/allowlists.24- Deep A09 checks (audit-event coverage, log forging, verbosity, monitoring): `references/logging-a09.md`.2526## 3 — API responses2728```bash29rg -n "res\.(json|send)\(|JSONResponse|serializer|to_json|to_dict|as_dict|@JsonProperty"30```31- Endpoints returning full ORM objects (`res.json(user)` instead of a DTO) → HIGH when the model has password hashes, tokens, reset codes, or PII beyond need — even if "unused today"32- `to_json`/`__dict__` serialization on models with sensitive fields → same33- Over-returning list endpoints (100+ records/page without pagination) → LOW34- IDs that are sequential integers for sensitive objects → LOW/MEDIUM (enumeration, see `../auth-review/SKILL.md`)3536## 4 — Data at rest & in transit3738- DB files / SQLite in repo or mounted volumes without encryption → MEDIUM (judged by data class)39- Backups/exports (`dump.sql`, `*.csv` exports) committed → HIGH if real data, LOW if synthetic40- Sensitive data in URLs (GET query params: `?token=`, `?email=`, `?ssn=`) → HIGH (URLs hit logs, proxies, browser history, referrers)41- Internal service calls over plain HTTP inside the cluster → MEDIUM42- Sensitive data sent to third parties (analytics/error trackers capture request bodies: Sentry `send_default_pii`, loggers to SaaS) → MEDIUM/HIGH4344## 5 — Files, history, fixtures4546```bash47git ls-files | rg -i '\.(sql|csv|xlsx?|dump|bak|sqlite3?|db)$'48rg -n -i "lorem|john.?doe|test@test|555-|4111 ?1111 ?1111 ?1111|0000-0000" tests/ fixtures/ 2>/dev/null | head -2049```50- Real-looking PII in fixtures/tests (real emails, real card numbers beyond obvious test patterns) → MEDIUM51- Git history secrets — already covered by `../secrets-detection/SKILL.md`; here verify large data files aren't in history: `git rev-list --objects --all | head` + look for big blobs52- Temp files written to shared/world-readable locations, `/tmp` with predictable names → MEDIUM53- `TODO`/`FIXME` near data handling mentioning "encrypt"/"hash later" → report as confirmation of known debt5455## 6 — Compliance overlays (optional, if project context implies)5657If the stack/domain implies a regime, add a short mapping section: GDPR (lawful basis hints, right-to-erasure reachability of PII), HIPAA (PHI at rest/in transit), PCI-DSS (card data scope). Keep it a checklist of "likely gaps" — not legal advice — and recommend expert review.5859## Reporting6061Per finding: data class involved, where it's exposed (`file:line`), exposure path (logs/response/history), severity by data class, and the fix (redact, DTO-allowlist, encrypt, purge). Include a one-paragraph "sensitive data inventory" summary — teams usually don't have one and it's instantly useful.