How the attack works
Branch protection rules and repository rulesets are GitHub's main guard on important branches: they require pull request reviews and passing status checks, block force pushes and deletions, and can require signed commits. Repository administrators can delete branch protection rules and repository rulesets, organization owners manage organization-wide rulesets, and actors on a bypass list can push past the rules without removing them.
Removing or bypassing protection is the step that lets an attacker with write or admin access push straight to the default branch. A modified workflow then runs with the repository's Actions secrets and any cloud access granted through OpenID Connect, and a tampered release reaches everyone who consumes it. The removal, the bypass and the later push are separate audit log events, which makes the protection change a good early signal. The rules on this page cover removal, override and a change to a setting of a branch protection rule that stays in place (the protected_branch.update_* actions and the bypass and push allowances). A ruleset that is switched to disabled or evaluate, or that gets new actors on its bypass list, appears as repository_ruleset.update: one rule reads that action by name only, because GitHub does not describe the values of the fields that say what changed. A further rule reads the switch that turns off immutable releases, the setting that locks the tag and the assets of a published release, because a release tag pointed at other code reaches consumers without a push to a protected branch.
What an attacker needs
- Admin access to the repository (or an organization role that can manage rulesets), or membership in a ruleset's bypass list.
Impact
Unreviewed changes to source code, workflows and releases: software supply chain compromise, theft of Actions secrets and cloud credentials, and backdoored artifacts delivered to customers or internal systems.
Detection rules
GitHub Immutable Releases Disabled or Organization Policy Changed
Detects release immutability being switched off for a repository (repo.immutable_releases_settings_disabled) and a change to the organization's policy for immutable releases (org.update_immutable_releases_settings_policy). With immutable releases on, the Git tag of a published release is locked to its commit and the release assets cannot be modified or deleted. With the setting off, an account or token with write access can point the tag of a new release at other code after publication. The organization action is written for every change of the policy, in either direction: read old_policy and new_policy to see whether repositories were taken out of it. GitHub does not document the values of those two fields.
title: GitHub Immutable Releases Disabled or Organization Policy Changed
id: de58a81d-6ae5-4b2d-b490-3f8aa4bfc0a3
status: experimental
description: >-
Detects release immutability being switched off for a repository
(repo.immutable_releases_settings_disabled) and a change to the
organization's policy for immutable releases
(org.update_immutable_releases_settings_policy). With immutable releases
on, the Git tag of a published release is locked to its commit and the
release assets cannot be modified or deleted. With the setting off, an
account or token with write access can point the tag of a new release at
other code after publication. The organization action is written for
every change of the policy, in either direction: read old_policy and
new_policy to see whether repositories were taken out of it. GitHub does
not document the values of those two fields.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
- https://docs.github.com/en/code-security/how-tos/secure-your-supply-chain/establish-provenance-and-integrity/prevent-release-changes
- https://attack.mitre.org/techniques/T1195/002/
author: Forestall
date: 2026-11-18
tags:
- attack.initial-access
- attack.t1195.002
logsource:
product: github
service: audit
detection:
selection:
action:
- repo.immutable_releases_settings_disabled
- org.update_immutable_releases_settings_policy
condition: selection
falsepositives:
- An organization owner who extends the policy to more repositories writes the same organization action. Compare old_policy with new_policy.
- A maintainer who switches the setting off to correct a release process. Confirm it with the repository owners, because the setting should change rarely.
level: medium
False positives
- An organization owner who extends the policy to more repositories writes the same organization action. Compare old_policy with new_policy.
- A maintainer who switches the setting off to correct a release process. Confirm it with the repository owners, because the setting should change rarely.
GitHub Branch Protection Rule or Repository Ruleset Deleted
Detects a branch protection rule being removed, a repository ruleset being deleted, or branch protection evaluation being disabled for a repository. Any of these lets users with write access push unreviewed code to the branches the protection covered. Not covered: a ruleset switched to disabled or evaluate, actors added to a bypass list, and protection settings weakened while the rule stays in place.
title: GitHub Branch Protection Rule or Repository Ruleset Deleted
id: eb4e365b-d765-4c3a-8503-2e16640c469f
status: experimental
description: >-
Detects a branch protection rule being removed, a repository ruleset being
deleted, or branch protection evaluation being disabled for a repository.
Any of these lets users with write access push unreviewed code to the
branches the protection covered. Not covered: a ruleset switched to
disabled or evaluate, actors added to a bypass list, and protection
settings weakened while the rule stays in place.
references:
- https://attack.mitre.org/techniques/T1195/002/
- https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
author: Forestall
date: 2026-11-10
tags:
- attack.initial-access
- attack.t1195.002
logsource:
product: github
service: audit
detection:
selection:
action:
- protected_branch.destroy
- repository_ruleset.destroy
- repository_branch_protection_evaluation.disable
condition: selection
falsepositives:
- Administrators replacing branch protection rules with rulesets, or cleaning up rules for deleted branches; a matching create event shortly after usually explains it. Exclude archived or sandbox repositories by repo name if needed.
level: high
False positives
- Administrators replacing branch protection rules with rulesets, or cleaning up rules for deleted branches; a matching create event shortly after usually explains it. Exclude archived or sandbox repositories by repo name if needed.
GitHub Branch Protection Requirement Overridden
Detects a repository administrator overriding a branch protection requirement, for example merging or pushing without the required reviews or status checks.
title: GitHub Branch Protection Requirement Overridden
id: d43e7f95-9925-4b8a-ae35-0870d8d8e080
status: experimental
description: >-
Detects a repository administrator overriding a branch protection
requirement, for example merging or pushing without the required reviews
or status checks.
references:
- https://attack.mitre.org/techniques/T1195/002/
- https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization
author: Forestall
date: 2026-11-10
tags:
- attack.initial-access
- attack.t1195.002
logsource:
product: github
service: audit
detection:
selection:
action: protected_branch.policy_override
condition: selection
falsepositives:
- Emergency fixes merged by administrators. Track the overriding actors per repository and alert on new ones, or exclude release-engineering accounts by actor after review.
level: medium
False positives
- Emergency fixes merged by administrators. Track the overriding actors per repository and alert on new ones, or exclude release-engineering accounts by actor after review.
GitHub Branch Protection Setting Changed
Detects a change to one setting of a branch protection rule while the rule itself stays in place: enforcement for administrators, required pull request reviews, the number of required approvals, code owner review, approval of the last push, dismissal of stale reviews, required status checks, required commit signing, force pushes, and the users, teams or apps that may bypass the rule or push to the branch. GitHub writes the same action when a setting is tightened and when it is loosened, and documents the possible values for one of these fields only, so the rule matches on the action name and fires in both directions. Read the field that carries the new value (for example admin_enforced, required_approving_review_count or allow_force_pushes_enforcement_level) and compare it with the rule you expect on that branch.
title: GitHub Branch Protection Setting Changed
id: 08a70d4a-3226-4d5a-a172-446efb1a02f7
status: experimental
description: >-
Detects a change to one setting of a branch protection rule while the rule
itself stays in place: enforcement for administrators, required pull
request reviews, the number of required approvals, code owner review,
approval of the last push, dismissal of stale reviews, required status
checks, required commit signing, force pushes, and the users, teams or
apps that may bypass the rule or push to the branch. GitHub writes the same
action when a setting is tightened and when it is loosened, and documents
the possible values for one of these fields only, so the rule matches on
the action name and fires in both directions. Read the field that carries
the new value (for example admin_enforced, required_approving_review_count
or allow_force_pushes_enforcement_level) and compare it with the rule you
expect on that branch.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches
- https://attack.mitre.org/techniques/T1195/002/
author: Forestall
date: 2026-11-18
tags:
- attack.initial-access
- attack.t1195.002
logsource:
product: github
service: audit
detection:
selection:
action:
- protected_branch.update_admin_enforced
- protected_branch.update_pull_request_reviews_enforcement_level
- protected_branch.update_required_approving_review_count
- protected_branch.update_require_code_owner_review
- protected_branch.update_require_last_push_approval
- protected_branch.dismiss_stale_reviews
- protected_branch.update_required_status_checks_enforcement_level
- protected_branch.update_signature_requirement_enforcement_level
- protected_branch.update_allow_force_pushes_enforcement_level
- protected_branch.authorized_users_teams
- protected_branch.branch_allowances
condition: selection
falsepositives:
- Administrators who tighten a rule produce the same actions. Check the field that carries the new value before you treat the event as a weakening.
- Repository setup and infrastructure-as-code tools that rewrite branch protection on every run. Exclude the account or GitHub App they use by actor, and keep the rule for default and release branches by name where the volume is high.
level: medium
False positives
- Administrators who tighten a rule produce the same actions. Check the field that carries the new value before you treat the event as a weakening.
- Repository setup and infrastructure-as-code tools that rewrite branch protection on every run. Exclude the account or GitHub App they use by actor, and keep the rule for default and release branches by name where the volume is high.
GitHub Required Pull Request Reviews Deactivated on a Protected Branch
Detects the pull request review requirement of a branch protection rule being switched off while the rule stays in place. GitHub records the change as protected_branch.update_pull_request_reviews_enforcement_level and documents the values of the pull_request_reviews_enforcement_level field as 0 (deactivated), 1 (non-admins) and 2 (everyone). The rule matches the value 0. After the change a user with write access can merge into the branch without an approving review. GitHub does not say whether the value arrives as a number or as text, so test the query against one event of your own stream.
title: GitHub Required Pull Request Reviews Deactivated on a Protected Branch
id: 669b3040-70f0-4058-a181-0122d43b2241
status: experimental
description: >-
Detects the pull request review requirement of a branch protection rule
being switched off while the rule stays in place. GitHub records the
change as protected_branch.update_pull_request_reviews_enforcement_level
and documents the values of the pull_request_reviews_enforcement_level
field as 0 (deactivated), 1 (non-admins) and 2 (everyone). The rule
matches the value 0. After the change a user with write access can merge
into the branch without an approving review. GitHub does not say whether
the value arrives as a number or as text, so test the query against one
event of your own stream.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches
- https://attack.mitre.org/techniques/T1195/002/
author: Forestall
date: 2026-11-18
tags:
- attack.initial-access
- attack.t1195.002
logsource:
product: github
service: audit
detection:
selection:
action: protected_branch.update_pull_request_reviews_enforcement_level
pull_request_reviews_enforcement_level: 0
condition: selection
falsepositives:
- A repository that moves its review requirement from a branch protection rule to a ruleset. A ruleset created for the same branch shortly before or after explains it.
- Sandbox and personal test repositories. Exclude them by repo name.
level: high
False positives
- A repository that moves its review requirement from a branch protection rule to a ruleset. A ruleset created for the same branch shortly before or after explains it.
- Sandbox and personal test repositories. Exclude them by repo name.
GitHub Repository Ruleset Edited
Detects a repository ruleset being edited (repository_ruleset.update, which GitHub describes as a repository ruleset that was edited). An edit can weaken a ruleset without deleting it: its enforcement status can be changed from Active to Evaluate or Disabled, roles, teams or apps can be added to its bypass list, and rules can be removed from it. The rule matches on the event only. GitHub lists fields for what changed, among them ruleset_enforcement, ruleset_old_enforcement, ruleset_bypass_actors_added and ruleset_rules_deleted, but does not describe their values or say whether they are present when nothing of that kind changed, so no condition is built on them and the level is one step lower than for the other setting changes on this page. Read those fields in triage, and see the detection logic on this page.
title: GitHub Repository Ruleset Edited
id: 2464f747-1b00-4b3b-91a0-15ebe3b4f1d1
status: experimental
description: >-
Detects a repository ruleset being edited (repository_ruleset.update,
which GitHub describes as a repository ruleset that was edited). An edit
can weaken a ruleset without deleting it: its enforcement status can be
changed from Active to Evaluate or Disabled, roles, teams or apps can be
added to its bypass list, and rules can be removed from it. The rule
matches on the event only. GitHub lists fields for what changed, among
them ruleset_enforcement, ruleset_old_enforcement,
ruleset_bypass_actors_added and ruleset_rules_deleted, but does not
describe their values or say whether they are present when nothing of
that kind changed, so no condition is built on them and the level is one
step lower than for the other setting changes on this page. Read those
fields in triage, and see the detection logic on this page.
references:
- https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise
- https://docs.github.com/en/enterprise-cloud@latest/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
- https://docs.github.com/en/enterprise-cloud@latest/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/managing-rulesets-for-a-repository
- https://attack.mitre.org/techniques/T1195/002/
author: Forestall
date: 2026-11-18
tags:
- attack.initial-access
- attack.t1195.002
logsource:
product: github
service: audit
detection:
selection:
action: repository_ruleset.update
condition: selection
falsepositives:
- Administrators who add a rule, rename a ruleset or change the branches it targets, which writes the same action. Read the fields that say what changed before acting.
- Infrastructure-as-code tools that reapply rulesets on every run. Exclude the service identity they use by actor.
level: low
False positives
- Administrators who add a rule, rename a ruleset or change the branches it targets, which writes the same action. Read the fields that say what changed before acting.
- Infrastructure-as-code tools that reapply rulesets on every run. Exclude the service identity they use by actor.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Branch protection removed or weakened and restored shortly after
An attacker who needs one unreviewed push to a protected branch removes or loosens the rule, pushes, and puts the rule back, so that a later look at the settings shows nothing. A removal or a setting change that is followed by the opposite change on the same branch name pattern within a short time, with a push in between, is rarely maintenance.
- A rule is removed or a setting is changed:
protected_branch.destroyor one of theprotected_branch.update_*actions, with the repository inrepo, the branch name pattern innameand the account inactor. - Within 60 minutes a rule for the same
repoandnameis created again (protected_branch.create), or the sameprotected_branch.update_*action is written a second time for them. - Between the two events, look for
git.pushevents for the samerepo. GitHub does not show Git events in the web interface and delivers them through the REST API, audit log streaming and exports only.
Eventsprotected_branch.destroyprotected_branch.creategit.push
LimitsInfrastructure-as-code tools that reapply branch protection, and administrators who correct a mistake, produce the same pair without a push in between. The documented fields of git.push do not name the branch, so the push has to be checked in the repository itself. The 60 minutes are a starting point.
Ruleset edit that lowers enforcement, adds a bypass actor or removes rules
Most ruleset edits add rules or change the branches a ruleset targets. The edits that weaken a ruleset are a change of its enforcement status away from Active, a new entry on its bypass list and the removal of rules. The edit event carries a field for each of these, so reading them separates the weakening edits from the rest.
- A ruleset is edited:
repository_ruleset.update. Takerepo,ruleset_name,ruleset_idandactor. - Compare
ruleset_enforcementwithruleset_old_enforcement. GitHub documents the statuses Active, Evaluate and Disabled, and a ruleset in Evaluate or Disabled is not enforced. - Read
ruleset_bypass_actors_addedandruleset_rules_deleted. Alert when the enforcement moved away from Active, when a bypass actor was added or when rules were deleted, and attach the field that showed it.
Eventsrepository_ruleset.update
LimitsGitHub lists these fields for the action without describing their values or their format, so look at a few of your own events before you build on them. A ruleset that is set to Evaluate for a planned test matches as well. The check says nothing about pushes that used the weaker ruleset, which have to be reviewed in the repository.
Triage
- Identify who removed or bypassed the protection (actor), the repository (repo) and the branch or ruleset (name, ruleset_name, branch).
- Review pushes, workflow changes and releases on that repository after the event, especially changes under the workflows folder.
- If unexplained, restore the protection, revert unreviewed commits, rotate the repository's Actions secrets and review the actor's other activity.
Response
Once the attack is confirmed:
- Restore the branch protection rule or ruleset, and take the actor off repository admin rights and ruleset bypass lists until the change is explained.
- Keep the pipeline from acting on unreviewed code. Cancel workflow runs started from the affected branch since the change, and hold releases and deployments that build from it.
- Revert the commits that reached the branch without review, with particular attention to changes under the workflows folder. Compare the releases, tags and packages published in that period with their expected content.
- Rotate the Actions secrets a modified workflow could read, and review the use of the cloud roles that trust the repository through OpenID Connect in that period.
- Withdraw releases and packages that were built from unreviewed commits, and notify the teams or customers who consumed them.
- Secure the actor's account. Reset its credentials and sessions and revoke its tokens and SSH keys.
Mitigation
- Protect default and release branches with rulesets or protection rules that require reviews and status checks, and do not allow administrators to bypass them.
- Keep repository admin rights and ruleset bypass lists small; avoid admin as the organization's base permission.
- Manage critical protections as organization rulesets owned by a small security team, so repository admins cannot delete them.
- Alert on protection removal and on overrides, and review pushes to the affected branch that follow.
Frequently asked questions
Does the rule fire when a ruleset is disabled or set to evaluate instead of deleted?
Yes, but without telling you what changed. Switching a ruleset to disabled or evaluate, and adding actors to a ruleset's bypass list, are recorded as `repository_ruleset.update`, and one rule on this page matches every such edit at a low level. The fields `ruleset_enforcement`, `ruleset_old_enforcement` and `ruleset_bypass_actors_added` of the event say what changed, and the detection logic below uses them. Weakening a setting while a branch protection rule stays in place (the `protected_branch.update_*` actions) is matched by a separate rule on this page, which reads the action name and therefore also fires when a setting is tightened.
What is the difference between removing protection and overriding it?
Removal deletes the rule or ruleset, so everyone with write access can push to the branch until it is restored. An override leaves the rule in place, and an administrator merges or pushes once without the required reviews or status checks, recorded as `protected_branch.policy_override`. Removal affects everyone and lasts, while an override is one action by one actor.
Why is a protection change worth an alert before any code has changed?
The removal, the bypass and the later push are separate audit log events. The protection change comes first, so it is an early signal that leaves time to act before unreviewed code reaches the default branch and the pipelines that build and deploy from it.
How do I keep emergency merges by administrators from drowning the override rule?
Emergency fixes merged by administrators are the expected benign cause. Track which actors override protection in each repository and alert when a new one appears, or exclude release engineering accounts by actor after review. Each override should still map to a known incident or change.