Sensitive data is not leaked in AI responses
Why it matters
When server-side code passes raw database records — including user objects with hashed passwords, internal flags, or API credentials — into an AI prompt, that data becomes part of the inference context processed by an external third-party API. Even if the model does not echo the data verbatim, it may reference, paraphrase, or leak it in edge-case responses. GDPR Article 5(1)(c) (data minimization) requires that personal data is limited to what is necessary. CWE-200 (Exposure of Sensitive Information) and OWASP LLM06 (Sensitive Information Disclosure) both apply. Logging raw AI responses without access controls compounds the exposure by persisting the sensitive context to a log store.
Severity rationale
Medium because exploitation requires either an unusual model behavior or log access, but the data minimization violation is present in every request and violates GDPR Article 5(1)(c) regardless of observed leakage.
Remediation
Project only the fields needed for the task before passing data to the AI model:
// Before: full user object (includes hashed_password, internal_flags, api_key_hash)
const context = `User: ${JSON.stringify(user)}`
// After: explicit field selection
const context = `User display name: ${user.displayName}\nPlan: ${user.plan}`
Treat the AI API as an external third-party service — apply the same data minimization discipline you would before an external HTTP call. If logging AI responses for debugging, route them through a scrubber or store them behind access-controlled log infrastructure.
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 Response Quality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor
- owasp-llm:2025 · LLM06 — Excessive Agency
- gdpr · Art. 5(1)(c) — Data minimisation
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-response-quality·automated