Skip to content

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

Merged
thomasboni merged 2 commits into
mainfrom
fix/623-trusted-owners-case-insensitive
Nov 26, 2026
Merged

thomasboni merged 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

Exypte and others added 2 commits November 26, 2026 15:31
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>
@Exypte
Exypte force-pushed the fix/623-trusted-owners-case-insensitive branch from e7b9e11 to 72d3bc3 Compare November 26, 2026 14:31
"trustGithubOfficialActions": true,
"trustSameOrgActions": false,
"minimumStars": 0,
"trustedGithubActions": []any{"someowner/*", "acme/deploy", "myorg/*"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Test coverage

Medium: No test exercises a mixed-case trustedGithubActions entry matching a differently-cased ref, so the lower(pattern) normalization that the default config now depends on is untested. (Medium)

_in_allowlist was changed to glob.match(lower(pattern), ["/"], lower(_owner_repo_of(uses))) (policies/action_authorized_sources.rego:270), lowering both the pattern and the subject. In the same PR, defaultConfig/.plumber.yaml deletes every lowercase case-alias (azure/*, sonarsource/*, datadog/*, 1password/*, pyo3/*, …) and keeps only the mixed-case canonical entries (Azure/*, SonarSource/*, DataDog/*, 1Password/*, PyO3/*). That deletion is only correct because lower(pattern) normalizes the pattern side so a lowercase workflow ref still matches a mixed-case entry.

However, no test covers that direction. Every ISSUE-713 test uses already-lowercase trustedGithubActions entries:

  • policies/trusted_owner_case_test.go:29 → ["someowner/*", "acme/deploy", "myorg/*"]
  • policies/rules_test.go:6827 → ["mycompany/*", "jdx/mise-action"], :6861 → ["mycompany/*"]

Because the patterns are already lowercase, lower(pattern) is a no-op in all of them: if a future refactor dropped lower(pattern) (keeping only lower(uses)), every existing test would still pass. The regression would be concrete and reachable: with the shipped default config, a workflow step uses: azure/login@v1 (lowercase owner, a common real-world form) would stop matching the mixed-case default entry Azure/* — glob.match("Azure/*", "azure/login") is false — and would be flagged ISSUE-713 "unauthorized source" even though Azure is trusted by default.

Suggested test: add an ISSUE-713 case with a mixed-case allowlist entry and a lower/other-cased ref, e.g. trustedGithubActions: ["Azure/*", "SonarSource/sonarcloud-github-action"] with uses: azure/login@v1 and uses: sonarsource/sonarcloud-github-action@v2, asserting neither is flagged (and a same-owner non-member like azure-foo/x@v1 is flagged). This locks the lower(pattern) half that the default config relies on.

Control: .github/claude-prompts/test-coverage.md · resolve this conversation once addressed.

{Uses: "Actions/checkout@v4", Line: 12},
{Uses: "GITHUB/codeql-action/init@v3", Line: 13},
{Uses: "ACME/Deploy@v1", Line: 14},
{Uses: "MYORG/Tools/sub/x@v1", Line: 15},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Test coverage

Low: The Rego _is_trusted_owner owner/repo case-folding (lower(want)) is never tested against a mixed-case trustedOwners entry, unlike its Go counterpart. (Low)

_segment_matches for i<2 compares lower(want) == lower(got) (policies/action_unpinned.rego:216-219), where want is a trustedOwners entry segment. The only Rego test for this (policies/trusted_owner_case_test.go:45) configures trustedOwners: ["actions", "github", "someowner", "myorg/tools/sub"] — all lowercase. Matching those against mixed-case refs (SomeOwner/..., MYORG/Tools/...) only exercises lowering the ref side (lower(got)); the entry side is already lowercase, so lower(want) is a no-op here. A regression that changed the comparison to want == lower(got) would pass every Rego test.

The Go mirror is tested in both directions — TestAggregate_TrustedOwnersMatchLikeRego (control/github_stats_test.go:143) uses mixed-case entries ["MyOrg", "acme/deploy", "tools/kit/lib"] — so the Go segmentsMatch entry-lowering is covered but the Rego one is not, leaving the two implementations' coverage asymmetric for a user who configures a mixed-case trustedOwners entry (e.g. MyOrg).

Suggested test: extend the ISSUE-701 case in trusted_owner_case_test.go with a mixed-case entry such as "MyOrg" and a ref myorg/x@v1 (lowercase owner), asserting it is exempt/not flagged, mirroring the Go test.

Control: .github/claude-prompts/test-coverage.md · resolve this conversation once addressed.

@thomasboni
thomasboni merged commit 4160592 into main Nov 26, 2026
18 checks passed
@thomasboni
thomasboni deleted the fix/623-trusted-owners-case-insensitive branch November 26, 2026 14:35
Exypte added a commit to getplumber/getplumber.io that referenced this pull request Nov 26, 2026
getplumber/plumber#629 makes trustedOwners (ISSUE-701), trustedGithubActions and the official actions/github owners (ISSUE-713) ignore case in the owner and repository of a uses: reference, as GitHub does. A path below the repository and the ref still match exactly.
plumber-release Bot pushed a commit that referenced this pull request Nov 30, 2026
## [0.7.24](v0.7.23...v0.7.24) (2026-11-30)

### ✨ Features

* **control:** tag patterns must be protected (tagMustBeProtected, ISSUE-510) ([#581](#581)) ([e2b13ab](e2b13ab)), closes [#398](#398)
* **github:** send fewer GitHub requests and read GitHub through GraphQL ([#649](#649)) ([53c5406](53c5406)), closes [#618](#618) [#637](#637) [#618](#618)

### 🐛 Bug Fixes

* **github:** match trusted owner lists without regard to case ([#629](#629)) ([4160592](4160592)), closes [#623](#623)

### 🔧 Chores

* code owners only on the action lockfile, owned by the cli team ([#656](#656)) ([80c4d31](80c4d31))

### 📚 Documentation

* explain the release process ([#601](#601)) ([67557b9](67557b9))
* **readme:** add InvokeAI and Clash Nyanpasu to the adopters row ([#613](#613)) ([798fd9f](798fd9f)), closes [invoke-ai/InvokeAI#9944](invoke-ai/InvokeAI#9944) [#10109](https://github.com/getplumber/plumber/issues/10109) [libnyanpasu/clash-nyanpasu#6286](libnyanpasu/clash-nyanpasu#6286) [#6323](https://github.com/getplumber/plumber/issues/6323) [#6324](https://github.com/getplumber/plumber/issues/6324)

### 👷 CI/CD

* keep the corpus under -race, lint through golangci-lint-action, harden the scan gate ([f7960e6](f7960e6))
* run the corpus without the race detector, cache golangci-lint, scan the image only when it changed ([d69f9ac](d69f9ac))
* trust golangci-lint-action in the Plumber action allowlist ([3d71094](3d71094))
Totara-thib added a commit to getplumber/getplumber.io that referenced this pull request Nov 30, 2026
* docs(issues): trusted owner lists ignore case

getplumber/plumber#629 makes trustedOwners (ISSUE-701), trustedGithubActions and the official actions/github owners (ISSUE-713) ignore case in the owner and repository of a uses: reference, as GitHub does. A path below the repository and the ref still match exactly.

* docs(issues): a trustedOwners entry never names a ref

---------

Co-authored-by: Totara-thib <totara.thib@gmail.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

2 participants