This week’s research where 2 million fake secrets were fed into AI prompts got me thinking: I want a tripwire on my own agents. A canary is a fake credential that does nothing useful but alerts you the moment someone tries it. If it fires, something leaked.
1. Make a canary credential
Go to canarytokens.org (free, from Thinkst) and create an AWS keys token with an alert email you watch. You get an access key ID and secret that look real but only trigger an alert when used.
2. Put it where a leak would expose it
- In a dummy
.envor config file in your agent’s working directory, next to the real ones, with a boring name. - In a test prompt or memory note that you send through each AI provider or router you use, one unique canary per provider so you know which link leaked.
- In a private repo your agents can read.
3. Don’t wire it into anything real
The canary must never be your actual key, and your code must never call it. Any use at all means someone else has it.
4. Know what you’ll do when it fires
Write down the response now: which provider or file held that canary, which real keys sat near it, and rotate those real keys immediately. Then cut off the leaky provider or tool.
5. Bonus: a plain-text canary
echo "canary-$(openssl rand -hex 12)"
Drop that unique string in a prompt and search for it later in logs and on the web. It won’t alert you, but it’s free and private.
Best defense is still the boring one: keep live secrets out of prompts entirely and give each agent its own scoped key.
God Bless, and May the Source Be with You!