Secrets in the Context Window — Redact Before You Paste
A developer is about to paste a stack trace, a config snippet and some logs into a public AI chatbot to get help with a bug. Anything in that paste can be stored, logged or used for training. Redact every secret and every piece of personal data — but don't over-redact, or the assistant can't help.
What is leaking secrets into an AI prompt?
Developers paste stack traces, configuration and logs into AI chatbots to get help. Those snippets often contain API keys, database passwords, tokens, customer emails and internal hostnames.
Once pasted, the data is outside your control. It may be stored, logged, reviewed or used under the provider's terms. The safe habit is to redact before pasting.
A real case
Wiz Research found a publicly reachable DeepSeek database with no authentication. It held more than a million log lines, including users' chat history and API secrets. Whatever people had typed into the chatbot was readable by anyone who found the address.
That is the risk this lab trains you to remove: once a secret is pasted into a chatbot, its safety depends on someone else's storage.
Source: Wiz
How to fix it
- Replace keys, tokens, passwords, emails and internal addresses with placeholders before sharing anything.
- Use a secret scanner on text bound for an AI tool, the same as on commits.
- Prefer an approved AI tool with a contract covering data use over a public chatbot.
- Rotate any secret that has been pasted, whether or not harm has been seen.
Questions people ask
Is it safe to paste code into an AI chatbot?
It depends on what the code contains and on the tool's data terms. Code with no secrets and no customer data carries far less risk.
What counts as a secret?
API keys, tokens, passwords, private keys, connection strings, session cookies and anything that grants access. Personal data and internal hostnames also deserve care.
I already pasted a key. What now?
Rotate it. Treat it as exposed and issue a new one.
Read the full OWASP LLM Top 10 guide · All free labs · AI red team certification