guardry/

guardry/Guides/Leaked API key

An AI agent leaked an API key: what to do

Revoke the key at its provider first, then report the leak, save the replacement, resolve the report and check the audit log for reads.

Revoke the key at its provider first, because that is the only step that makes the leaked copy useless. Then report the leak in Guardry, save the replacement key as the new version, resolve the report, and read the audit log for that entry. Guardry does not scan for leaks and does not rotate keys at the provider, so each of these steps is done by a person or reported by the agent.

1. Revoke the key at the provider

Go to the provider that issued the key and revoke it. Do this before anything else. Until the provider revokes the key, anyone who saw it in the chat, log, repository or file can use it.

2. Report the leak

A leak report marks the entry in Guardry so that nobody forgets it. The report names the entry, the version and the kind of place the value appeared. It does not contain the value.

# Report the leak without copying the value
guardry --profile coding-agent --project billing --environment production secrets report-leak API_KEY --secret-version 3 --surface log
# surfaces: conversation, log, repository, file, other

An agent that notices it exposed a value can run this itself. If you notice first, tell the agent to run it, or run the same command from the agent's profile.

The dashboard then shows "Rotation required" on that entry and an organization-wide banner. Both stay until a person resolves the report.

3. Save the replacement

Create a new key at the provider. An owner or administrator saves the new value in the dashboard, and it becomes the next version of the entry. The name stays the same, so the agent's commands do not change.

An agent cannot do this step. Agents can never edit, rotate or delete an existing entry.

4. Resolve the report

When the old key is revoked and the replacement is saved, resolve the report in the dashboard. Do this last.

5. Review the audit log

Read the audit log for that entry. It records who read it (person or agent), which version, when, the outcome and the client IP. This tells you which agents received the leaked version.

If you no longer trust an agent that received it, revoke its credential. The steps are in How to revoke an AI agent's access to your secrets.

What Guardry does not do here

  • It does not scan for leaks. A leak is known to Guardry only when it is reported.
  • It does not rotate or revoke the key at the provider. That is manual.
  • It cannot take back a value. A value an agent already received stays with it, and the audit log shows releases from the vault, not what a program did with a value afterwards.

Questions

Does Guardry detect leaked API keys automatically?

No. Guardry does not scan for leaks. An agent that notices it exposed a value can report the leak with guardry secrets report-leak, and the dashboard then shows "Rotation required" on the entry until a person resolves it.

Does Guardry rotate the leaked key for me?

No. Rotation is manual. You revoke the old key at its provider, create a new one there, and an owner or administrator saves the new value in the dashboard, where it becomes the next version.

Can the agent report a leak without repeating the key?

Yes. The report names the entry and the kind of place the value appeared: conversation, log, repository, file or other. The value itself is not copied into the report.

Should I also revoke the agent's credential?

Revoking an agent credential stops that agent's future requests. It does not help with the leaked key, because a value the agent already received stays with it. Revoke the key at the provider first, then the agent credential if you no longer trust that agent.