Sub topic 4
What data may be shared with AI tools
This chapter assumes you know the basic Git and pull request workflow, have used an AI coding assistant, and have a rough idea of what a CI pipeline does. It covers how to write the data-sharing rules in a team policy so people can follow them without guessing.
Why data rules come first
An AI tool works on whatever you send it. A prompt, a pasted stack trace, or a file the assistant reads from your project can all leave your machine. Once data reaches an outside service, you may not be able to take it back. Depending on the vendor's terms, it may be logged, reviewed by staff, or used to train models.
A policy cannot assume everyone knows which data is risky. It needs to name the categories and say what each one allows.
Classify data into tiers
Most teams already have a data classification scheme. Reuse it. If you don't have one, start with three tiers.
| Tier | Examples | Rule for AI tools |
|---|---|---|
| Public | Open source code, public documentation, published API specs | May be shared with any approved tool |
| Internal | Private source code, architecture notes, internal tickets | May be shared only with approved tools under a business agreement |
| Restricted | Secrets, customer data, personal data, unreleased security fixes | Never shared with AI tools |
The tiers keep the rule short. Developers don't have to judge each case from scratch. They find the tier, then check the rule.
What belongs in the restricted tier
Be specific. Vague wording such as "sensitive data" leads to inconsistent choices. A restricted list usually includes:
- Credentials: API keys, tokens, passwords, private keys, and connection strings.
- Customer data: records from production databases, support tickets with customer details, and logs that contain user identifiers.
- Personal data: names, email addresses, and anything covered by privacy law such as GDPR.
- Unreleased vulnerabilities: details of security flaws that are not yet fixed or disclosed.
- Contractually restricted code: code from a client or partner whose agreement forbids third-party processing.
Watch the indirect paths
Developers rarely paste a password into a chat on purpose. Leaks usually happen in less visible ways.
- Pasted logs and errors. A stack trace can contain request bodies, tokens, or email addresses.
- Environment files. An assistant with access to your working directory may read
.envfiles. - Test fixtures. Sample data copied from production is still production data.
- Agentic tools. A tool that reads files on its own can pull in more than you meant to share. Permission limits for these tools are covered in a later chapter.
The policy should say that the rules apply to everything the tool can see, not only what you type.
Make the safe path easy
Rules that depend only on memory fail. Add controls that reduce the chance of a mistake.
- Configure approved tools to exclude files by pattern. Most assistants support an ignore file or similar setting.
- Keep secrets out of the repository in the first place. Use a secrets manager and environment injection.
- Add secret scanning to the repository so a leaked credential is caught quickly.
- Give developers a short redaction habit: replace real values with placeholders before pasting logs.
# Example ignore patterns for an AI assistant
.env
.env.*
*.pem
*.key
secrets/
config/production/The exact file name and syntax depend on the tool, so check its documentation. The idea is the same everywhere: list the paths the tool must never read.
Common errors
- Treating a personal account as equivalent to a business account. Free or personal plans often have different data terms. The policy should name which accounts are allowed.
- Redacting only the obvious fields. Names get removed, but internal hostnames and customer IDs stay in.
- Assuming deletion is instant. Even when a vendor offers deletion, retention periods can apply.
- Having no reporting path. If someone pastes a secret, they need to know whom to tell and what happens next. Make the report easy and blame-free. Incident handling is covered in a later chapter.
Exercise
A developer wants help with a failing integration test. The log they plan to paste contains a customer's email address and an API token. What should they do under the three-tier policy, and what should happen if they already pasted it?
Show answer
The log contains restricted data (personal data and a credential), so it must not be shared as is. They should replace the email and token with placeholders, or share only the relevant error lines. If they already pasted it, they should report it through the team's reporting path and rotate the token right away, because the credential is now treated as exposed.