Keeping secrets and proprietary code out of prompts
The guardrail that does not bend: redact secrets, and match the tool to the sensitivity of the code.
Before AI touches your code at all, decide what it is allowed to see. This is the guardrail that does not bend.
Secrets never go into a prompt. API keys, tokens, connection strings, passwords, private certificates — none of it. If a diff contains a secret, that is a finding in itself: it should not be in the code either. Redact it to a placeholder before you paste, and rotate anything that has already leaked.
Proprietary code needs a matching decision. Pasting employer source into a personal chat account can send it outside your control and outside whatever contract governs your data. Prefer the tool your organization has approved and covered by an agreement — many enterprise and IDE-integrated assistants run under terms that keep your code private and out of training. A personal consumer account usually does not offer that.
Practical habits:
- Strip secrets and customer data to placeholders such as API_KEY or CUSTOMER_ID before sharing a snippet.
- Know your data classes and match the tool to the class; public sample code and internal production code are not the same.
- When in doubt, share the shape of the problem, not the real values.
Safety angle: a leaked key or a source exposure cannot be undone. Unlike a bad review comment, you cannot take it back. The two-second habit of redacting is far cheaper than the incident.
Find a snippet you would normally paste into an AI tool. Produce a redacted version — every secret, identifier, and customer value replaced with a placeholder, structure intact. Make that your default before any share.
Enjoying the free lessons? Get an email when we publish new courses and updates — no spam, unsubscribe anytime.
Discussion (0)
Ask a question or share what worked for you. Comments are reviewed before they appear.
No comments yet. Be the first to start the discussion!