← Back to Journal
中文版 →

An API Key Is Not a Setting. It Is Access.

A practical 30-minute safety review after a security incident.

A desk set up for a security review, with a notebook checklist, a physical key, and a computer
01 Find every place a key may have appeared 02 Revoke and rotate when in doubt 03 Set limits, alerts, and a rotation date

An API Key Is Access, Not Just Configuration

After reading about a security incident on a cloud platform, I ran a very basic but worthwhile check. Is there a key anywhere in the website? In the Git history? Has a local configuration file been tracked by accident?

An API key is not just a line of text for connecting services. It is closer to a key that grants access. If it ends up in a public repository, a screenshot, a document, frontend code, or an environment variable on a third-party platform, someone may be able to use it to call services, burn through your quota, or even reach your data.

The point of this note is not to cause anxiety. It is to lay out a first-pass check that anyone can follow.

Do These Three Things First

  1. Find every place a key has ever appeared. Check separately: public website source, Git repositories and their commit history, local .env files, cloud platform environment variables, notes, and screenshots. Do not look only at current files, because a deleted key can still live in Git history.
  2. Rotate when in doubt; do not wait for confirmed exposure. If a key was ever in a public repo or on the third-party platform involved in the incident, or you cannot be sure whether anyone has seen it, the cleanest approach is to revoke the old key, create a new one, and then disable the old one.
  3. Add usage limits and alerts. Set a budget or usage cap for paid APIs, turn on unusual-activity alerts, disable automatic top-ups you do not need, and review usage logs regularly. None of this prevents a leak, but it keeps the damage from growing unchecked.

Never Put a Key in These Places

If a service genuinely needs to be called from the browser, route it through a backend or serverless function proxy so the server keeps the secret. Never send a long-lived key to the user's browser.

A Reusable 30-Minute Checklist

  1. List the API keys, tokens, databases, and bot credentials currently in use.
  2. Search the current code and the full Git history for real keys.
  3. Confirm .env is not tracked, and check .gitignore.
  4. Review environment variables on every cloud deployment platform.
  5. Revoke and recreate any key that was exposed or whose status you cannot confirm.
  6. Set budgets, rate limits, and unusual-activity alerts.
  7. Record each key's purpose, owner, and rotation date, but never the key itself.

Make Rotation Routine Maintenance

Security does not mean shutting every tool down. It means managing convenience and access separately. Treat a key as access, not configuration, and treat rotation as routine maintenance rather than a fix that only starts after an incident.

Sources and further reading: Zeabur incident notice · Zeabur security best practices
API SecurityCredential HygieneGitCloud SecurityLearning Note