Github Force Push Allowed
Description
Detects when the protection rule of a GitHub repository's default branch permits force pushes. A force push rewrites the branch history, so commits that were reviewed and merged can be replaced or removed without leaving a trace in the branch, defeating the audit trail the protection rule exists to provide.
Detection Strategy
• Lists every repository in the GitHub organization, taking the default branch name and the caller's permissions from the listing itself
• Skips repositories where the credential lacks admin permission, since branch protection cannot be read without it
• Requests the branch protection settings of the default branch and reads the nested enabled flag of the force push setting
• Reports a vulnerability when force pushes are allowed; a branch with no protection rule at all is left to the protection check so that one setting does not produce two findings
Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.