Code review gates security findings
Demonstrate that the organization operates enforceable automated security gates during code review that prevent merging or deployment of code containing security findings above defined thresholds.
Description
What this control does
This control enforces automated quality gates within the code review process that block merge or deployment when security vulnerabilities, insecure coding patterns, or policy violations exceed defined thresholds. Static application security testing (SAST), software composition analysis (SCA), or similar tooling runs during pull request or merge request workflows and fails the pipeline when findings meet severity or count criteria. This prevents vulnerable code from reaching production environments and shifts security accountability left into the development lifecycle.
Control objective
What auditing this proves
Demonstrate that the organization operates enforceable automated security gates during code review that prevent merging or deployment of code containing security findings above defined thresholds.
Associated risks
Risks this control addresses
- Injection vulnerabilities (SQL, command, LDAP) introduced through unreviewed code reach production systems
- Use of libraries with known CVEs is merged into mainline branches without detection or remediation
- Hard-coded secrets, API keys, or credentials are committed to version control repositories
- Insecure cryptographic implementations or use of deprecated algorithms bypass human review
- Authorization bypass or privilege escalation flaws are deployed due to lack of automated enforcement
- Cross-site scripting (XSS) or other client-side vulnerabilities are introduced without blocking mechanisms
- Developers bypass or disable security checks without governance oversight or audit trail
Testing procedure
How an auditor verifies this control
- Obtain the list of all active code repositories and CI/CD pipeline configurations used for production application deployments.
- Select a representative sample of repositories across application tiers (front-end, back-end, API, infrastructure-as-code).
- Review each repository's branch protection rules and merge policies to identify configured automated security checks.
- Examine CI/CD pipeline definitions (e.g., Jenkinsfile, GitHub Actions workflows, GitLab CI YAML) for SAST, SCA, or secret scanning tool integration.
- Retrieve configuration files for security scanning tools to verify threshold settings, severity levels, and fail conditions.
- Identify recent pull requests or merge requests and inspect pipeline execution logs to confirm security gates were invoked and results evaluated.
- Test enforcement by reviewing examples of blocked merges due to security findings or requesting demonstration of a simulated failing security gate.
- Verify existence of override or exception workflows and review audit logs for any bypass events, including approver identity and justification.
Where this control is tested