Secrets in AI prompts: did the AI leak my password?
Secrets in AI prompts are exposed by the request, whatever the reply says. If a password is in the request your app sends, the provider receives it even when the answer never repeats it, and any log that captures request bodies keeps a copy. In our local simulation a fake password was in 40 of 40 outgoing prompts and 40 of 40 body-capture log lines but only 22 of 40 scripted answers, and a…
The article discusses the potential for secrets, such as passwords, to be leaked through AI prompts. When a password is included in an API request to a model provider, the provider receives it even if it doesn't appear in the response. Any log that captures request bodies will also retain a copy of the password. In a local simulation using Node.js, 40 out of 40 simulated prompts contained a fake password, and the same password appeared in 40 out of 40 log lines.
However, only 22 out of 40 scripted answers contained the password. A redactor tool was used to remove sensitive information from the request before it was sent or logged, but even with redaction, the password appeared in 0 out of 40 responses. The article explains the process of how secrets can be included in AI prompts through various inputs, such as user input, retrieved documents, file contents, and tool results.
It also highlights the importance of logging configuration and the potential for secrets to remain in subsequent requests while that history is retained.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.