devtools.codes

I committed an API key. What now?

Your tool input is processed locally in your browser and is not intentionally uploaded to our servers. Advertising and analytics providers may still process normal page, device, cookie and network information.

Rotate the credential first. Before rewriting history, before amending the commit, before anything else. This is the step that actually ends the exposure, and every other step is housekeeping by comparison.

The reason is simple: removing a secret from a file does not revoke it. The value remains valid at the provider until someone revokes it there. A key deleted from your repository and left active is exactly as compromised as one still sitting in the file, but harder to remember to deal with.

If the commit reached a remote, assume the value has been read. Public repositories are scanned continuously by automated systems, and the window between pushing a key and it being used can be measured in minutes. Private repositories are safer but not safe: anyone with access has seen it, and it now exists in every clone, every fork, and any CI cache that fetched the repository.

Once rotated, clean up in a sensible order. Replace the credential with an environment variable reference. Add the file to your ignore rules if it should never have been tracked. Then, if you need to, rewrite history — accepting that this requires everyone with a clone to re-fetch, and that any fork or mirror keeps the old object regardless.

Check what else was exposed while you are there. A committed environment file rarely contains only one secret, and the one you noticed is often not the most sensitive. Scan the whole file rather than fixing the line that caught your eye.

Finally, work out how it happened. A key in a commit is usually a process gap rather than carelessness: a file that should have been ignored, a config pasted in for debugging, a test fixture that acquired a real value. Fixing the process is what stops the second occurrence.

More on i committed an API key. What now?

Is it enough to delete the line and amend the commit?

No. Amending changes what the branch points at; it does not revoke anything. The credential stays valid at the provider until someone revokes it there, and if the original commit was ever pushed it exists in the remote and in every clone. Rotate first, then tidy the history if you still want to.

The repository is private. Do I still need to rotate?

Yes. Private reduces the audience; it does not close the exposure. Everyone with access has seen the value, it exists in every clone and fork, and it may sit in a CI cache or a backup that outlives the repository. Repositories also change visibility, sometimes by accident.

Should I rewrite history?

Optional, and second. After rotation the committed value is dead, so rewriting is housekeeping rather than remediation. It also has a real cost: everyone with a clone must re-fetch, and any fork or mirror keeps the old object regardless. Worth doing for a repository you control; rarely worth the disruption on a busy shared branch.

How do I find out whether the key was used?

Check the provider usage or audit log for the period between the push and the revocation, and look for calls you cannot account for — unfamiliar times, regions or endpoints. Do this after rotating, not before. Where the provider offers per-key attribution, that log is the only evidence you will get.

The tool behind this, and related guides