Skip to content

[release-0.33] fix(apiexport): treat "*" verb in permission claims as wildcard - #4541

Merged
kcp-ci-bot merged 1 commit into
kcp-dev:release-0.33from
mjudeikis-bot:cherry-pick-4504-to-release-0.33
Nov 3, 2026
Merged

kcp-ci-bot merged 1 commit into
kcp-dev:release-0.33from
mjudeikis-bot:cherry-pick-4504-to-release-0.33

Conversation

@mjudeikis-bot

Copy link
Copy Markdown

Cherry-pick of #4504 (eee9dfa) onto release-0.33. Fixes #4503.

The automatic cherry-pick failed with a conflict in pkg/virtual/apiexport/authorizer/binding.go: the release branch has an older claim-matching block, so the wildcard-verb handling is applied there instead. The test cases from #4504 apply unchanged.

Validation: go build ./pkg/virtual/apiexport/... and go test ./pkg/virtual/apiexport/authorizer/ pass on this branch. e2e not run.

Fix APIExport virtual workspace denying namespaced requests for claimed resources when the APIExport permission claim uses verbs ["*"].

🤖 Generated with Claude Code

Motivation: In the APIExport virtual workspace binding authorizer, the
allowed verbs of a permission claim were computed as a plain set
intersection of the APIBinding and APIExport verbs. The literal "*" was
not treated as a wildcard, so an export claim with verbs ["*"] combined
with a binding claim listing explicit verbs produced an empty set, and
every namespaced request for the claimed resource was denied with
"failed to find suitable reason to allow access in APIBinding".
Wildcard-cluster requests bypass this loop and were unaffected.

Approach: If the export claim contains "*", the binding's verbs are
allowed; if the binding claim contains "*", the export's verbs are
allowed; otherwise the intersection is used as before. A wildcard on one
side therefore never grants more than the other side permits. This
matches how the permission claim label reconciler already treats "*".

Validation: added two cases to TestBoundAPIAuthorizer (wildcard on the
APIExport only, wildcard on the APIBinding only). Ran
`go test ./pkg/virtual/apiexport/authorizer/`: both new cases fail
without the change and the package passes with it. Also ran go vet and
gofmt on the package. I did not run e2e tests or a live kcp instance.

Report: kcp-dev#4503
Assisted-by: claude-sonnet-5-5 (via Claude Code)
(cherry picked from commit eee9dfa)

Conflicts resolved against release-0.33: the wildcard verb handling is applied to the older claim-matching block.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Signed-off-by: mjudeikis-bot <noreply@users.noreply.github.com>
@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Nov 3, 2026
@kcp-ci-bot kcp-ci-bot added do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 3, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

Hi @mjudeikis-bot. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mjudeikis-bot mjudeikis-bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No issues found.

The wildcard handling in boundAPIAuthorizer.Authorize (binding.go:152-165) is correct. If the export claim has *, the allowed verbs are the binding's verbs. If the binding claim has *, they are the export's verbs. Otherwise the intersection is used. A wildcard on both sides gives {*}, which the final HasAny(verb, "*") accepts. If the export has no matching claim, the export verb set is empty and the request is denied, as before.

Checked

  • Read beyond the diff: all of Authorize in pkg/virtual/apiexport/authorizer/binding.go, including the bound-resource, apibindings read-only and deny fall-throughs, and the wildcardVerb constant. I also grepped pkg for other verb comparisons. permissionclaimlabel_reconcile.go:462 already treats * on either side as a wildcard, and replication/authorizer/content.go is unrelated.
  • Correctness: the three-way switch is consistent with the final HasAny check. An empty export verb set still denies. Result: no defect.
  • Concurrency: the code is stateless, with only local sets. Not applicable.
  • kcp specifics: the logical-cluster scoping, the API domain key parsing and the binding lookup are unchanged. No new client or lister calls. Result: no change.
  • API and storage: no types, CRDs or codegen touched. Not applicable.
  • Security: the change only widens the match when one side explicitly says *. It never exceeds the other side's verbs, so there is no escalation beyond what the export and binding both permit. The result is the same as the intersection semantics once * is expanded.
  • Tests: the two new cases (wildcard on the export only, wildcard on the binding only) exercise the new branches. With binding.go reverted to the parent commit, TestBoundAPIAuthorizer fails. With the change it passes, so the tests do detect the fix.
  • Commands run on the PR head: go build ./pkg/virtual/apiexport/... passed. go vet ./pkg/virtual/apiexport/authorizer/ was clean. go test ./pkg/virtual/apiexport/authorizer/ passed. I did not run the linter separately.
  • e2e: not run. The PR notes it was not run either. The unit test covers the changed branch, and the e2e suite needs a full kcp environment that is not available here.
  • Backport scope: only binding.go and its test differ. The PR body says the conflict was resolved against an older claim-matching block, and I confirmed the resulting block compiles and behaves as above.

@ntnn ntnn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 3, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 81984fb31076150a42534835c965174d5ed4a51a

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ntnn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2026
@ntnn

ntnn commented Nov 3, 2026

Copy link
Copy Markdown
Member

/ok-to-test
/kind bug

@kcp-ci-bot kcp-ci-bot added kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Nov 3, 2026
@mjudeikis

Copy link
Copy Markdown
Contributor

/retest

@mjudeikis

Copy link
Copy Markdown
Contributor

/retest
prow in release branches still runs old data

@kcp-ci-bot
kcp-ci-bot merged commit d96bfe8 into kcp-dev:release-0.33 Nov 3, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants