Privacy, secrets and provenance with coding assistants
Use synthetic data and secret placeholders, configure provider data settings and review dependencies and generated migrations before they land.
By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 9 minutes to read.
In short
Code assistants send context to a provider, so what is in your files can leave your machine. Use synthetic data and placeholders, exclude sensitive files, check the provider's data settings, and review what the assistant adds: dependencies, secrets and database migrations.
Think of it like this: Treat the assistant like a helpful stranger at your desk: show them the practice sheet, not the vault keys.
Explained simply
When an assistant helps you, it reads your code and sends some of it to a provider to produce an answer. That means whatever sits in your open files, your chat and your terminal output can leave your machine. Most of the time that is fine. With passwords, customer data and private keys it is not.
The easy rule is to never give it anything real that you would not want shared. Use made-up data in tests and examples. Use placeholders such as YOUR_API_KEY instead of real keys. Keep real secrets in environment variables stored outside the project.
Next, use the settings your tools give you. Most providers let you choose whether your prompts may be kept or used for training, and many tools can exclude chosen files from what the assistant reads. Read these settings once, and write down what you chose.
Finally, check what the assistant brings in. It may suggest a package that does not exist or one with a look-alike name. It may write a database migration that drops a column. Review these before they reach your main branch.
Press Play on a diagram to walk through it one step at a time.
- 1Replace
Use fake data and placeholder keys
- 2Exclude
List .env and private folders as off limits
- 3Configure
Check provider training and retention settings
- 4Scan
Secret scanning catches leaks before they land
- 5Review
Check new packages and migrations
- Prompt
- Pasted logs
- Pasted config
- Context
- Open .env file
- Private keys in repo
- Output
- Key hard-coded in code
- Secret in a commit
- Supply chain
- Invented package name
- Look-alike package
In depth
Synthetic data and placeholders
Synthetic data is made-up data that has the shape of the real thing. A fake customer named Ada Example with the email ada@example.com tests your code just as well as a real record and carries no privacy risk. The domain example.com is reserved for this use, so it never reaches a real person.
For secrets, keep a file such as .env.example with placeholder values and commit that. Keep the real .env out of git using .gitignore. When you paste an error log into chat, scan it first for tokens, emails and internal host names, and replace them.
- Fake names and example.com emails
- .env.example with placeholders is committed
- Real .env stays in .gitignore
- Clean logs before pasting
Exclusions and provider settings
Content exclusion lets an owner list files or paths that the assistant should not read. GitHub Copilot, for example, has repository and organisation settings for this. Read the documentation of your tool to learn exactly which features respect the exclusion, because coverage differs by feature and by mode, and treat exclusion as a helpful layer, not a vault door.
Also review provider data settings: how long prompts are kept, whether they are used to train models, and whether your plan or contract changes the answer. For work code, follow your employer's rules. For personal projects, choose the strictest setting you are comfortable with.
- Keep real values out of prompts
- Work everywhere
- Depend on your habit
- Skips chosen files
- Set by repo or org owner
- Coverage varies by feature
- Finds keys already in code
- Can block a push
- Does not stop a paste in chat
Dependency provenance
Assistants sometimes suggest package names that do not exist. An attacker can register such a name and fill it with harmful code. Before you install a suggested package, check that it exists, that the name is exactly the one you mean, that it has a real repository and recent releases, and how many people use it.
npm can publish provenance statements, which link a package version to the source code and build that made it. The command npm audit signatures checks registry signatures and provenance attestations for installed packages. Provenance shows where a package was built; it does not prove that the code is safe, so you still read what you add.
- Does the package exist and is the name exact?
- Real repository, recent releases
- npm audit signatures for installed packages
- Provenance is evidence of origin, not of safety
Reviewing generated migrations
A migration changes a database, and mistakes can destroy data. Treat a generated migration like code from a stranger. Read each statement. Look for DROP, TRUNCATE, column type changes and renames, which can lose data or break running code. Check that large changes will not lock a busy table.
Run the migration against a local or disposable copy first, and keep a way back: a backup or a down migration. Only then apply it to anything shared.
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Use synthetic data and placeholders~30m
- 2Exclude sensitive files from context~30m
- 3Check provider data settings~30m
- 4Verify dependency provenance~30m
- 5Review generated migrations~30m
Key points
- Use fake names, example.com addresses and placeholder values such as YOUR_API_KEY in prompts and test data.
- Keep real secrets in environment variables outside the repo, and never paste them into chat.
- Content exclusion settings tell the assistant to skip chosen files. Check which modes and features the exclusion actually covers.
- Read your provider's data settings: whether prompts are kept, and whether they are used for training.
- Check that a suggested package exists, is the one you mean, and has a clear source. Read generated migrations before running them.
Key terms
Tap a card to flip it. 0/5 known
Examples
# .env.example is safe to share; real .env is not
DATABASE_URL=postgres://user:<password>@localhost:5432/app_dev
API_KEY=<your-api-key>
# check a suggested package before installing it
npm view some-package name version repository.url
npm audit signaturesPlaceholders in shared files, a quick look before installing.
Making a repo safe to share with an assistant
You have a small app with a real .env file. Step 1: copy .env to .env.example and replace every value with a placeholder. Step 2: make sure .env is listed in .gitignore. Step 3: use fake users in your seed data. Step 4: add the .env path to your tool's exclusion list if it supports one. Expected evidence: git status never shows .env, and the assistant can still run the app with the example values.
cp .env .env.example
# edit .env.example: replace values with <placeholder>
echo ".env" >> .gitignore
git status --short
git check-ignore -v .envVetting a suggested package
The assistant suggests installing fast-csv-parse-utils. Step 1: look it up before installing. Step 2: check the repository link, the last release date and the weekly downloads. Step 3: if anything looks thin, ask for a well-known alternative or write the few lines yourself. Step 4: after install, run npm audit signatures. If you cannot confirm the package, remove it with npm uninstall.
npm view fast-csv-parse-utils name version time.modified repository.url
npm install fast-csv-parse-utils
npm audit signatures
npm uninstall fast-csv-parse-utils # rollback if unsureQuick reference
- Use fake data: ada@example.com, 10.0.0.0/16, YOUR_API_KEY.
- Commit .env.example, ignore the real .env.
- Clean tokens and emails out of logs before pasting them.
- Check your provider's retention and training settings once.
- Content exclusion coverage varies by feature; read the docs.
- npm view then npm audit signatures before trusting a package.
- Read every DROP and rename in a generated migration.
Common mistakes
- Pasting a real error log that contains tokens or customer emails.
- Installing a package the assistant named without checking it exists. Invented names can be claimed by attackers.
- Running a generated migration on real data before reading what it drops or renames.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Rewrite this line for a prompt: 'Login fails for maria.lopez@acme.com with key sk-live-91ab'.
- Exercise 2medium
Create .env.example and the .gitignore line for a project that uses DATABASE_URL and API_KEY. Show how to confirm .env is ignored.
- Exercise 3hard
Ask an assistant to add a database column in a throwaway project. Read the generated migration, list each risk, run it on a local copy, and write the rollback.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Does the assistant keep my code forever?
- It depends on the provider, your plan and your settings. Read the data settings and privacy terms, and choose the strictest option that works for you.
- Is a .gitignore enough to keep a file from the assistant?
- Not always. Ignore rules control git, not necessarily what the assistant reads. Use your tool's exclusion setting too, and keep real secrets outside the project.
- What if I already pasted a real key?
- Treat it as leaked. Revoke or rotate the key at its provider right away, then replace it everywhere.