Sub topic 1
What Can Go Wrong When AI Tools See Your Work
Prerequisites
This chapter assumes basic Git and command-line use, familiarity with an AI coding assistant, and a basic understanding of API keys and environment variables.
What Can Go Wrong When AI Tools See Your Work
An AI tool may receive more than the text you type. It can include open files, repository context, terminal output, editor history, and files selected by an agent. An agent may also read files, run commands, or call external services.
The main risks are disclosure, unintended retention, and unauthorized action. A private source file can reveal business logic or a vulnerability. A credential in a log can let someone access production. An agent with broad permissions can copy data to a remote service or modify important systems.
What Counts as a Secret or Sensitive Code
A secret is a value that grants access or proves identity. Examples include passwords, API keys, private keys, session tokens, database connection strings, and cloud credentials. A secret remains sensitive even when it is temporary or appears in a test log.
Sensitive code includes private algorithms, customer data, internal URLs, security configuration, unreleased features, and code containing exploitable weaknesses. Removing a filename does not make its contents safe.
Where Your Data Goes: Prompts, Context, Tools, and Telemetry
Your data can move through several stages:
A provider may process prompts, responses, metadata, and error reports. An agent extension or tool server may receive the same context and gain additional access. Check whether data is encrypted, retained, used for training, stored in another region, or available to support staff.
Reading Provider Retention and Training Policies
Before using a tool with private code, check the specific product and plan terms. Look for retention duration, training use, deletion controls, subprocessors, administrator access, and whether business and consumer plans differ. “Not used for training” does not necessarily mean “never stored.”
Prefer documented controls over marketing claims. Record the approved plan and review policy changes.
Keeping Files Out of AI Context
Use ignore rules where the tool supports them, and verify the tool's behavior:
.env
.env.*
!.env.example
*.pem
*.key
terraform.tfstate
terraform.tfstate.*Ignore rules reduce accidental inclusion, but they are not a security boundary. Check prompts and context previews before sending sensitive work.
Exercise
You need help debugging an application that reads a production database URL from an environment variable. What should you share?
Show answer
Share a redacted error, the relevant code structure, and a fake example configuration. Do not share the production URL, password, token, or customer records.