Secure AI coding: what never to paste into a hosted model
Treat an AI chat window like a public pastebin. Secrets, personal data and client contracts do not belong in it — and that is a policy problem before it is a tool problem.
Every AI assistant you use sends your prompt to someone else's server. That is fine for a stack trace and unacceptable for a production .env. The boundary needs to be written down, because "be careful" is not a control.
The never list
API keys, database credentials, private keys, session tokens, full .env files, customer personal data, and unreleased client IP. Redact before pasting: replace the key with REDACTED and keep the shape of the error.
- Credentials and connection strings
- Personal data covered by GDPR or a contract
- Full production database dumps
- Anything under NDA you have not cleared
Check retention and training terms
Consumer plans often reserve the right to use inputs for training. Business and enterprise plans usually offer no-training terms and shorter retention. Read the data-processing addendum before a client asks you to sign one.
Prefer tools with a local option
For regulated work, a self-hosted model or a vendor with an on-premise deployment removes the question. Completion quality is lower, but the compliance answer is simple.
Automate the guardrail
Add a pre-commit hook that blocks .env files, a secret scanner in CI, and a short policy in the repository. Then rotate any key that has ever been pasted, because you cannot prove it was not retained.
Frequently asked questions
Is it safe to paste client code?
Depends on the contract and the plan. Many client agreements permit subcontractors but not third-party processors; check before you assume.
What if a secret was already pasted?
Rotate it immediately. Deleting the chat does not undo the exposure, and rotation is cheap compared with a breach notification.
More on this topic: AI & automation articles.
Admin
Related articles
AI tools for freelancers: the stack that pays for itself
Four subscriptions, around $60 a month, chosen because each one replaces a task you would otherwise avoid at 9pm.
AI tools for WordPress developers that are actually useful
WordPress-specific AI plugins mostly generate content. The useful gains are in the general coding tools plus a handful of narrow t...
Will AI replace Laravel developers? An answer for founders
AI compresses the typing, not the judgement. What it changes is what a small team can ship — and what you should expect to pay for...