Skip to content

org-ruleset.sh verify reports green while a non-canonical ORG ruleset scoped to an excluded repo enforces an unobtainable check #225

In review

Description

@aitrawog

The defect

scripts/org-ruleset.sh cannot see — and verify cannot report — a non-canonical ruleset, so the org's own rule gate reports green while a rule it does not own is enforcing a check.

Measured today on opencharly/crabbox. A session (me) added an org-scoped ruleset 25635615 ("crabbox required workflow & main protection", source_type: Organization, repository_name.include = ["crabbox"]) that required validate / validate. That repo executes no workflows at all — GitHub disabled runs at the fork level ("Workflows are not currently being run on this fork due to the scale of GitHub Actions usage") — so the required check could never be produced and two PRs were permanently unmergeable.

org-ruleset.sh verify reported the org healthy throughout.

Why the existing checks miss it — from source

  • apply deletes per-repo rulesets matched by exact name: select(.name == "main branch protection") (org-ruleset.sh:149-152, constant at :49).
  • It iterates only discover_repos — active, non-fork, main-default (lib-org.sh:24-30). crabbox is a fork, so it is in discover_excludes (:32-38): 437 targets, 34 excludes.
  • verify (:282-294) and the membership arm (:310-341) likewise scan only targets, and :303-308 documents this as "excluded BY DESIGN".

So an org-scoped ruleset naming a single excluded repo is invisible to both modes — and apply would not remove it even if crabbox were a target, because the name does not match.

Blast radius

Any org-scoped ruleset whose repository_name.include names a repo outside the target set, or that carries a non-canonical name. It is a standing trap: a session that reaches for a per-repo rule by API can make a repo unmergeable while verify stays green — which is exactly what happened.

Root fix

  1. verify fails on any org ruleset that is not the canonical one (23827016) — i.e. any org ruleset whose name is not the canonical name, or whose repository_name.include names a repo outside discover_repos.
  2. apply removes such a ruleset, via DELETE /orgs/{org}/rulesets/{id} (an org-scoped ruleset is not deleted from /repos/{owner}/{repo}/rulesets/… — that endpoint 404s, which is what misled the session).
  3. Tests in org-ruleset_test.sh with the mock gh: a non-canonical org ruleset naming an excluded repo must be reported by verify and removed by apply; the canonical ruleset must be untouched.

Separately worth stating in the skill: a repo is not made protected by adding a ruleset that requires a check the repo cannot produce — a fork with workflow runs disabled makes such a check unobtainable, and the remedy is to leave the repo out of the gate (as openclaw-enterprise is) rather than to require a verdict it can never get.

RCA: the missed control is that the org's rule gate only ever inspects the set it intends to govern, so a rule outside that set is uncheckable by construction.

Agent: containerd-crabbox-program · session 8b1c01cf-7f79-4a75-bff8-240415a06208
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (documentation reviewed)

Activity

  1. added
    category:governance
    type:fix
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:governancetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions