You’ll be able to
- Recognise API keys, passwords and sign-in codes as secrets to protect.
- Know the steps to take when a key leaks.
- Review and revoke third-party apps you no longer use.
01. The problem
Two very common situations:
- An API key gets pasted into a shared document or pushed to a public repo. Whoever has it can use the service on your account and your money.
- A third-party “AI-powered” app asks for very broad access to your email, Drive or social accounts.
Working with AI means handling more of these “digital keys”. Protect them like your house keys.
02. The key idea
What counts as a digital secret
- Passwords and recovery questions.
- API keys and access tokens: strings that let software use a service on your behalf.
- One-time codes, recovery codes, backup codes.
- Sign-in sessions (cookies) on shared computers.
Rules for protecting them
- Never paste secrets into prompts or public files. When asking AI to fix code, remove the key first and use
YOUR_API_KEY. - Store them properly: a password manager; for projects, a private config file that never goes online (such as a
.envlisted in.gitignore) or the platform’s secret store. - Turn on two-factor sign-in wherever it’s offered.
- Don’t reuse passwords across services.
- Set limits on spending or scope for API keys where the platform allows.
When a key leaks
- Revoke the old key and create a new one immediately; deleting the file isn’t enough.
- Update the new key wherever it’s used.
- Check usage history and billing for unusual activity.
- Tell the person responsible if it’s an organisation account.
Review third-party apps
Regularly open your account’s “Connected apps” / “Security” page (Google, Microsoft, GitHub, social networks…). Revoke apps you no longer use or that ask for more than they need.
03. Example
First attempt: paste a whole config file with API_KEY=sk-... into the chat and ask “why does my code fail?”.
Improved: replace the value with API_KEY=YOUR_API_KEY before pasting, and describe the problem with the error message.
Why it’s better: AI has enough to help, and the real key never leaves your machine.
04. Practice · 15 minutes
Fictional config (every value is fake):
# config shared in team-notes.md (public link)
OPENAI_API_KEY=sk-demo-1234567890abcdef
ADMIN_PASSWORD=Summer2026
EMAIL_APP_SCOPE=read,send,delete,manage_settings
PAYMENT_LIMIT=unlimited
- Find every problem in this config (hint: there are at least 4).
- For each one, suggest a fix.
- Open the “connected apps” page of one of your own real accounts (just look; share it with no one), count the apps, and revoke at least one you no longer use.
Show suggested answers
- API key in a publicly linked document → revoke, create a new one, keep it in a secret store.
- Weak, guessable, shared admin password → change to a strong, unique one; turn on two-factor sign-in.
- Email access far too broad (send, delete, manage settings) → reduce to what’s needed, e.g. read only.
- No payment limit → set a spending cap.
05. Check your result
- You found all 4 problems and proposed revoking the key, not just “deleting that line”.
- You turned on two-factor sign-in for at least one important account (if it wasn’t already).
- You revoked at least one unused connection.
06. Remember
- API keys, passwords, one-time codes are digital keys: never in prompts or public files.
- A leaked key is a lost key: revoke and replace it now.
- Use a password manager, don’t reuse passwords, turn on two-factor sign-in.
- Review and revoke third-party apps regularly.
Quick check
Pick an answer. You can try again as often as you like.
Keep going
Sources & review date
- OWASP Top 10 for LLM Applications (Sensitive Information Disclosure) ↗
- OpenAI Documentation ↗
- Anthropic Documentation ↗
Content checked on Nov 12, 2026