policy name: pushes_are_not_restricted
severity: LOW
By default, commits can be pushed directly to protected branches without going through a Pull Request. Restrict who can push commits to protected branches so that commits can be added only via merges, which require Pull Request.
An attacker with write credentials may introduce vulnerabilities to your code without your knowledge. Alternatively, contributors may commit unsafe code that is buggy or easy to exploit that could have been caught using a review process.
- Make sure you have admin permissions
- Go to the repo's settings page
- Enter "Branches" tab
- Under "Branch protection rules"
- Click "Edit" on the default branch rule
- Check "Restrict who can push to matching branches"
- Choose who should be allowed to push
- Click "Save changes"