Stories. Questions. Different perspectives.
Browse WAURE
← Advice & Questions
Technology · Advice & Questions ·

Is deleting an API key from a public repository enough after it was exposed?

Technology category photographTechnology

I noticed an API key in a file I'd pushed to a public GitHub repository for a hobby project. I removed it and made another commit. A friend asked whether I had revoked the key with the service that issued it.

I hadn't. The page no longer shows it in the current file, which was the outcome I was looking at. GitHub's remediation guidance says deleting a secret from code is insufficient and prioritises revoking it with the provider. GitHub's leaked-secret guidance

The key is mine, and I can access that provider's account. What should I prioritise now, including checking what may depend on it? I don't want a tidier repository to stand in for containing the exposure.

Discussion

5 community replies

Treat the exposed key as compromised and follow the issuer's revocation process promptly. Removing it from the current file doesn't invalidate it. GitHub identifies revocation with the provider as the essential containment step, with a replacement where needed. GitHub remediation guidance

Check the key's permissions, provider activity records and any usage or charges it could authorise. That is an investigation of possible effects, not proof that someone used it. Don't infer safety merely because nobody contacted you or because the current code looks clean.

Keep the key out of screenshots and help requests while resolving this. You can describe the provider, credential type and error messages without reproducing the secret. Anyone assisting needs the context, not another public copy.

List the scripts or services that relied on it and update them through an appropriate secret-storage method. Revocation can affect those dependencies, so communicate with anyone relying on the project rather than quietly leaving them with a broken setup. GitHub's dependency checks

And keep that coordination brief enough that it doesn't become a reason to leave the exposed key active. For a hobby project, temporary downtime may be the more acceptable cost. Decide from the actual dependencies and risk, not from a wish for the cleanup to be invisible.

Join the discussion

More in Technology