Skip to content

fix(github): match trusted owner lists without regard to case - #629

Open
Exypte wants to merge 2 commits into
mainfrom
fix/623-trusted-owners-case-insensitive
Open

Exypte wants to merge 2 commits into
mainfrom
fix/623-trusted-owners-case-insensitive

Conversation

@Exypte

@Exypte Exypte commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

fix

What this PR does / why we need it:

GitHub resolves the owner and repository in uses: without regard to case, but three allowlist checks compared them literally, so a differently spelled trusted owner was reported (false positives only):

 _is_trusted_owner      (action_unpinned.rego, ISSUE-701)
-  startswith(uses, "<trusted>/")
+  segment by segment: owner and repo case-insensitive, deeper path exact
 _in_allowlist          (action_authorized_sources.rego, ISSUE-713)
-  glob.match(pattern, ["/"], owner/repo)
+  glob.match(lower(pattern), ["/"], lower(owner/repo))
 _is_official           (action_authorized_sources.rego, ISSUE-713)
-  owner in {"actions", "github"}
+  lower(owner) in {"actions", "github"}

The ref and any path below the repository stay case-sensitive, as on GitHub (tested in the issue comment).

Also:

  • isTrustedOwner in control/github_stats.go now matches entries the same way as the Rego: segment by segment, ignoring case in the owner and repository. Before, it compared only the owner, so an owner/repo entry exempted a reference from ISSUE-701 but still counted it in actionRefsTotal.
  • defaultConfig/.plumber.yaml: the "CASE-SENSITIVE" note and the 17 lowercase case-aliases (azure/*, apple-Actions/*, …) are gone; each has its canonical entry in the list.
  • Docs: docs/GITHUB_ISSUES.md and the schema_docs.go descriptions (catalog golden regenerated).

Which issue(s) this PR is related to:

Closes #623

Special notes for your reviewer:

trustedOwners entries with a path (owner/repo/sub) keep the old prefix semantics; only their first two segments ignore case.

make lint with golangci-lint 2.15.0 locally reports 7 reflect.Ptr inlining hints in configuration/schema.go, configuration/schema_test.go and control/catalog.go. These files are untouched, and the hints most likely come from the newer local linter.

Does this PR introduce a user-facing change?

ISSUE-701 (trustedOwners) and ISSUE-713 (trustedGithubActions, trustGithubOfficialActions) match the owner and repository of a `uses:` reference without regard to case. `SomeOwner/x@v1` is covered by `someowner`, and `Actions/checkout@v4` counts as official. Fewer false positives; no configuration change needed. Lowercase duplicates in a custom allowlist become redundant.

How was this tested?

  • New policies/trusted_owner_case_test.go: steps and reusable workflows with mixed-case owners against both lists, plus a path-exactness case (myorg/tools/sub does not cover myorg/tools/Sub/x). New TestAggregate_TrustedOwnersIgnoreCase in control/github_stats_test.go. TestAggregate_TrustedOwnersMatchLikeRego covers owner/repo and path entries in the counter. All three failed before the fix.
  • go test ./... passes.
  • plumber analyze on a local clone of getplumber-examples/cli-working-lab with the issue's config (trustedOwners: [actions, github, someowner], trustedGithubActions: [someowner/*]):
uses: Before After
SomeOwner/some-action@v1 ISSUE-701 + ISSUE-713 none
Actions/checkout@v4 ISSUE-701 + ISSUE-713 none
someowner/other-action@v1 none none

AI usage disclosure:

YES. Claude Code reproduced the bug, wrote the fix and tests, and drafted this description; the author reviewed the changes and is responsible for them.

🤖 Generated with Claude Code

GitHub resolves the owner and repository in `uses:` case-insensitively,
but trustedOwners (ISSUE-701), trustedGithubActions and the official
actions/github owners (ISSUE-713) were compared literally, so
`SomeOwner/x` or `Actions/checkout` was reported although trusted.
The owner and repository now match case-insensitively; a path below
the repository and the ref stay exact. The stats counter follows, and
the lowercase aliases in the default trustedGithubActions are dropped.

Closes #623

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The action-pinning counter compared only the owner of a reference with
each trustedOwners entry, so an `owner/repo` or deeper entry exempted a
reference from ISSUE-701 but not from actionRefsTotal. It now compares
segment by segment like _is_trusted_owner, with strings.ToLower to match
Rego's lower(). The docs no longer say an entry matches the ref: the
ref is cut off before matching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ISSUE-701 / ISSUE-713: trusted owner lists are matched case-sensitively

1 participant