No PII or prompt content in application logs
Why it matters
GDPR Article 5(1)(f) requires that personal data be processed with appropriate security, including protection against unauthorized access — which includes log aggregation services. CWE-532 (Insertion of Sensitive Information into Log File) and OWASP A09 (Security Logging and Monitoring Failures) both apply when prompt content ends up in application logs. Application logs typically flow to third-party aggregators like Datadog, Logtail, or Better Stack, each with their own access controls, retention windows, and breach surfaces. When a developer logs console.log({ messages, model }) during a debugging session and forgets to remove it, every user prompt written since is now stored in a system with weaker controls than the primary database.
Severity rationale
High because prompt content in persistent logs constitutes an unauthorized third-party disclosure under GDPR Art. 5(1)(f) and CWE-532, multiplying the number of parties that hold user data without consent.
Remediation
Replace full-payload logging with metadata-only logging in every AI API call handler. Log enough to debug failures; never log what users said.
// Before (unsafe):
console.log('AI request:', { messages, model })
// After (safe):
console.log('AI request:', {
model,
messageCount: messages.length,
estimatedTokens: estimateTokens(messages),
requestId: crypto.randomUUID()
})
For Sentry or similar error reporters, scrub before attaching context:
try {
await callAiProvider(messages)
} catch (error) {
Sentry.captureException(error, {
extra: { context: 'AI generation failed', model }
// NOT: prompt, messages, userInput
})
throw error
}
Audit every console.log, logger.info, and logger.debug call in your AI pipeline and remove any that include the messages array or user input string.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Data Privacy Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 5(1)(f) — Integrity and confidentiality
- cwe · CWE-532 — Insertion of Sensitive Information into Log File
- owasp:2021 · A09 — Security Logging and Monitoring Failures
- nist:rev5 · AU-3 — Content of audit records — avoiding sensitive data in logs
- soc2:2017 · CC6.7 — Restriction of information transmission, movement, and removal
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-data-privacy·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.7) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2