7 min read · Updated 2 Nov 2026
How to stop employees pasting secrets into ChatGPT, without banning AI
In short: Banning AI pushes people to their phones. Here's a practical set of controls that lets your team keep using ChatGPT, Claude and Gemini while keys, passwords and customer data stay inside the company.
Every team using AI assistants pastes things into them that shouldn't leave the company: an API key inside a config file, a database URL with the password in it, a customer's name and email in a support ticket, a contract with a client's terms. Nobody does it on purpose. It's simply the fastest way to get help. Banning AI rarely works; people switch to personal accounts and phones, and you lose all visibility. A better goal is to let people use AI while the sensitive parts never reach it.
1. Decide which tools are allowed, and on which plans
Business and API plans of the major AI providers generally don't use your data to train models by default; consumer apps may, depending on settings. Pick the tools your company will pay for, turn on the business data controls, and say so in a one-page policy. People follow rules they understand: name the tools, give examples of what not to paste, and explain why.
2. Put a filter between people and the AI
A policy depends on everyone remembering it every time. A filter doesn't. The pattern that works is a gateway that inspects each request before it leaves:
- Secrets such as API keys, tokens, private keys and passwords in connection strings are blocked or replaced with placeholders.
- Personal data such as emails, phone numbers, card numbers and national ID numbers are replaced with placeholders, checked with their official checksums where they have one.
- Your own sensitive terms, such as project code names, client names and internal domains, are masked too.
- When the answer comes back, the placeholders are swapped back for the real values, so people still get a useful reply.
Apps and scripts that call AI APIs can be pointed at the gateway with one setting. For people using AI in the browser, a browser extension can do the same check on the page before a prompt is sent.
3. Cover coding assistants separately
Coding assistants read files and run commands on their own, so they can pick up a .env file or a key in a config without anyone pasting anything. Use their hook or permission settings to block reading secret files, and run the same secret check on the prompts and tool calls they send.
4. Start in monitor mode
Turn the filter on in a mode that records what it would have blocked or masked, without changing anything, for a week or two. You'll see how often it happens, which teams and which kinds of data are involved, and you can tune the rules before anyone is interrupted. Then switch to enforcing.
5. Keep an audit log you can show
Auditors and customers' security teams increasingly ask how you control AI use. A log of every request, with who sent it, which model, what was found and what was done, answers that question. Keep rule IDs and fingerprints in the log, never the sensitive values themselves.
6. Make it easy to do the right thing
- Keep secrets in a secrets manager rather than in files people copy from.
- Give people a sanctioned way to use real data with AI when they need to, such as an approved internal tool.
- When something is blocked, show a clear message that says why and what to do instead.
FAQ
Questions
Is it enough to tell staff not to paste secrets?
It helps, but it relies on everyone remembering every time. A filter catches the mistakes people will make anyway.
Will masking make the AI's answers worse?
Rarely. The AI works with placeholders like [[EMAIL_3f9a1c]], and the real values are restored in its reply, so the answer reads normally.
Can a filter catch everything?
No. It catches known formats, checksummed numbers and the terms you list. A secret in an unusual format, or a client name you didn't list, can still get through, so keep the policy and training too.
Does this work for Claude, ChatGPT and Gemini?
Yes, a gateway can sit in front of each provider's API, and a browser extension can cover their web apps.
Tools for this
Products that help
MaskWall
AI data firewallUse AI. Keep your secrets. Stops staff from accidentally sending passwords, API keys or customer data to ChatGPT, Claude and other AI tools. Sensitive text is hidden before it leaves and put back in the answer, so people can still use AI safely.
- Who it's forBanks, insurers and fintechs · Healthcare, legal and IT services firms holding client data
- What you getData-protection gateway · Claude Code and browser protection · Audit report for compliance
AgentLedger
AI agent inventorySee every AI agent in your code. Lists every AI agent and AI app that can read or change your code repositories, and flags the risky ones, so security teams and auditors know exactly what has access.
- Who it's forBank and NBFC CISOs · IT services firms
- What you getAI agent register · Risk findings · SARIF report
LeakResponder
Leaked secret responseFrom leaked key to closed incident. When a password or API key leaks, it finds every leaked secret in your code, tells you which to change first and how, and keeps proof that each one was fixed.
- Who it's forSoftware companies without a security team · Agencies handing repositories to clients
- What you getRanked list of leaked secrets · Response runbook per provider · Verified rotation tracker