Personal data sent in a request header or to an AI model API
A user's email, phone or ID number goes into a request header or an AI prompt, so it is copied into logs and vendor storage you don't control.
- Severity
- Medium
- Who can exploit it
- Everyone who can read your CDN, host, APM or AI provider logs, and anyone who breaches them
- Found by
- PatchLabs Code: request headers and AI model calls in your code (JS, TS and Python)
- Lab proof
- Not lab-proven: file and line in the report
What it is
Two habits put personal data where your database rules don't reach. The first is a request header that carries it, such as "X-User-Email": user.email. Headers can be written to CDN, proxy, load balancer and APM logs, which are kept for weeks or months and read by more people and vendors than your database.
The second is a prompt that carries it: `Patient ${patient.full_name}, born ${patient.date_of_birth}`, or JSON.stringify(profile) sent as a message. The AI provider keeps prompts for abuse monitoring, and gateways, tracing and eval tools in between often keep them too. PL-037 flags both.
Why AI builders produce it
Both are the fastest fix that works. “The server doesn’t know who’s calling” becomes a header; “the model needs context” becomes the whole record pasted in. Nothing breaks, so nobody looks again.
Example of vulnerable code
Simplified from the patterns we see in AI-built apps. Synthetic: not taken from any real app.
// src/lib/api.ts
const res = await fetch("/api/orders", {
headers: { "Content-Type": "application/json", "X-User-Email": user.email },
});
// supabase/functions/summarize/index.ts
const completion = await openai.chat.completions.create({
model: "gpt-5-mini",
messages: [
{ role: "user", content: `Patient ${patient.full_name}, born ${patient.date_of_birth}` },
{ role: "user", content: JSON.stringify(profile) },
],
});
Check it yourself
# the free, open-source scanner (reads the repo as text, sends nothing)
uvx --from git+https://github.com/manra399/patchlabs-cli patchlabs scan .
# or by hand
grep -rnE "['\"]X-[A-Za-z-]*(Email|Phone|Name|Address|Dob)['\"]" --exclude-dir=node_modules .
grep -rnE "JSON\.stringify\((user|profile|customer|patient)" --exclude-dir=node_modules .
The fix
// headers: send nothing personal; the server reads the user from the session
const res = await fetch("/api/orders", {
headers: { "Content-Type": "application/json", Authorization: `Bearer ${session.access_token}` },
});
// prompts: send only what the task needs, with placeholders
const notes = redact(patient.visit_notes); // strip names, emails, phone and ID numbers
const completion = await openai.chat.completions.create({
model: "gpt-5-mini",
messages: [
{ role: "system", content: "Refer to the person as [PATIENT]." },
{ role: "user", content: notes },
],
});
Then check your AI provider’s retention and training settings for your account, and whether your tracing tool stores prompt text. The guide walks through both, with the Uber and Fireworks AI breach as the example of what a vendor copy costs.
Code findings come with the file, the line and a one-line fix in the report, for your engineer to make. PatchLabs never pushes to your repo.
Ask your AI builder to fix it
Built with Lovable, Bolt, Replit or Cursor? Paste this into the chat. It asks for this one fix and nothing else, and to see the change before it’s applied. Read the change, or have your engineer read it, before you accept.
My app puts users' personal data (email, phone, name, address, date of birth or ID numbers) into request headers or into prompts sent to an AI model. Find every place that does this. For headers, remove the personal values and have the server read the signed-in user from the session instead. For AI calls, send only the fields each task needs, replace names and contact details with placeholders before the call, and never send a whole user record with JSON.stringify. List each change you made. Show me the exact change before you apply it, and don't change anything else.
Then check again with the free open-source CLI (patchlabs scan .), or run the full free check on your repo.
How PatchLabs finds it
[SCAN] supabase/functions/summarize/index.ts:11 full_name, date_of_birth, national_insurance in prompt LEAK [FIX] send only the fields the task needs
PatchLabs Code reads the headers your code sets and the lines around each AI model call. ID, health, card and bank fields are high, contact fields medium. Opaque ids, example.com addresses, commented-out lines and code that reads the model’s answer are not flagged. It never calls your app or the model.
When the pattern is intended
Some features need a personal detail, such as an assistant that drafts an email to a named customer. That can be fine when it is a decision: write down which fields go, check the provider’s retention terms, say so in your privacy notice, and keep the fields out of tracing.
Why it’s rated medium
Medium for contact details, high for ID numbers, health, card or bank data: nobody reads it straight away, but the copies outlive your own controls and leak when a vendor is breached.
Related findings
Service role key in client code
The key that ignores every access rule, shipped to every visitor's browser.
PL-022Edge function trusts a user id sent in the request
The function acts on whichever user id the request names, so any user can act as any other.
PL-009AI, payment or database key in the code
A secret key for an AI, payment or database service is sitting in your current code, readable by anyone who can read the repo.
Guides
- Your users’ personal data is probably in your headers and your AI prompts. Here’s where it ends up.
- Letting Claude drive your Supabase through MCP when the database holds patient data
Free check
Does your app have PL-037?
Paste your public repo. PatchLabs Code reads it for this and every other code finding, and the Lab rebuilds your database to test who can read what.
Last reviewed 10 Nov 2026. Finding IDs are stable: link to them freely. Spotted a mistake? Tell us.