Skip to content

Add e2e tests for webhook grants passing through authz gates - #4517

Merged
kcp-ci-bot merged 1 commit into
kcp-dev:mainfrom
souvik-biswas-dev:add-authz-gate-e2e-tests
Nov 4, 2026
Merged

kcp-ci-bot merged 1 commit into
kcp-dev:mainfrom
souvik-biswas-dev:add-authz-gate-e2e-tests

Conversation

@souvik-biswas-dev

@souvik-biswas-dev souvik-biswas-dev commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds e2e coverage proving that an authorization webhook decision cannot
get around the authz gates introduced in #4507:

  • A webhook Allow for a user outside the workspace's required groups
    still ends in Forbidden (required-groups gate).
  • A webhook Allow for update/patch on apiexports/status and
    apibindings/status still ends in Forbidden (system CRD gate).
  • A webhook Deny ends in Forbidden even for a user RBAC would admit
    (webhook ordered ahead of RBAC).

Each case has a control step showing the webhook grant works where no
gate applies. I also checked that the tests fail when the corresponding
gate is disabled.

I did not extract the closure into a chainAuthorizer function (marked
optional in the issue). Happy to follow up with that and a unit test.

What Type of PR Is This?

/kind cleanup

Related Issue(s)

Fixes #4512

Release Notes

NONE

@kcp-ci-bot kcp-ci-bot added dco-signoff: yes Indicates the PR's author has signed the DCO. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 30, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

Hi @souvik-biswas-dev. 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.

@kcp-ci-bot kcp-ci-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 31, 2026
@mjudeikis
mjudeikis marked this pull request as draft November 3, 2026 10:02
@kcp-ci-bot kcp-ci-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 3, 2026
@mjudeikis

mjudeikis commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Once #4507 is merged this needs rebase . Moving to draft for now. 4507 is tagged so should be ok to rebase in few minutes

Signed-off-by: Souvik Biswas <souvikbiswas.dev@gmail.com>
@kcp-ci-bot kcp-ci-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 4, 2026
@souvik-biswas-dev

Copy link
Copy Markdown
Contributor Author

Rebased onto main now that #4507 has merged; the PR is down to the single test file. Could someone with org access run /ok-to-test?

One heads-up: these tests use framework.SerialSuite since they start their own server. I noticed a few other tests (e.g. TestMaximalPermissionPolicyWebhookEscalation) still use framework.Suite(t, "control-plane"), which I couldn't find enabled anywhere in the Makefile or CI config, so they may be getting skipped. Happy to open a separate issue if that's useful.

@souvik-biswas-dev

Copy link
Copy Markdown
Contributor Author

/kind cleanup

@kcp-ci-bot kcp-ci-bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Nov 4, 2026
@souvik-biswas-dev
souvik-biswas-dev marked this pull request as ready for review November 4, 2026 05:19
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 4, 2026
@ntnn

ntnn commented Nov 4, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@kcp-ci-bot kcp-ci-bot added 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. labels Nov 4, 2026

@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

Thanks!

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

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: f0a5222113d9e72a36954680208d3cd285788e04

@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 4, 2026
@kcp-ci-bot
kcp-ci-bot merged commit 41890e2 into kcp-dev:main Nov 4, 2026
18 checks passed
@souvik-biswas-dev
souvik-biswas-dev deleted the add-authz-gate-e2e-tests branch November 4, 2026 07:02
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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-none Denotes a PR that doesn't merit a release note. 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.

Add e2e tests for webhook grants passing through authz gates

4 participants