1iT - IT and Security Solutions
    Cyber Security
    Incident Response

    API Key Exposed on GitHub: Stop the Exposure and Restore Business Operations

    Revoke an exposed API key, replace it across business services, investigate unusual usage and charges, and prevent another leak.

    By 1iT5 min read
    Illustration of an access key removed from a cloud access unit beside a business computer.

    Responding to an API Key Exposure on GitHub: Stopping Access and Restoring Operations

    An API key exposed on GitHub may let others perform operations and incur charges on your business account, depending on its permissions. Revoke the key with its issuing provider, update the services that depend on it, and check for unusual usage. This guide covers stopping access, replacing the key, investigating the incident, and preventing repeat exposure.

    This guide is for businesses whose website, automation, or customer service system depends on an exposed key. The aim is to stop unauthorized use and maintain a business process you can verify. The operations manager tracks the impact on employees and customers, development maps the applications, and the IT manager coordinates permissions and providers. Even when one person fills several roles, you need a decision owner and a single record of actions and checks.

    Last updated: November 23, 2026.

    API key exposed on GitHub: what should you do immediately?

    The urgent action is to remove the exposed key's ability to access the provider's service. According to GitHub's guidance on remediating leaked secrets, an exposed secret should be treated as compromised. Open an incident ticket through your business's established support channel, identify the affected business service, and assign an incident manager. Contact whoever can revoke the credential without waiting for code cleanup. If you find malicious activity or the key has broad permissions, prioritize stopping access even if this disrupts service.

    Immediate action priorities
    • Deleting the file does not revoke access at the provider.
    • Coordinate production key replacement with development and the IT manager, and verify that the old key is inactive.
    • Review usage logs, resource changes, and charges throughout the exposure window.
    • Manage access revocation, repository cleanup, and controls to prevent recurrence as separate tasks.

    When the key powers a critical production service, the incident manager and technical owner must decide whether to revoke it immediately or urgently prepare a replacement and switch the service over. Overlap keeps the exposed key active too, so it needs an owner and a defined end. Give support the repository link, file path, commit ID, discovery time, and a nonsecret key identifier. Do not send the key value, passwords, verification codes, or authentication QR codes.

    1
    Stop access at the provider
    Owner: the account owner or an authorized administrator. Revoke the key following the provider's documentation. Completion evidence: key status and revocation time.
    2
    Update dependent services
    Owner: development, coordinated with the IT manager. Store the replacement through the secrets mechanism. Completion evidence: service inventory and test results.
    3
    Start a usage review
    Owner: the IT manager and service owner. Preserve available logs. Completion evidence: review period, findings, and information gaps.

    How do you identify a secret and the systems that depend on it?

    Identify a secret by the credential type and permissions documented by the provider, rather than its variable name in code. Open the key record in the business account and compare its identifier, environment, and permissions with its intended use. Check whether it permits reading data, writing, managing resources, or paid consumption. A test key still needs investigation: does the test environment contain business data, and can it access another service? If its classification is unclear, restrict its distribution until verified.

    Some keys are intended to appear in a browser. For example, Stripe distinguishes publishable keys from secret and restricted keys. The examples below are dummy values only and are not valid credentials. Do not apply Stripe's prefixes to other providers. After classification, ask development to map the website, servers, scheduled jobs, and integrations using the key. In an Israeli business, the website developer may own the connection between a contact form and a customer management system, while the business owns the account and billing; both must participate in the replacement.

    Stripe example type

    Meaning

    Decision

    `pk_test_DEMO_ONLY`

    Publishable key intended for client-side code too

    Verify suitability against the documentation

    `sk_test_DEMO_ONLY`

    Secret key

    Respond to exposure even in a test environment

    `rk_test_DEMO_ONLY`

    Restricted-permission key that remains secret

    Review permissions and revoke the exposed credential

    How do you replace a production key and verify business operations?

    Replacement is complete when services use the new credential and the provider has revoked the old key. Start with an inventory of dependent services and owners, including services that run infrequently. Issue a replacement with the permissions its service role requires, and store it in a secrets management system: a system that centralizes credentials and restricts access to them. Do not copy a broadly privileged administrator key into every integration. Plan overlap only when the provider supports it and the risk justifies it; otherwise, prepare for a coordinated update and possible interruption.

    Updating a vault does not prove that the application is already using the new value. Microsoft recommends refreshing cached values after secrets are rotated. Check the active configuration on the server and in the deployment process, then refresh or redeploy as appropriate for the system. Choose a business acceptance test, such as sending a test inquiry without personal details from the website to the customer management system. The operations manager confirms receipt, and development records the request result. If it fails, fix the replacement or pause the integration; do not return to the exposed key.

    1
    Prepare the replacement and inventory
    Owner: the service owner and development. Prepare a replacement key and inventory the services that use the exposed key. Completion record: replacement identifier, its permissions, and dependent services.
    2
    Switch over and test
    Owner: development and the operations manager. Switch the services to the replacement and test the business process. Completion record: deployment version, tested process, and actual result.
    3
    Verify access is closed
    Owner: the IT manager. Verify that the old key has been revoked and that no services retain the old configuration. Completion record: provider revocation and results of checks on dependent services.

    How do you investigate unusual usage and Israeli reporting obligations?

    Check for unusual usage in provider logs and the resources the key could access, alongside billing data. Start from the earliest possible exposure, rather than just the alert time. Compare timestamps, request sources, operations, and resources with known application activity, where logs allow. Ask finance to compare consumption with previous invoices and usage reports. A suspicious result requires investigation; normal billing does not rule out data access. If logs are incomplete or cannot identify a particular key, record that limitation.

    If personal information may have been accessed, involve those responsible for privacy and legal advice during the response. The definition of a serious security incident distinguishes between security levels: for a database subject to a high security level, unauthorized use of information from the database, use beyond the scope of authorization, or damage to information integrity may qualify as a serious incident even if it affects any portion of the database; for a database subject to a medium security level, the threshold is unauthorized use or use beyond the scope of authorization involving a substantial portion of the database, or damage to information integrity affecting a substantial portion of it. See the definition and thresholds in Israel's Privacy Protection Authority guidelines for reporting a serious security incident.

    Regulation 11(d)(1) of the Privacy Protection Regulations (Data Security), 5777-2017, Israel's data security regulations, requires immediate reporting to the Authority of a serious security incident and the steps taken in response. Key exposure alone does not determine every obligation arising from the incident; assess the permissions, database, and circumstances. The Authority states that a report should be submitted when in doubt, so do not postpone this assessment until the investigation ends.

    Investigation item

    What to preserve and review

    Owner

    Exposure time

    Earliest known commit, repository visibility, and time zone

    Repository maintainer

    Key permissions

    Environment, resources, and permitted operations

    Account owner

    Affected services

    Dependent services, owners, and operational impact

    Development and operations

    Usage and charges

    Log coverage, suspicious requests, and consumption

    IT and finance

    Actions taken

    Revocation, replacement, results, and open tasks

    Incident manager

    When should you clean Git history, and how do you prevent another leak?

    History cleanup depends on the remaining information and risk; it is not a prerequisite for revoking the key. GitHub explains that revoking a secret may be sufficient, while additional sensitive information warrants considering removal. Deleting a line or repository, or making it private, does not eliminate existing copies. Rewriting changes commit IDs and may affect pull requests and signatures; coordinate it with developers. Local copies and forks, which are repository branches maintained as separate repositories, require separate action. References and cached views may remain after rewriting; GitHub assistance is subject to its documented conditions.

    To prevent recurrence, remove secrets from code and shared AI tool configuration files. Review `.env` files, build artifacts, and CI/CD logs—CI/CD refers to automated testing and deployment processes. Environment variables should supply secrets on the server; a value passed into a browser bundle is exposed to its users. Git documentation clarifies that `.gitignore` does not affect a file already tracked and does not erase history. For human access sharing, see the business password manager guide. Add secret scanning and review changes before pushing, and use separate keys for services and environments. Following Microsoft's guidance, restrict secret access and permissions to what is needed.

    Assign a recipient for usage, spending, and secret scanning alerts, and check which controls your licensing and configuration support. Update permissions after role changes or employee departures, and verify that replacements have appropriate access without sharing an administrator account. Identity and access management helps formalize this responsibility. Managing the incident through cyber incident response requires coordination with development and providers. Close the incident only when you have revocation records, service tests, investigation conclusions, and owners assigned to resolve remaining gaps.

    Frequently asked questions

    Is deleting the file or making the repository private enough?
    No, these actions do not revoke a key with its provider. The secret may remain in history and existing copies. Revoke it separately and assess whether history cleanup is also necessary.
    What should you do when you receive a Secret scanning alert?
    Identify the provider, exposure location, and owner, then verify the key's validity with the provider. Secret scanning detects exposed secrets; closing an alert does not revoke a credential. Document remediation before marking the alert resolved.
    How do you find unusual charges?
    Compare the provider's usage and billing reports with expected business activity during the exposure period. If you find an anomaly, contact the provider through its official support channel with request identifiers and timestamps. Do not assume a refund will be issued or that no charges means no usage.
    Who is responsible when an external provider manages the website?
    The business should assign an incident manager, and the website provider should identify and update components under its responsibility. The account owner revokes the credential, while the IT manager coordinates testing and records. Assign explicit responsibility even when different parties manage the account, code, and billing.
    Coordinate incident response and verify recovery
    Contact 1iT to coordinate the incident, restrict access, and verify recovery, in coordination with your development team and service providers and within the agreed service scope.
    Cyber incident response
    Cyber Incident Response & Ransomware Recovery for Business | 1iT
    Cyber incident response for business: isolating systems, closing access, reviewing accounts, cleaning endpoints and restoring from backup after ransomware, an account breach or a security incident.