If an API key reaches a GitHub repository, deleting the visible line is not enough. The urgent question is whether the credential can still authorize access. Secure that credential with its issuer first; then repair the application, investigate exposure and decide whether repository-history cleanup is necessary.
Response sequence: contain access before repository cleanup
Identify the credential’s issuer and owner. Arrange prompt revocation, or a coordinated replacement followed by revocation where service continuity requires it. Verify the old credential’s state separately from application recovery. Review authorized logs, remove the exposed value from current source, then decide whether repository-history cleanup is warranted. Close the alert with an accurate reason after remediation; keep any unfinished investigation assigned.
Evidence and scope: CoreSecTech rechecked the official GitHub and npm documentation on 23 October 2026. This is a documentation-based response guide, not a reproduced incident. We did not expose a test credential, inspect a customer repository or measure detection times. The response sequence, handoff table and evidence record below are CoreSecTech recommendations; the npm example follows the linked documentation and was not executed. Use them only for repositories and services you are authorized to manage.
1. Identify the credential and assign a response owner
Keep the raw value out of chat messages, public issues, screenshots and AI prompts. CoreSecTech recommends a restricted incident record containing the provider, credential identifier, repository, affected commit or alert URL, first known exposure time, responsible owner and dependent services. An identifier is preferable to copying the credential itself.
If you have access, open the repository’s Security and quality → Vulnerability alerts → Secret scanning area. Open the relevant alert and inspect its locations. GitHub documents filters including secret-type: and provider:; use the supported name rather than guessing a filter. See viewing and filtering alerts. If the tab or alert is unavailable, ask an authorized repository administrator. Do not broaden your access permissions just to follow this guide.
A discovery timestamp is not necessarily the original exposure timestamp. Record both when known. Keep unknown dates explicitly unknown; do not estimate an exposure window from the alert’s position in a list.
2. Check coverage before trusting an empty alert list
GitHub’s secret-scanning overview says public repositories are scanned automatically for free. Organization-owned private and internal repositories require GitHub Secret Protection enabled on supported GitHub Team or Enterprise Cloud plans. Check your actual repository’s eligibility and configuration; a public-repository rule is not a promise of free private-repository coverage.
Scanning includes Git history across branches, and GitHub periodically rescans when new secret types are added. There is no guaranteed completion time in that statement. An older commit can therefore matter even when the current file looks clean. Partner notifications are separate from repository user alerts; their absence from that list is not proof that no provider notification occurred.
Consult the supported-patterns reference for the exact secret type and its capabilities. Detection, partner reporting, push protection and validity checking are separate features. A validity check is not supported for every pattern; “unknown” is not the same as revoked. An empty alert list does not prove that all credentials are safe.
3. Contain the credential without hiding an outage risk
GitHub’s leaked-secret remediation guide prioritizes revocation for high-risk exposure. Use the issuer’s official portal or documented process. If you lack access, escalate to the credential owner immediately. Do not paste the key into an unofficial “key checker” or make exploratory API calls to see what data it can access.
| Situation | Immediate response | Evidence to retain |
|---|---|---|
| Active production credential exposed publicly | Escalate and prioritize revocation; coordinate affected services. | Issuer confirmation and time of containment. |
| A replacement is needed to avoid an outage | An authorized owner may deploy the replacement promptly, then revoke the old credential. | Deployment verification and old-credential revocation. |
| Validity is unknown | Ask the issuer/owner to verify state; do not assume the key is harmless. | Who checked it, when, and the reported state. |
| Provider says the key was already revoked | Verify that dependent services use an approved replacement. | Revocation confirmation and service checks. |
On narrow screens, scroll the table horizontally. The replacement-first option is a brief, coordinated transition—not permission to leave an exposed credential active indefinitely. If unauthorized activity is suspected, involve the security lead before prioritizing convenience over containment. Never restore service by reactivating the leaked key.
Documentation example: revoke an npm access token
For an npm token, an authorized owner can follow npm’s revocation instructions: open the profile menu on npm’s website, choose Access Tokens, identify the affected entry, use its × delete control and confirm. Record the token identifier and action time privately, without copying the raw token.
Alternatively, run npm token list, identify the token ID, then use npm token delete 123456, replacing 123456 with that ID. The number is a documentation placeholder. Use the ID, not the truncated token value. List tokens again to confirm removal. These commands were not run for this article.
npm warns that successful revocation can take up to an hour in some cases. Record that uncertainty; deletion confirmation alone does not prove immediate containment. Keep application recovery checks separate, and do not publish a dummy package to test the leaked token.
4. Repair dependencies and investigate what happened
CoreSecTech recommends a dependency checklist: application runtime configuration, deployment platform, CI jobs, scheduled tasks and authorized integrations. For each, record an owner, replacement location and a service-specific verification step. Avoid one person assuming that another has updated production. Store the new value in the approved secret-management system, not another source file. For CI-specific controls, consult GitHub Actions secret storage; it is not a substitute for the credential issuer’s revocation process. For an npm release pipeline, our npm trusted-publishing diagnostic guide explains how to investigate the authorized release path without defaulting to another long-lived publishing token. Treat that prevention work separately from revoking an already exposed credential.
Illustrative dependency handoff: the following is a planning example, not an incident report or observed test result. Replace each role and check with the dependencies you actually identify. For an application key, include runtime configuration and deployment integrations as well as CI and scheduled jobs.
| Item | Owner and evidence to record | What it establishes |
|---|---|---|
| Exposed npm credential | Credential owner records token removal, action time and any revocation delay. | Provider action and remaining uncertainty; it does not prove service recovery. |
| GitHub Actions release workflow | Maintainer identifies the secret reference, installs an approved replacement where needed and records an authorized workflow check. | Whether the checked release path works with the replacement. |
| Scheduled publishing job | Job owner checks whether it uses the same credential and records its replacement and verification status. | Whether another dependency still needs repair. |
| Repository secret-scanning alert | Repository responder records the accurate resolution reason after remediation. | Tracking state; closing it does not revoke the credential. |
On narrow screens, scroll the table horizontally. An owner should record an actual check and its limits, or mark it pending; do not turn this example into a completed checklist without evidence.
Review provider audit records and relevant GitHub security or organization logs through authorized access. GitHub documents personal security-log review separately; use the correct log for your investigation. Record suspicious activity separately from confirmed misuse. An exposure is not proof of data theft, while an absence of visible events is not proof that nothing happened. State the time range and logs actually reviewed, including any retention or access gaps. Do not publish account identifiers or confidential log contents.
Successful application requests with the replacement establish that those checked functions work; they do not establish that the old credential has been revoked. Keep these two verification steps separate in the incident record.
5. Remove the exposure; assess history cleanup separately
Remove the credential from current source and prevent another commit from introducing it. A new commit does not erase the older one. GitHub’s sensitive-data removal guide warns that history rewriting can change commit hashes, disrupt collaborators and leave copies in forks or clones. Rewriting history cannot invalidate a credential or remotely erase somebody else’s copy.
Do not improvise a force-push as an emergency response. After containment, have the repository owner and security lead decide whether sensitive material still requires coordinated history removal. Follow the complete official procedure, including collaborator cleanup and any support involvement that applies. Making the repository private can reduce continued public visibility, but it cannot revoke the credential or recover existing copies.
For prevention, review staged changes before committing, avoid hardcoded credentials and use approved runtime secret injection. A local environment file still contains sensitive data: keep it out of source control and avoid exposing it in logs. If sensitive files are not meant to be tracked, configure the repository’s ignore rules; that is prevention, not erasure of an existing exposure.
6. Close the alert only after remediation
GitHub’s alert-resolution instructions say removing a token from the repository does not automatically close its alert. After confirming revocation and recording remediation, use Close as with the accurate reason. Closing an alert changes its tracking state; it does not revoke a key at its issuer. Do not choose “false positive” merely because you deleted the file.
Before the handoff is complete, confirm: the old credential is invalidated; necessary replacements are stored safely; affected services were checked; relevant logs were reviewed or gaps recorded; cleanup decisions have an owner; and the alert’s reason matches the evidence. Keep unresolved investigation work open separately even if credential containment is complete.
7. Prevent the next leak without overstating protection
GitHub describes push protection as a control that can block supported secrets before they reach the repository. Review applicable coverage and bypass policy with your administrator. Do not bypass a warning simply to complete a deployment. Supported patterns do not cover every possible secret. Do not deliberately commit a live credential to test detection; any separate validation exercise needs authorization and a controlled test plan.
What changed: new detectors, not automatic incident resolution
GitHub’s 5 October 2026 changelog added five secret types: lovable_api_key, logfire_token, pydantic_ai_gateway_api_key, supabase_oauth_access_token and supabase_scoped_personal_access_token. Lovable Labs also joined its secret-scanning partner program. Expanded detection can surface old exposures; it does not establish revocation, application recovery or an investigation outcome.
GitHub distinguishes provider notifications from user-facing alerts. A supported partner secret found publicly can be reported to its issuer for action. Do not interpret that notification as a guaranteed revocation or a completed investigation. Confirm the credential’s state with the provider. The announcement does not establish that every Supabase key format, every Pydantic credential or every push-protection capability is covered.
Final check: prove containment, not just a clean file
A useful response ends with evidence that the leaked credential no longer authorizes access, required services use a safe replacement and remaining exposure or investigation tasks are documented. A clean file, a closed alert and a working application answer different questions. Do not substitute one for the others.