Application security

An API key was exposed: what should you do next?

A practical response sequence for an exposed credential: contain access, replace it, inspect use and verify the deployed fix.

Replace an exposed credential, update every dependent deployment and revoke the old credential. Inspect its usage and verify that the old key fails while the replacement works; removing it from source code alone is insufficient.

Remove the key. Close the access. — Application security
CodeSignOff Fieldnotes · Application securityDownload banner ↗

Establish what the credential can do

Identify the provider, permissions, environment and systems that use the credential. A public client identifier is different from a privileged secret, so verify its purpose before declaring an incident resolved or escalating an unsupported claim. If a privileged credential is exposed, treat it as potentially used by someone else. Removing it from a file does not invalidate copies already obtained. Follow the provider’s revocation and replacement procedure.

Contain without losing the recovery path

Coordinate replacement with the services that depend on the credential. Where exposure warrants immediate revocation, accept and communicate the resulting interruption rather than keeping unsafe access open merely for convenience. Use an authorised administrator account and retain a way to verify the change. Record the times of discovery, containment and replacement. Those timestamps will help relate provider logs to the period you need to examine.

Look at the shipped artifact

For a web application, inspect whether build-time configuration placed the secret in the browser bundle. Check deployment logs, repositories and other places the team may have copied it. Restrict access to investigation material; do not paste the secret into a public issue. A corrected environment variable is not evidence that an older public asset stopped containing the value. Revocation is what makes that old value unusable.

Verify behaviour after replacement

Exercise the legitimate workflow with the new credential and confirm the revoked value no longer authorises requests. Examine available provider activity for unexpected operations, without assuming missing logs prove there was no use. Record the investigation limits. If customer information or transactions may be affected, involve the responsible incident owner to determine the appropriate response. Keep conclusions proportional to the evidence you can actually obtain.

Prevent the same path from recurring

Document how the credential reached the exposed location. A useful follow-up might change a build variable, remove excessive permissions or introduce a review of client-visible configuration. Assign ownership for rotation and expiry where supported. Add a check that would have caught this route of exposure, then test that check using a synthetic value. The improvement should address the delivery path, not simply remind everyone to be more careful.

Sources & further reading

Reference material for the guidance and examples above. Where included, community discussions provide context rather than verified incident evidence.

Prepared with AI assistance. Examples are illustrative and are not client case studies.

About CodeSignOff Editorial

CodeSignOff Editorial publishes engineering guidance for founders evaluating AI-built software. CodeSignOff is a product of Avi Root Info Solutions, led by Shekhar Juneja, whose software career began in 1998 and includes architecture for UK mortgage and credit-rating systems. This organisational byline does not indicate a personal review of this article by Shekhar.

Engineering background and editorial approach · Shekhar’s professional profile ↗

Evidence to take into your own review

Define the code revision and scope. For each finding, record the affected flow, the steps that reproduce it, its business consequence and the evidence for the next action. After a fix, repeat the check and record what remains uncertain. An audit delivers a verdict; remediation and verification are separate steps.

This article is general engineering guidance. It does not establish the security or compliance of your application. Contact us with a correction or a question about the guidance.

Continue reading

← Back to all insights
A clear next step

Put these questions to your own codebase.

Tell us what you’re building and what’s coming next.
We’ll help you scope the right review.