DET-056 · human · confidence High
Forced Pushes and Protection Bypass
Alert on forced updates to protected branches and on branch protection being turned off.
Push webhooks carry a forced flag, and code hosts log protection changes and bypasses. On GitHub, protected_branch.policy_override, protected_branch.destroy, repository_ruleset.update and repository_ruleset.destroy cover the main cases. Correlating a protection change with a forced push in the same hour catches the disable, rewrite, re-enable pattern.
Old commits can often be recovered from pull request refs, CI checkouts, forks or other developers' clones. Capture them quickly, because the host may garbage-collect unreachable objects. Bypass actors listed on rulesets are the people to check first.
- Data sources
- GitHub audit logPush webhooksGitLab audit events
- Platforms
- SaaS
Logic
1. Push events where `forced == true` and `ref` in default or release branches.
2. Audit actions in ("protected_branch.policy_override", "protected_branch.destroy", "protected_branch.update_allow_force_pushes_enforcement_level", "repository_ruleset.update", "repository_ruleset.destroy").
3. Alert when (2) and (1) occur on the same repo by the same actor within 60 minutes.
4. Compare deployed SHAs from CD logs with `git cat-file -e`; missing SHAs mean history was rewritten.False positives
Release managers fixing a broken merge, and repository migrations.