Pasted a secret into an AI chat? Do this first.
Short answer: treat it as exposed. Revoke or rotate it where it was issued, before you do anything else. Deleting the message from the chat is cleanup, not a fix: the old key keeps working until you switch it off.
First, switch it off
Revoking it closes the door. Checking the logs afterwards tells you whether anyone used it. Do it in that order.
What to do, by what you pasted
API key or access token
Open the dashboard of the service that issued it and revoke the key, or rotate it: create a new key, switch your apps to it, then turn the old one off. Give the new key only the permissions it needs. Then check that service's usage, billing and audit logs for anything you don't recognise. Don't paste the new key into the same chat.
Where to go:
- OpenAI: platform.openai.com/api-keys
- Anthropic: platform.claude.com/settings/keys
- AWS: "Update access keys" in the IAM User Guide (docs.aws.amazon.com/IAM/latest/UserGuide/id-credentials-access-keys-update.html)
- GitHub: "Managing your personal access tokens" (docs.github.com)
- Stripe: "API keys" (docs.stripe.com/keys)
Other services have the same control, usually under Settings, API or Developer.
Private key file (SSH key, .pem, TLS key)
Make a new key pair. Then remove the old public key everywhere it's trusted: the authorized_keys file on your servers, the SSH and deploy keys in GitHub or GitLab [GitHub: "Reviewing your SSH keys"]. If it was a certificate's private key, ask your certificate provider to revoke the certificate and issue a new one with a new key.
.env file
Rotate every secret in it, not just the one you noticed. An .env file usually holds several keys and passwords at once.
Database connection string
A connection string that includes a password is a working login. Change that database user's password, or create a new user and remove the old one. Update the apps that use it, and check the database's access log.
Card number
Call the number on the back of the card, say the number was exposed, and ask for a replacement card. Then watch your statements.
US Social Security number
IdentityTheft.gov has a step-by-step plan for an exposed Social Security number. Freezing your credit at the three credit bureaus is free (usa.gov/credit-freeze). This is general guidance, not legal advice.
Crypto wallet recovery phrase or private key
Create a new wallet, on a device you trust, and move your funds to it now. Treat the old wallet as compromised for good: you can't rotate a recovery phrase. (HiveFury's AI data protection doesn't detect wallet keys or recovery phrases, so don't rely on it for this one.)
Find the other copies
The chat is often not the only place the secret ended up. Look in your shell history, your repositories (including commit history: deleting a secret in a new commit doesn't remove it from earlier ones; GitHub's guide "Remediating a leaked secret in your repository" covers this), CI and deploy logs, tickets, team chat and notes.
If it was a work secret, tell someone now
Tell the person responsible for security, or the owner of the account, straight away. Say what kind of data it was, which AI site, roughly when, and whether you've already rotated it. Don't paste the secret into the report. A quick, honest report helps more than a quiet fix nobody knows about.
If you run a team and want this stopped across every work browser, see AI data protection for your whole team and our guide to stopping staff pasting secrets into AI chats.
Stop it happening next time
HiveFury is a free Chrome extension. Turn on its AI data protection, and it stops API keys, private key files, database connection strings and card numbers before they're sent to an AI chat, checking on your device.
When it finds one, the paste or message is held back, and a HiveFury box names the kind of data it found, never the data itself.
What it doesn't do: check email addresses, phone numbers, images, PDFs or Office files, or detect crypto wallet keys or recovery phrases.
See how HiveFury's free AI data protection works. What it reads and never sends is in section 4 of the privacy policy.
Client names and codenames
Keys aren't the only things that shouldn't go into an AI chat. HiveFury Advanced lets you add up to 100 of your own protected terms, like client names or project codenames, and stops them in AI chats on your device. $12 for one year, charged once. No automatic renewal, and a 30-day full refund.
Add protected terms with HiveFury Advanced
FAQ
Does deleting the chat make the key safe?
No. Deleting the message can be part of cleaning up, but the key still works until you revoke it where it was issued.
I pasted it into a chat I think is private. Do I still need to rotate it?
Yes. You can't confirm from your side who or what can read it later, and rotating usually takes a few minutes.
Can HiveFury see what I pasted?
No. AI data protection checks the text on your device and never sends it to us or anyone else. Its log stays on your device and keeps the AI site, the kind of data, what you did and the time, never the text, for the last 50 entries.
Can HiveFury undo a paste that already went through?
No. It can only stop a paste or message before it's sent. For something already sent, follow the steps above.
Is HiveFury free?
Yes. AI data protection and scam and phishing warnings are free, with no account. HiveFury Advanced is optional.