In the first 15 minutes
- Revoke the key in the provider console. Do not wait to investigate first.
- Create a new key and update it in your secret manager or environment variables, not in code.
- Set or lower a hard spend limit on the project so any other exposed key cannot run up a large bill.
In the next hour
- Check usage for the leaked key's project: unusual models, volumes or times.
- Contact provider support if you see abuse; some will review fraudulent charges.
- Remove the key from git history with a tool like git filter-repo, then force-push. Deleting it in a new commit is not enough.
- Search other places it may live: CI logs, chat messages, shared docs, browser extensions.
Prevent the next one
- Never put keys in front-end code or mobile apps; route calls through a server.
- Turn on secret scanning in your git host and pre-commit hooks.
- Use separate keys per project with their own limits, so one leak has a small blast radius.
- Stop sharing raw keys with employees. Give them a workspace login instead.
How Intrascope handles keys
In Intrascope employees never see provider keys: admins add them once, they are stored encrypted, and people log in with their own accounts and limits. Details in how Intrascope keeps API keys secure.