Data minimization — only necessary context sent to AI
Why it matters
GDPR Article 5(1)(c) codifies the data minimization principle: personal data must be adequate, relevant, and limited to what is necessary for the processing purpose. CCPA §1798.100 establishes parallel minimization expectations. When a developer serializes a full user object into an AI prompt — including email, hashed password, billing address, internal IDs, and account metadata — fields that have no bearing on the AI's task travel to the provider. The AI does not need the user's email to write a support reply. It does not need their created_at timestamp to summarize a document. Every unnecessary field is data shared without purpose, creating regulatory exposure and expanding the blast radius of any future provider breach.
Severity rationale
Medium because full-object serialization into AI prompts sends unnecessary personal data to a third-party processor in violation of GDPR Art. 5(1)(c), but the harm requires a downstream event (breach, subpoena) to materialize.
Remediation
Build an explicit, minimal prompt context object rather than serializing the full user or database record. Document which fields each AI feature actually requires.
// Instead of:
const context = JSON.stringify(user) // Sends email, hash, billing, internal IDs
// Use:
const context = JSON.stringify({
name: user.firstName,
plan: user.subscriptionTier,
// Only fields the AI prompt template actually references
})
Create a dedicated buildAiContext(user: User): AiUserContext function in lib/ai/context.ts that exports a typed, narrowed object. This makes it easy to audit what is being sent and prevents accidental field additions when the User model grows. Review the exported fields whenever new columns are added to the user record.
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)(c) — Data minimisation
- ccpa · §1798.100 — Limitation on collection of personal information
- nist-ai-rmf:1.0 · MAP 1.5 — Organisational context for AI system input data scope
- cwe · CWE-359 — Exposure of Private Personal Information to an Unauthorized Actor
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-data-privacy·automated