Repository navigation
fix(github): match trusted owner lists without regard to case - #629
Conversation
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>
e7b9e11 to
72d3bc3
Compare
| "trustGithubOfficialActions": true, | ||
| "trustSameOrgActions": false, | ||
| "minimumStars": 0, | ||
| "trustedGithubActions": []any{"someowner/*", "acme/deploy", "myorg/*"}, |
There was a problem hiding this comment.
🔴 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}, |
There was a problem hiding this comment.
🔴 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.
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.
## [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))
* 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>
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):The ref and any path below the repository stay case-sensitive, as on GitHub (tested in the issue comment).
Also:
isTrustedOwnerincontrol/github_stats.gonow 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 anowner/repoentry exempted a reference from ISSUE-701 but still counted it inactionRefsTotal.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/GITHUB_ISSUES.mdand theschema_docs.godescriptions (catalog golden regenerated).Which issue(s) this PR is related to:
Closes #623
Special notes for your reviewer:
trustedOwnersentries with a path (owner/repo/sub) keep the old prefix semantics; only their first two segments ignore case.make lintwith golangci-lint 2.15.0 locally reports 7reflect.Ptrinlining hints inconfiguration/schema.go,configuration/schema_test.goandcontrol/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?
How was this tested?
policies/trusted_owner_case_test.go: steps and reusable workflows with mixed-case owners against both lists, plus a path-exactness case (myorg/tools/subdoes not covermyorg/tools/Sub/x). NewTestAggregate_TrustedOwnersIgnoreCaseincontrol/github_stats_test.go.TestAggregate_TrustedOwnersMatchLikeRegocoversowner/repoand path entries in the counter. All three failed before the fix.go test ./...passes.plumber analyzeon a local clone ofgetplumber-examples/cli-working-labwith the issue's config (trustedOwners: [actions, github, someowner],trustedGithubActions: [someowner/*]):uses:SomeOwner/some-action@v1Actions/checkout@v4someowner/other-action@v1AI 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