No wildcard request body logging for AI calls
Why it matters
CWE-532 (Insertion of Sensitive Information into Log File), OWASP A09 (Security Logging and Monitoring Failures), and GDPR Article 5(1)(f) (integrity and confidentiality) all apply when wildcard HTTP request body logging captures AI prompt content. HTTP interceptors configured to log all outgoing request bodies are a common debugging pattern — axios interceptors, custom fetch wrappers, and Node.js http module overrides — that developers add during development and forget to remove or scope. In an AI application, these interceptors will capture every prompt sent to the AI provider and write it to whatever log sink is configured, regardless of sensitivity.
Severity rationale
Low because wildcard request logging is typically a forgotten debugging artifact rather than an intentional disclosure, but it creates an ongoing passive exfiltration of all AI prompt content to the log sink.
Remediation
If you have a custom fetch wrapper or HTTP interceptor around AI API calls, restrict it to logging metadata only — never the request body.
// lib/ai/fetch-client.ts
async function aiApiFetch(url: string, init: RequestInit) {
const start = Date.now()
const response = await fetch(url, init)
// Log only metadata — never init.body or response body
console.log('AI API call:', {
path: new URL(url).pathname,
status: response.status,
latencyMs: Date.now() - start
})
return response
}
Search the codebase for request.body, req.body, init.body, and JSON.stringify(.*messages) in any file that wraps or intercepts outgoing HTTP requests. If wildcard body logging exists only inside a NODE_ENV === 'development' guard, verify the guard is present and tested in CI.
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
- cwe · CWE-532 — Insertion of Sensitive Information into Log File
- owasp:2021 · A09 — Security Logging and Monitoring Failures
- gdpr · Art. 5(1)(f) — Integrity and confidentiality — preventing prompt content in logs
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-data-privacy·automated