An organization wants to ensure that no agent-produced code reaches the main branch without passing a dependency vulnerability scan. The scan must be mandatory and cannot be bypassed by the agent or any developer without administrator override. How do you configure this guardrail?
Select an answer to reveal the explanation.
Short Explanation and Infographic
A required status check on the branch protection rule is the bouncer with the list — no one gets in without passing. Even if the agent tries to merge, even if a developer clicks approve, the merge button stays locked until the required scan passes.
Full explanation below image
Full Explanation
Required status checks in branch protection rules are the strongest automated policy enforcement mechanism in GitHub. When a status check is listed as required, the merge button for any pull request targeting that branch remains disabled until the check passes. This applies to both human-opened and agent-opened PRs, and it cannot be bypassed without administrator action to temporarily modify the branch protection rule.
Option A (scan in the agent's own workflow) is a soft control. The agent's own workflow runs before the PR is opened, but it could be disabled, modified, or bypassed. The scan result is reported by the agent itself, creating a conflict of interest. If the agent fails the scan, it might choose not to report the failure rather than not opening the PR.
Option C (security review checklist in PR template) is a human-operated control. A developer or agent can open a PR, check all the boxes without actually performing the review, and proceed to merge. Checkboxes in PR descriptions are not enforced by any technical mechanism.
Option D (agent refuses to create PR) is again a self-policing mechanism with a conflict of interest. The agent's refusal is controlled by the agent's own logic, which could be misconfigured, bypassed through a different workflow trigger, or overridden by a malicious actor with workflow modification access.
Only the required status check on the branch protection rule provides an externally enforced, bypass-resistant guardrail.