Skip to content
Dashboard

How AI data leakage happens in apps and agents

AI data leakage happens when an app or agent exposes sensitive information to a person or system that shouldn't receive it. Data can leak through prompts, logs, overly broad credentials, document retrieval, and model answers.

Suppose a support agent needs only an order number to answer a question. It instead sends the entire customer record to a third-party model. The agent had permission to read the record, but the model didn't need the customer's address or contact details. Sending only the order number would have avoided that exposure.

Copy link to headingWhen is AI data leakage a data breach?

Under the European Data Protection Board's guidance on the General Data Protection Regulation (GDPR), unauthorized disclosure of or access to personal data may constitute a personal data breach. That includes accidental disclosures that don't involve a break-in. The examples below show how two incidents can start and what evidence can help you investigate.

What to compare

AI app sends a customer record to an unapproved service

Someone gains unauthorized access to a database

How it starts

The app includes the record in a routine model request.

Someone signs in with stolen credentials.

Where the data is exposed

The model provider receives the record in the request.

The signed-in account gives the intruder access to customer records.

What to check

Which fields the app sent and which provider received them

Which account signed in and which records it accessed

Either incident can trigger notification duties. Assess what happened, what data was involved, and which rules apply. The fact that a request looked routine doesn't settle whether the disclosure was authorized.

Copy link to headingWhere AI data leakage happens

Copy link to headingPrompts sent to model providers

A third-party model provider receives the prompts and context your app sends. That includes any credentials you put in a system prompt. System prompts give the model instructions; keep secrets and access rules outside them.

Check training and retention separately for the product, model, endpoint, and features you use. OpenAI, for example, may train on content from individual ChatGPT accounts and lets users opt out. Its API doesn't use customer data for foundation model training by default. Abuse monitoring logs can still contain prompt or response content, and some features store application state. Zero data retention (ZDR) can require approval and may not cover every feature.

Copy link to headingPrompt logs and caches

Logs, traces, and caches can keep copies of prompts and answers after the request ends. A support ticket captured while debugging can still be readable months later if the team keeps the log that long. A cached answer can also expose protected data if the app serves it to a user who wasn't authorized to receive it.

Copy link to headingAgent credentials that exceed the task

An agent that only needs to read one file can reach more data if you give it a developer's token with access to an entire repository. Even after the task ends, a credential that hasn't expired or been revoked can still grant access.

Copy link to headingDocument retrieval that ignores permissions

Retrieval-augmented generation (RAG) adds relevant passages from a document index to the model's prompt. If an index contains both employee handbooks and private board minutes, a search for the company's holiday policy could surface a relevant passage from the minutes. An employee who can't read the minutes shouldn't receive that passage in an answer.

Copy link to headingModel answers that expose data

A model may return sensitive material from its context or training data. Check answers for sensitive content before returning them and treat generated output as untrusted. Disable automatic loading of remote images and other external resources unless your app explicitly allows them. Output checks can miss sensitive material, so use them alongside access controls and input redaction.

Copy link to headingBest practices to prevent AI data leakage

Copy link to headingMinimize and redact data before it reaches the model

Build the prompt from the fields the task needs. If a field contains both useful and sensitive information, redact the sensitive parts before sending it. Automated redaction can miss sensitive information, so limit which fields enter the prompt even when you use a detector.

Copy link to headingGive agents short-lived, task-scoped credentials

Give agents only the permissions they need. Use a dedicated identity or narrowly scoped delegated access, and prefer short-lived credentials where the provider supports them. Keep development and preview credentials separate from production. Enforce authorization within the service performing the action, using the authenticated user's permissions when the agent acts on their behalf.

Copy link to headingEnforce permissions at retrieval time

Check document permissions at retrieval time before a passage reaches the model. Use the authenticated identity from your server. Keep access rules in the index or check permissions against the source. Deny access if you can't confirm permission. Keep tenants' data separate, and ensure retrieval honors permission revocations at the source.

Copy link to headingSet retention limits for model requests, logs, and caches

Check whether the model features you use support ZDR. For your own logs, store request metadata rather than full content by default. Redact sensitive fields before writing logs, restrict who can read them, and set expiration periods for logs and caches. If you need full content for debugging, limit access and set a deletion deadline before you start capturing it. If you cache answers, make sure users can't receive each other's protected data from the cache.

Copy link to headingTest and monitor for leaks

Use synthetic data for your tests. Check that users can't retrieve each other's documents, that agents can't access records outside their scope, and that prompts and answers stay out of routine logs. Review who can read the test logs. Repeat the checks when you change a model, prompt, tool, or data source.

Copy link to headingHow Vercel helps teams reduce AI data leakage

Copy link to headingScope runtime credentials with Vercel Connect

Vercel Connect lets server-side code request credentials at runtime from linked projects and environments. A project link controls who can request the credential. The provider controls what that credential can do. Choose the narrowest app or delegated user access the provider supports. Use separate connectors and provider installations when environments need separate grants. For OAuth connectors that support refresh, Connect handles it with the provider. An API key connector uses the static key you supply, so requesting it at runtime doesn't make it short-lived.

Copy link to headingRequire sign-in with Vercel Passport

Vercel Passport is an Enterprise feature that requires visitors to sign in through your identity provider before they can access a protected deployment. Read the verified visitor identity in server-side code and use it to enforce access to records and actions. If you forward the identity token to another backend, verify it there against the expected source.

Copy link to headingSet retention and region rules with Vercel AI Gateway

AI Gateway records request metadata. It doesn't retain prompts or responses after a request completes. Provider retention is separate. When ZDR routing applies, the request fails if no eligible provider can serve the model. Check eligibility, rules for your own provider keys, and exceptions for provider tools, short-lived caches, and abuse review. Disallowing prompt training is a separate control.

Regional inference pins supported model inference and any associated provider storage at rest to your chosen region. You can pin one region per request. On paid Pro or Enterprise plans, you can configure a team-wide pin with fallback regions. A request-level pin must stay within any team-wide pin. If AI Gateway can't serve the model within the applicable pin, the request fails.

Regional hosting is a separate setting in beta that controls whether requests enter AI Gateway in the US or EU. Check the exceptions before using either setting to meet a residency requirement. Search tools run by AI Gateway and provider safety reviews can send data outside the inference region. Gateway request logs, usage, and billing records are stored in the US.

Copy link to headingIsolate untrusted code with Vercel Sandbox

Vercel Sandbox runs each sandbox in a Firecracker microVM with its own kernel. Outbound internet access is allowed by default. Use the Sandbox firewall to deny outbound access if the task doesn't need a network connection. Otherwise, allow only the destinations it needs. With credentials brokering, the firewall adds credentials to matching outbound requests without placing the credential values inside the microVM. Limit what those credentials can do and explicitly reject requests you don't want the workload to make.

Notion uses Vercel Sandbox to run custom code for Notion Custom Agents through Notion Workers. Each Worker runs in its own microVM with a separate filesystem and network stack.

Copy link to headingClose the leak paths before your next AI deploy

Before you deploy, review what your app sends to the model and who can read the data your agent retrieves.

These Vercel features cover different parts of the data path:

  • Runtime credentials with Vercel Connect: Request provider credentials from linked environments and use narrow OAuth access where the connector supports it.

  • Sign-in with Vercel Passport: Require sign-in via your identity provider before a visitor can access a protected deployment.

  • Retention and region controls in AI Gateway: Require ZDR for eligible model routes and pin supported inference to an allowed region.

  • Isolated code execution with Vercel Sandbox: Run code in a microVM, restrict outbound traffic, and add credentials through the firewall where needed.

  • Write-only values with Secret environment variables: Use the Secret type for credentials you need to inject into a trusted runtime. Secret values become write-only after saving, including in Development. Existing Sensitive variables continue to work as Secrets.

Start a new Vercel project and route your first model request through AI Gateway, or browse AI app templates for a starting point.

Copy link to headingFrequently asked questions about AI data leakage

Copy link to headingDoes GDPR apply to AI data leakage?

Under the GDPR breach notification guidance, Article 33 requires controllers to document every personal data breach. If the breach is unlikely to pose a risk to people's rights and freedoms, the controller doesn't have to notify the competent supervisory authority. Otherwise, the controller must notify the authority without undue delay and, where feasible, within 72 hours of becoming aware of the breach. Article 34 generally requires informing affected people without undue delay when the breach is likely to pose a high risk, subject to the exceptions in that article.

Copy link to headingWhat should you do if sensitive data has already leaked to an AI tool?

Contain the exposure and revoke or rotate exposed credentials. Record what was shared and when, and check whether the provider can delete any retained copies. Assess notification duties based on the data involved and the applicable rules.

Copy link to headingHow do you find shadow AI tools in your organization?

If employees use AI tools outside your approval process, review corporate Domain Name System (DNS), proxy, and firewall logs for connections to known AI services. Review sign-in records, app grants, and expenses as well. These records can point to tool use, but they can't establish what someone shared or rule out use on personal accounts or devices. Give employees an approved option and explain what data they can send to it.

Copy link to headingCan you send patient data to an AI tool under HIPAA?

Under the Health Insurance Portability and Accountability Act (HIPAA), a covered entity generally needs a written business associate agreement or another permitted written arrangement before sharing protected health information (PHI) with an AI provider that acts as its business associate. The agreement sets limits on use and disclosure and requires safeguards. Apply the relevant HIPAA technical safeguards, including access and audit controls and transmission security. If unsecured PHI is breached, assess the applicable duties to notify affected individuals.

Reference Architecture

Choose a stack and work through the decisions behind it, with curated documentation, guides, templates, and courses to help you build.

  • Agent stack: Build and operate agents with models, tools, and durable workflows.
  • Web applications: Choose rendering, data, authentication, and caching approaches.
  • Backends: Choose a runtime, connect services, and run background work.

Browse all stacks

Build with prompts

Build an app, extend an agent, or improve your project with ready-to-use prompts for your coding agent.

Ready to deploy?