Check ID: repository_default_branch_dismisses_stale_reviews
Provider: GitHub
Service: repository
Severity: HIGH
Categories: identity-access
Resource type: NotDefined

What this check verifies

GitHub repository default branch ensures that when new commits are pushed to an open pull request, any previously granted approvals are automatically dismissed, requiring fresh reviews before the pull request can be merged.

Risk

Without this setting, a contributor can receive approvals on a clean version of their code, then push malicious or unauthorized changes afterward. The pull request retains its approvals and can be merged without anyone reviewing the new changes, bypassing the entire code review process.

Recommendation

Enable “Dismiss stale pull request approvals when new commits are pushed” in your branch protection rules. This ensures every code change undergoes a fresh review before merging.

Remediation

gh api -X PATCH /repos/<OWNER>/<REPO>/branches/<DEFAULT_BRANCH>/protection/required_pull_request_reviews -f dismiss_stale_reviews=true

References

Where this check fires

This check runs on every scheduled scan against your GitHub account. Findings appear at Cloud Security → Findings filterable by Check ID = repository_default_branch_dismisses_stale_reviews. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to GitHub checks