# AI Data Leakage Prevention: How to Stop Sensitive Data From Reaching AI Tools and Enforce AI Usage Policy

> AI data leakage prevention at the gateway: redact PII and secrets, block prompt injection, log every decision, and give employees an approved AI tool.

Source: <https://tetrate.io/learn/ai/stop-sensitive-data-leaking-into-ai-tools>

_Last updated: October 2026_

AI data leakage prevention at the gateway works in two steps. First, give employees an approved AI tool that is easier to use than a personal one. Second, check every request to that tool at the gateway, hide or block PII and secrets, and record every decision for audit. One limit applies: a gateway can only control AI traffic that passes through the gateway. A gateway cannot stop an employee from pasting a contract into a personal chatbot on a personal phone.

## Employees use personal AI tools when the company tools are slower to get

Employees use personal AI tools when the company offers nothing, or when the company tool takes weeks to get access to. The fix has three parts, and the gateway is only one of them:

| Part | What the part does | Who owns the part |
| ----------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| Approved tools that are easy to get | SSO sign-in, a gateway key in minutes, a catalog of approved models | Platform team, via the [Developer On-Ramp](https://tetrate.io/developer-on-ramp) |
| Network and endpoint controls | Block or monitor consumer AI domains on managed devices | Security and IT |
| Enforcement on the approved tools | Guardrails, budgets, audit logs at the gateway | Platform team, via [AI Guardrails](https://tetrate.io/products/ai-guardrails) |

Skip the approved-tools part, and people keep using personal tools. Tetrate’s post on [keeping marketers away from Fable](https://tetrate.io/blog/keeping-marketers-away-from-fable) shows how to route a desktop AI app through the gateway. Non-developers then have an approved tool too.

## How AI guardrails prevent data leakage: each request is checked inline, then redacted or blocked

In [Tetrate Agent Router Enterprise](https://tetrate.io/agent-router-product), guardrails run inside the Envoy proxy as a dynamic module. The [guardrails architecture page](https://docs.tetrate.ai/product-architecture/guardrails) describes five stages. The module stops the request, checks each rule, applies the action, checks the response before it returns, and records the decision. A blocked prompt never reaches the provider, so the provider never sees the content and never bills for the request.

Each rule has a check type, a provider that runs the check, an action, and a mode:

| Setting | Options | Meaning |
| ------------ | ------------------------------------------------------------------- | ----------------------------------------------------------- |
| Check type | pii, secrets, regexp, prompt\_injection, jailbreak, and 18 others | What the rule looks for |
| Provider | regexp, builtin, tetrate, Azure AI Content Safety, external service | What engine runs the check |
| Action | redact or block | Hide the matching text and forward, or refuse with HTTP 403 |
| Mode | enforce or monitor | Apply the action, or only log what would have happened |
| Failure mode | fail\_close (default) or fail\_open | What to do when the check engine times out |

The [guardrails reference](https://docs.tetrate.ai/reference/guardrails) lists all 23 check types and 14 templates, including Baseline PII Protection, GDPR EU PII Protection, Singapore PDPA, and Healthcare Claims. Templates default to `redact` and `monitor`.

## Start with PII and secrets on the input stage

The [guide to detecting and redacting sensitive data](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/safety-and-data-protection/detect-and-redact-sensitive-data) covers the first rules to create. The `pii` check covers names, emails, phone numbers, national IDs, payment cards, and IBANs. The `secrets` check covers AWS, GitHub, and Slack credentials, generic API keys, and tokens. The `regexp` check handles formats specific to your organization, such as internal ticket IDs or account numbers. A shared pattern list has more than 80 built-in patterns.

Latency depends on the provider. The `regexp` and `builtin` providers add close to zero milliseconds and make no network call. The `tetrate` provider runs ML classifiers on your own cluster and adds 40 to 120 ms. Azure AI Content Safety adds about 200 ms and sends content to Microsoft. Run fast checks first, so a match ends the evaluation before the slow check runs.

## Coding assistants need their own project and a secrets rule

Claude Code, GitHub Copilot, Cursor, Continue, and Cline send source code and configuration files to models. Source code contains credentials more often than chat prompts do. The [guide to protecting coding assistant traffic](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/safety-and-data-protection/protect-coding-assistant-traffic) recommends a separate project per tool, with per-tool API keys. Then add a guardrail with the `secrets` check on the input stage. Guardrails are scoped to a project, so separation comes from which project a key belongs to. GitHub Copilot chat and agent mode in VS Code reach the gateway through the [Tetrate VS Code extension](https://docs.tetrate.ai/agent-router-service/guides/coding-agents/vscode). The same `secrets` rule then catches credentials in Copilot prompts before the prompts leave the machine. Inline Copilot completions use GitHub’s own model service.

Azure AI Foundry agents that send traffic through the gateway keep Microsoft’s content filters and safety systems on the Foundry side. The customer owns those filters. Gateway guardrails add PII and secrets checks on the same requests.

## Prompt injection detection starts in monitor mode, then moves to enforce

The `prompt_injection` and `jailbreak` checks catch instructions hidden in retrieved documents or tool outputs that try to make the model ignore the system prompt. Detection uses patterns and likelihood scores, and the [prompt injection guide](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/safety-and-data-protection/detect-and-block-prompt-injection) explains how to tune the sensitivity. Run the rule in monitor mode first, review what the rule would have caught, and adjust the sensitivity before you switch to enforce. For how input filters work across regex, classifiers, PII, and blocklists, see [LLM input filtering](https://tetrate.io/learn/ai/llm-input-filtering).

## Audit logs and SIEM export prove AI usage policy enforcement to an auditor

An auditor needs a record of each decision. Agent Router Enterprise records two streams:

1. The [audit log](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/compliance-and-governance/audit-platform-activity) captures every administrative change: for example, who created a key or changed a guardrail. Entries cannot be edited or deleted by any user.
2. Policy decisions carry one of four outcomes (Allow, Deny, Modify, Redact) with a correlation ID, the caller identity, the model, and the policy version. Both streams [export to a SIEM](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/compliance-and-governance/export-audit-and-policy-decisions-to-a-siem) such as Splunk, Datadog, or Amazon S3.

The [request log settings](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/compliance-and-governance/control-request-log-data) offer three modes: Full, Metadata only, and Off. Metadata only keeps token counts and cost and drops the bodies. Metadata only is the common choice for regulated data. For everything else the platform stores, and what you can turn off, see [AI gateway security](https://tetrate.io/learn/ai/ai-gateway-security-sso-private-networks-encryption-data).

## Identity comes from SSO, so policy attaches to real people

Agent Router Enterprise [signs in through OIDC only](https://docs.tetrate.ai/agent-router-enterprise/guides/identity-and-access-management/single-sign-on/sso-configuration-guide). There is no local password database. Entra ID, Okta, Google Workspace, Auth0, Keycloak, and Ping are documented. Group claims from the identity provider map to roles, teams, and budgets. A policy for the Finance group then applies to whoever is listed in Finance in the directory.

## Five setup tips extend data leakage protection to every path

1. Route every company AI tool through the gateway. Apps change one base URL. For tools where a vendor picks the model, use a bring-your-own-model path, as shown in [which AI tools an AI gateway can govern](https://tetrate.io/learn/ai/which-ai-tools-can-an-ai-gateway-govern). Pair the gateway with network or endpoint controls for personal devices and personal accounts.
2. Guardrails check every LLM request, including any tool result placed inside the request as `tool` content. Control which MCP servers and tools each agent can reach with [MCP gateway profiles](https://tetrate.io/learn/ai/how-to-govern-mcp-server-traffic-with-an-mcp-gateway).
3. Apply each company-wide rule to every project, because each project carries its own guardrails.
4. Run ML-based checks in monitor mode first, and tune the sensitivity before you enforce.
5. Send the request log signal only to telemetry systems approved for prompt data, because that signal carries the full record in every request log mode.

## Frequently asked questions

**How do I keep employees off personal AI accounts?**Give people approved AI tools that route through the gateway and work well enough that people choose them. The gateway governs company AI traffic, and network or endpoint controls cover personal accounts.

**What is an AI guardrail?**A guardrail is a rule that inspects a request or response at the gateway. The rule checks for a type of content such as PII or secrets. The rule then redacts the content, blocks the request, or records the match.

**Does redaction send my data to a third party?**Regex and built-in checks run inside your gateway with no network call. Tetrate’s ML classifiers run on your own cluster. Only Azure AI Content Safety and external guardrail services send content outside.

**What is the difference between monitor mode and enforce mode?**Monitor mode logs what the rule would have done and changes nothing. Enforce mode applies the redact or block action. Roll out every new rule in monitor mode first.

**How do I prove to an auditor what the gateway blocked?**Export policy decisions and the audit log to your SIEM. Each decision carries a correlation ID, the verdict, the policy version, and the caller identity.

**Do guardrails cover MCP tool traffic?**No. MCP traffic is not inspected by content guardrails. MCP requests are governed by server approval, tool selection, identity, and audit. Guardrails run on LLM requests only, and they check a tool result only when the result is placed inside an LLM request.

**How much latency do AI guardrails add?**Regex and built-in checks add close to zero milliseconds. Tetrate’s ML classifiers add 40 to 120 milliseconds. Azure AI Content Safety adds about 200 milliseconds.

**Does a blocked prompt get billed by the provider?**No. A blocked prompt never reaches the provider, so the provider never sees the content and never bills for the request.

**Does the gateway store prompts and responses?**That depends on the request log mode. Full mode stores prompt and response bodies. Metadata only keeps token counts and cost and drops the bodies. Off stores no request log.

## Related reading

- [AI Guardrails](https://tetrate.io/products/ai-guardrails) product page
- [LLM Input Filtering](https://tetrate.io/learn/ai/llm-input-filtering) — four filter types for prompt injection and PII
- [AI Governance](https://tetrate.io/solutions/ai-governance) solution page
- [AI Governance Framework](https://tetrate.io/learn/ai/ai-governance-frameworks) in the Learning Center
- [Agent Security: What NIST Wants You to Think About Before Your Agent Calls a Tool](https://tetrate.io/blog/agent-security-tool-calling)
- [Guardrails best practices and FAQ](https://docs.tetrate.ai/reference/best-practices/guardrails-best-practices-and-faq) in the docs
- [About guardrails](https://docs.tetrate.ai/agent-router-enterprise/guides/operate-and-govern/safety-and-data-protection/about-guardrails) in the docs
