Ensure code owner approval is required for owned code changes
Framework Reference: A.8.25 (Secure Development Lifecycle) Integration: GitHub – Branch Protection
Why this matters
Requiring code owner approval ensures that subject-matter experts review and approve any changes made to the parts of the codebase they own.
This helps maintain code quality, accountability, and compliance with secure development practices.
Without mandatory reviews from code owners, unverified changes could bypass critical oversight, introducing security or stability risks.
What this check does
This check verifies that:
- A CODEOWNERS file exists in the repository, defining ownership for files or directories.
- A branch protection rule is configured with the “Require review from Code Owners” option enabled for the protected branch (e.g.,
main
). - If either the CODEOWNERS file is missing or the branch rule does not require code owner reviews, the check will fail or return “Unable to verify.”
How to fix it
From the GitHub Web Console
- In your repository, create or confirm a CODEOWNERS file in one of the supported locations:
.github/CODEOWNERS
CODEOWNERS
(root directory)docs/CODEOWNERS
(GitHub Docs – File location and syntax)
- Navigate to Settings → Branches.
- Under Branch protection rules, create or edit the rule for your main or protected branch.
- In the “Pull request reviews” section, enable Require review from Code Owners.
- Save the rule.
After this is configured, GitHub will require at least one code owner to approve any pull request that modifies files they own.
Exceptions
- The requirement only applies if a CODEOWNERS file exists and maps the changed files.
- Admins can bypass this rule unless “Include administrators” is enabled in the branch protection settings.
- If multiple owners are listed for a path, approval from any one of them satisfies the requirement.