Skip to main content
RunBook Academy

Git, CI/CD & GitOpsXXXI · CODEOWNERS and Ownership ControlsBypass

CODEOWNERS and bypass — who can override the rule and what is left behind

Advanced⏱ ~20 mingit

What you'll learn

  • List the bypass actors and the conditions under which they can override a CODEOWNERS requirement
  • Trace the audit trail that bypass leaves behind and identify what an auditor can and cannot recover
  • Distinguish "no CODEOWNERS rule" from "CODEOWNERS rule bypassed" in an audit
  • Identify the limit of CODEOWNERS as a control and the compensating controls that close the gap

Prerequisites

Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x

Not yet marked complete on this device.

Every CODEOWNERS gate has a bypass. The bypass exists because incidents require immediate action and waiting for an unavailable CODEOWNER is not an option. The bypass is not the enemy of the control; the bypass is part of the control. The enemy is bypass without audit.

Bypass actors

Every forge names its bypass actors slightly differently, but the set is the same:

  • Repository administrators: users with the Admin role on GitHub, Maintainer role on GitLab.
  • Users or teams explicitly listed in the bypass configuration: GitHub’s “Allow specified actors to bypass required pull requests” lists users and teams that can merge PRs that fail the CODEOWNERS check.
  • Emergency break-glass accounts: a small, named set whose use is logged and alarmed - typically the on-call lead and a backup.
flowchart LR
    A[CODEOWNERS gate blocks merge] --> B{Bypass actor invoked?}
    B -->|no| C[Merge remains blocked]
    B -->|yes| D[Bypass event recorded]
    D --> E[Merge proceeds with audit annotation]
    E --> F[Audit trail captures actor, time, reason]

Bypass is configured per branch. The default behaviour is that no actor can bypass; production forges almost always list some actors because incident response requires it.

What bypass leaves behind

Bypass is not invisible. Every forge records bypass as an audit event. The minimum record: actor, action, timestamp, target PR, and (optionally) reason. Many forges make the reason field optional; production teams should make it required.

git ls-files | grep CODEOWNERS

The audit log answers “did this rule ever fail to apply, and if so, who made it not apply?”. A bypass that is not in the audit log is a bypass that did not happen - either a feature (the rule never failed) or a control failure (the rule failed and the failure was hidden).

The limit of CODEOWNERS as a control

CODEOWNERS is a routing layer over a permission system. The permission system has admins. Admins can do anything the forge allows, including bypassing the rules they themselves configured. This is not a flaw; it is the design. The implications:

  • CODEOWNERS cannot prevent insider action. A determined admin with merge rights can bypass CODEOWNERS, push directly, or rewrite history. CODEOWNERS is a process control, not a security boundary against insiders.
  • CODEOWNERS cannot prevent force-push or history rewrite unless branch protection additionally prevents those. Many forges allow admins to override even branch protection, on the principle that admins must be able to recover from mistakes.
  • CODEOWNERS is one control in a stack. Branch protection prevents direct pushes. Status checks verify code correctness. Signing prevents author spoofing. Audit logs capture what actually happened. None alone is a complete control; the stack is the control.
flowchart LR
    A[CODEOWNERS] --> F[Governance stack]
    B[Branch protection] --> F
    C[Status checks] --> F
    D[Signed commits] --> F
    E[Audit log] --> F

Production discipline

Three rules. Bypass actors are configured narrowly: two to four named individuals, no more; teams in the bypass list are forbidden. Bypass events generate alerts: every bypass event is paged to security and requires an incident ticket within one business day. Bypass is reviewed at every incident retrospective: was it necessary, was it the right path, and what could have prevented it from being needed.

Cross-course references

  • Linux for Production Sysadmins - Part XIV (AuditLogging) covers audit logging at the OS layer; the patterns are the same.

Quiz

Knowledge check · 4 questions

  1. Q1. An admin merges a PR that fails the CODEOWNERS requirement during an incident. What should the audit trail record?

  2. Q2. CODEOWNERS can prevent a determined administrator with repository admin rights from merging an unauthorised change.

  3. Q3. List the four fields that a bypass audit event must capture to be useful in a post-incident review.

  4. Q4. Diagnose why a CODEOWNERS bypass did not generate an alert.

    During a sev-1 incident, an admin bypasses the CODEOWNERS requirement and merges a hotfix to the default branch. The merge succeeds and the incident is resolved. Six months later, security asks for the list of all CODEOWNERS bypass events in the last quarter. The forge's audit log shows zero bypass events, even though the team is certain the bypass happened.

Passing score: 75%. Answers are checked in this browser.