Respond strategically to a security incident affecting organizations or repositories in your GitHub enterprise.
The guidance in this article is aimed at enterprise owners, organization owners, security managers and security teams. However, you will need to have the enterprise owner role to perform several of the actions outlined in this article. Some steps may require coordination with organization owners or repository administrators.
This guide walks you through how to respond to a security incident, outlining the GitHub surfaces you can use to validate and investigate a threat, and the tools you can use to contain and remediate it.
The steps here are general guidelines. Every incident is unique and may require different approaches based on the specific circumstances.
While GitHub Support can assist with platform-specific questions, you are best placed to investigate and respond to a security incident affecting your systems and resources.
Investigating and responding to an incident is self-service. Before an incident occurs, enterprise owners should enable enterprise audit log streaming, API request event streaming, and source IP address disclosure. Without all three features enabled at the enterprise level, responders will have critical visibility gaps when investigating incidents affecting the enterprise or its organizations. Enterprise owners should also set an appropriate retention period for the streamed logs and ensure incident responders can access them. See Preparing for a security incident.
As you progress through your response, make sure that you:
The goal is to quickly determine whether the signal you're seeing is likely to be a real and active threat.
Try to identify the nature of the signal you're seeing. For example, does the signal show indications of:
For help identifying these threat signals across your organization or enterprise, consult Common security incident investigation areas.
Note
[!NOTE]
Runner IP addresses are dynamically assigned from shared infrastructure and may be flagged due to unrelated activity. For more information, see Troubleshooting workflows.
We suggest you don't spend too much time on deep inspection in the earlier stages of your investigation, since the initial goal is to identify the threat signal in order to validate it and strategize your response.
Check for evidence to validate that the potential threat is real, and whether or not it's currently active.
The following GitHub tools and surfaces can help.
| Tool / surface | Purpose |
|---|---|
| Security overview and security alerts | Review security alerts across your organization or enterprise |
| Audit logs | Search for events related to the signal you're investigating, such as token creation, permission changes, or repository visibility changes |
| Activity view | View a timeline of pushes, commits, and branch activity for a specific repository |
| GitHub code search | Search for known indicators of compromise, such as specific filenames or code patterns, across repositories |
| Dependency graph | Check whether repositories depend on a specific package or package version |
| Workflow runs and logs | Review workflow execution history and inspect log output for suspicious activity |
For details on each tool, see Investigation tools for security incidents.
The validation phase can be quick:
Based on the evidence gathered, determine three things:
If in doubt, treat the threat as real, and scale back your response as evidence allows.
The next step assumes you are dealing with a real and active threat. The goal now is to immediately reduce ongoing risk using what you know so far.
There are several containment actions you can choose to perform to limit the attacker's access and capabilities.
Important
You should base your choice of actions on the nature of the threat, the potential scope, and the evidence you have at this point. We don't recommend taking all of these actions for every incident. Some actions are more disruptive or destructive than others, so you must weigh the risks and benefits of each action based on your assessment of the nature of the threat above.
For exposed or exploited credentials, the most immediate action you can take is to revoke the affected credentials to prevent further misuse.
Revoke via the API
If the token is one of the following types, and the literal value of the token is known, you (or anybody) can revoke it by submitting a request via the REST API. See Revocation.
Revocation and containment options
There are additional options for blocking credential access. For a full list by credential type, see GitHub credential types reference.
Revoke or delete credentials for a specific user
If you've identified a specific compromised account, enterprise or organization owners on GitHub Enterprise Cloud can revoke SSO authorizations for that individual user. For enterprises with Enterprise Managed Users, you can also delete credentials entirely. This is less disruptive than bulk actions while still containing the threat. See Revoking authorizations or deleting credentials in your enterprise.
Revoke or delete credentials of a specific type
If the incident is limited to one credential type, such as personal access tokens (classic), enterprise or organization owners can revoke SSO authorizations or delete credentials of that type only, across all members, using the GitHub UI. This targets the affected credential type without disrupting other credentials. See Revoking authorizations or deleting credentials in your enterprise.
Emergency actions (major incident)
Enterprise and organization owners on GitHub Enterprise Cloud can take bulk emergency actions to lock down access across their enterprise or organization. For enterprises with Enterprise Managed Users, this includes deleting all user tokens and keys. These are high-impact actions that will break automations and should be reserved for major incidents. See Responding to security incidents in your enterprise.
All of these de-authorization and revocation actions, whether initiated by an admin or by the affected user, are recorded in the audit log, and the affected user receives an email notification.
To restrict access to the enterprise, organization or repository, there are several immediate actions you can take.
Configure IP allowlists
Block unknown or suspicious IP addresses from accessing the organization or enterprise. See Restricting network traffic to your enterprise with an IP allow list (enterprise admins) and Managing allowed IP addresses for your organization (organization owners).
Remove compromised or suspicious users
Remove the user or suspend the account. See Removing a member from your organization (organization owners).
Change repository visibility to private
Change the affected repository's visibility to private, and restrict the ability of others to make further changes. For example, if sensitive code was exposed in a public repository belonging to the organization, or if a malicious actor changed the repository's visibility setting from private to public, you can change the visibility of the repository. See Setting repository visibility (repository administrators and organization owners) and Restricting repository visibility changes in your organization (organization owners).
Emergency actions (major incident)
Enterprise owners on GitHub Enterprise Cloud can take bulk emergency actions to lock down access across their enterprise. These include locking down SSO to block all non-owner access and revoking all user SSO authorizations across organizations. These are high-impact actions that will break automations and should be reserved for major incidents. See Responding to security incidents in your enterprise.
Stop malicious workflow runs
If you suspect that a GitHub Actions workflow or runner is being used as part of an active attack, you can take the following actions:
Disable webhooks
If you suspect that a compromised repository or organization webhook is being used as a live data exfiltration channel, you can disable it. See Disabling webhooks.
Delete malicious branches
If you've identified branches that contain malicious code or workflows, delete them immediately to prevent execution. See Managing branches within your repository.
After immediate containment, the goal now is to understand the full scope and impact of the incident, identify all IoCs and persistence mechanisms, and gather the evidence you need to contain and fully remediate the threat.
Incident response is not a linear process. You may need to iterate between investigation, containment, and remediation as you discover new IoCs or understand more about the attack.
Based on the signals you've seen and the evidence gathered so far, develop a working hypothesis of what has happened and decide what additional evidence you will need to prove or disprove that hypothesis.
Consider the different investigation areas outlined in Common security incident investigation areas to help guide your investigation.
Don't limit your investigation to a single line of inquiry. Many attacks use a combination of techniques, such as malicious package installation combined with credential exploitation, workflow file injections, and data exfiltration. Ensure that you are investigating all potential attack vectors.
Document all known IoCs so far, searching for traces across all surfaces of GitHub.
Inventory all the affected workflows, repositories, and organizations to capture the scope of the incident systematically.
Validate your working theory against the evidence.
Circle back to containment if you discover new IoCs or evidence of ongoing activity that requires immediate action.
Once you have high confidence in your understanding of what's happened and the root cause, document your findings and proceed to remediation.
The goal now is to remove all traces of compromise, fix the root cause, and restore systems to a secure state. Remediation actions will depend on the exploitation you have faced, but some good practices are as follows.
Even if you're not certain a credential was compromised, rotate it if there's any possibility of exposure.
You will need to check for persistence mechanisms that the attacker may have established to maintain access even after your initial containment actions.
This includes, but isn't limited to, checking for things like:
Compromised dependencies can serve as an attack vector. Make sure you undertake a full audit of your dependencies and reinstall them from trusted sources.
type:malware in the GitHub Advisory Database and audit your dependency graph for matches.Confirm that your remediation efforts have been successful.
Thorough documentation is essential for the remaining phases and for future reference.
The goal now is to learn from the incident and strengthen your security posture to prevent similar incidents.