ExtraTunnel
Book a back-test Download

Blog · 5 min read

Can you use AI coding agents on code with customer data?

Yes, you can use Claude Code, Cursor or GitHub Copilot on a codebase that touches customer data, but you need guard rails. An agent reads files to build context, and whatever it reads can be sent to the AI provider. That includes .env files, test fixtures, logs and database dumps. Keep real data and secrets out of the agent’s reach, or seal them before the request leaves.

Hands typing at a laptop while a coding agent runs with its secrets kept on the laptop
Stock photograph, with a recreated terminal on the screen.

What an AI coding agent reads in your repository

A coding agent does not only see the file you have open. To answer well it searches the project, opens related files and reads the output of the commands it runs. All of that can become part of the request sent to the provider.

Source code is rarely where the customer data lives. It sits in the files around the code.

Where it hidesWhat is in itFix
.env and config filesAPI keys, database passwords, tokensMove secrets to a secret manager
Test fixtures and seed dataReal records copied from productionReplace with made-up data
LogsEmails, IDs, request bodiesKeep logs outside the project, scrub before sharing
Database dumps and exportsWhole tables of customer rowsStore outside the working folder
Terminal outputQuery results, stack traces with record contentsUse a database with fake data in development
Notebooks and CSV filesSaved cell outputs, samples of real dataClear outputs, use masked samples

Can I use Claude Code, Cursor or Copilot on code with customer data

In most cases yes, once you have dealt with the table above. The tools differ in detail. Each has its own way to exclude files and its own plan terms for how requests are handled. Check both for the tool and the plan your team uses, and do not assume one tool’s behavior carries over to another.

Also check your customer contracts. Some limit which outside parties may receive customer data, and an AI provider is an outside party. If your code handles health or payment data, rules such as HIPAA, the US law on health information, or PCI DSS, the card industry’s security standard, may apply. This is not legal advice.

Guard rails for AI coding agents

  1. Move secrets out of the repository. Load keys from a secret manager at run time so no live key sits in a file the agent can open.
  2. Replace real fixtures with made-up data. Generate fake names, emails and account numbers that keep the same shape as the real ones.
  3. Keep dumps, exports and logs outside the project folder. If the agent cannot reach a file, it cannot send it.
  4. Set ignore or deny rules for sensitive paths. Then test them. Ask the agent to read a blocked file and confirm it is refused.
  5. Point development at fake data. Do not connect an agent to production or to a fresh copy of it.
  6. Limit what the agent can run. Give it read-only credentials where possible and require approval for commands that touch data.
  7. Rotate anything that was exposed. If an agent read a live key, treat the key as shared and replace it.

Why ignore files are not enough

Ignore rules depend on someone listing every sensitive path, and new files appear every day. A teammate drops an export into the project to debug something. A test writes a log with real emails in it. Nobody updates the rule.

Agents also see data that never sits in a file. A failing test prints a customer record. A query returns ten rows. That output goes into the context and travels with the next request. Path rules do not catch it.

So it helps to have a second control that looks at the request itself, just before it leaves the computer.

Sealing data before the request leaves

ExtraTunnel is one option for that second control. It runs on the developer’s own computer and works like switching on a VPN. One switch, and people keep the agent they already use: Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI or Windsurf.

Before an AI request leaves, private details such as names, emails, phone numbers, account and card numbers, passwords and keys are swapped for labelled placeholders. The agent works on the sealed text. The real values are put back into the answer on the computer, so the code and output the developer sees still make sense.

A second, simpler program checks every request before it leaves. If the check fails, the request does not go out. Each request gets a signed receipt that records counts and hashes, not the text, which gives a security lead something to review. Files it cannot read, such as images and scans, are held on the device instead of being sent. The security page lists what is covered and what is not, and early preview builds are on the download page.

This sits alongside the guard rails above. It does not replace them.

Common questions

Does Claude Code read my .env file?

A coding agent can read any file its permissions allow, and .env files usually sit in the project folder. Add a deny rule or move the secrets out. Do not assume the file is skipped.

Does GitHub Copilot send my code to the cloud?

Hosted coding tools send the code and context needed for a request to the provider. What is kept afterward depends on the plan, so read the terms for yours.

Is it safe to let an AI agent query a production database?

It is a bad idea. Query results become part of the agent’s context and can be sent with the next request. Use a copy with fake or masked data.

What should I do if an agent read a secret?

Rotate it. Treat the key as shared with an outside party, replace it, and check where else it was used.

Is a local model the safer choice?

A model on your own hardware keeps requests on your machines, but you take on the upkeep and may give up quality. Many teams prefer to keep their current tools and control what is sent.

Sources and further reading

  1. GitHub Copilot documentationGitHub
  2. Anthropic Privacy CenterAnthropic
  3. OWASP Top 10 for Large Language Model ApplicationsOWASP GenAI Security Project
  4. Guidelines for secure AI system developmentUK National Cyber Security Centre

Primary sources, linked so you can check them. They do not endorse ExtraTunnel.

Ask an AI about this article

Keep your agent, seal what it sends

ExtraTunnel is free for one person and works with the coding agent you already use.

Keep reading

AI data leak prevention: how DLP for AI works

Is it safe to put customer data in ChatGPT?

The private line to every AI.

One switch. Your own tools. A signed record of every request.