GitHub has extended repository rulesets with a new secret scanning rule that can prevent a pull request from merging if the PR introduces any secret‑scanning alerts. This adds a gate at the PR stage, complementing push‑time protection and giving teams a second line of defense against accidental secret exposure.
What Changed
A new rule type, require_secret_scanning_alert_resolution, can be added to a ruleset. When enabled, the rule enforces two conditions before a PR can be merged: the head commit must have completed a secret scan, and no alerts may remain open for secrets introduced by the PR’s commits. By default the rule applies to alerts found via provider‑defined patterns, but it can be expanded to cover custom or generic patterns via the secret_types parameter. The feature is in public preview for customers with GitHub Secret Protection or GitHub Advanced Security, and it can be configured through the UI (Repository > Rulesets) or via the REST and GraphQL APIs.
Why It Matters for Engineers
AI, cloud, and platform engineers often embed API keys, tokens, or model credentials in code repositories. Even with push protection enabled, some secret types—especially generic patterns—may slip through if push protection is disabled for them. This PR‑level rule catches those cases, ensuring that a merge cannot introduce a new secret into the main branch without first being resolved. For DevOps and SRE teams, the rule reduces the risk of secret leakage during the review process, aligning with compliance requirements that mandate no secrets in production code.
Operational and Security Implications
Adopting the rule changes the merge workflow: developers without bypass permissions must address each alert before merging, which may involve revoking the secret, rotating it, or moving it to a secret manager. Teams need to audit existing rulesets to decide which branches should enforce the rule and whether to include custom patterns. Because the rule only blocks merges when alerts are present, it does not interfere with pushes that are already blocked by push protection, but it does add a potential merge‑time failure that CI pipelines must handle. Monitoring should be updated to surface unresolved secret alerts on open PRs, and automation can be added to comment on PRs with the specific alerts that need resolution.
Related CloudNinjas coverage: security.
What This Means For Practitioners
Review your organization’s GitHub rulesets and enable require_secret_scanning_alert_resolution on any branch where you enforce code quality and security gates. Ensure that developers have a clear process for resolving alerts—typically by removing the secret from code and storing it in a managed vault. Update CI scripts to check for the rule’s block status and surface actionable messages. Finally, keep an eye on the public preview status and any upcoming changes to the rule’s default pattern set, as expanding coverage could affect merge latency.

