Bypassing required reviews using GitHub Actions
An attacker with write access to the repository could bypass branch protection rules that require all pull requests undergo a code-review before being merged. The issue is just a logic issue rooted in the fact that firstly, anyone with write access can create an unprotected branch and define GitHub Actions for it, and secondly that a GitHub action can perform code reviews (though restrictions can be added on who the approved reviewers are). So by creating a branch with an action that will use the GITHUB_TOKEN
to add a review to a pending PR an attacker could bypass some forms of branch protection rules.
It is worth pointing out that this does write write access to the repository already, but the purpose of branch protection rules is precisely that situation, to mitigate the damage a compromised but authorized user could do.