Detection: Branch Protection Disabled
Overview
Detect when branch protection was disabled in a GitHub repository. Disabling branch protection may expose the repository to unauthorized changes, force pushes, or unreviewed commits, increasing the risk of code tampering and security vulnerabilities. Monitoring these events helps maintain repository security and enforce development best practices.
References:
Usage
Run the detection in your terminal:
powerpipe detection run github_audit_log_detections.detection.branch_protection_disabled
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe detection run github_audit_log_detections.detection.branch_protection_disabled --share
SQL
This detection uses a named query:
select tp_timestamp as timestamp,action as operation,concat('https://github.com/', repo, '/tree/', additional_fields ->> 'name') as resource,actor,tp_source_ip as source_ip,tp_index as organization,split_part(repo, '/', 2) as repository,tp_id as source_id,*exclude (actor, timestamp)
from github_audit_logwhere action = 'protected_branch.destroy'order by tp_timestamp desc;