GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][broker] Honor secondary tenant admin roles in HTTP admin requests by Denovo1998 · Pull Request #26911 · apache/pulsar

Conversation

@Denovo1998

@Denovo1998 Denovo1998 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Motivation

With MultiRolesTokenAuthorizationProvider, a JWT whose roles are ["user", "tenant-admin"] can pass topic lookup as a tenant administrator, but direct HTTP operations guarded by PulsarWebResource#validateAdminAccessForTenantAsync fail with HTTP 401. The direct request path checks tenant-admin access using only the authenticated principal, instead of the additional roles recognized by the authorization provider. After #26776, this also prevents valid tenant administrators from truncating a partitioned topic by its parent name.

Modifications

  • Use the existing AuthorizationService#isSuperUserOrTenantAdmin helper for direct HTTP tenant-admin checks.
  • Add truncate regression coverage for secondary tenant-admin roles in MultiRolesTokenAuthorizationProviderTest.
  • Verify that roles with only produce and consume permissions are still rejected and that their rejected requests leave the backlog unchanged.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added MultiRolesTokenAuthorizationProviderTest#testTruncateWithSecondaryTenantAdminRole, which uses the admin client and broker fixture to publish messages and verify truncation of partitioned topics, non-partitioned topics and individual partitions.

The test checks that a tenant-admin role appearing after the token's primary role can clear the backlog, while a role with only produce and consume permissions cannot truncate it.

Run the regression test with:

./gradlew :pulsar-broker:test --tests "org.apache.pulsar.client.api.MultiRolesTokenAuthorizationProviderTest.testTruncateWithSecondaryTenantAdminRole" --max-workers=2 -PtestMaxParallelForks=1 -PtestRetryCount=0

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

REST endpoints requiring tenant-admin access now recognize secondary tenant-admin roles in multi-role JWTs for direct HTTP requests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Denovo1998
[fix][broker] Honor secondary tenant admin roles in HTTP admin requests
f2eda18
codelipenghui
codelipenghui approved these changes Oct 20, 2026
View reviewed changes

@codelipenghui codelipenghui left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reviewed head f2eda18. The change correctly reuses the existing provider-aware tenant-admin authorization helper. No actionable findings identified within the reviewed scope.

The inline test suggestion is optional and non-blocking. Local validation was blocked by sandbox permissions; please confirm the focused regression passes in CI before merging.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...ker/src/test/java/org/apache/pulsar/client/api/MultiRolesTokenAuthorizationProviderTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@codelipenghui codelipenghui assigned Denovo1998 Oct 20, 2026
@codelipenghui codelipenghui added this to the 5.1.0 milestone Oct 20, 2026
@Denovo1998
[fix][broker] Honor secondary tenant admin roles in HTTP admin requests
5ba4ac1
@codelipenghui
codelipenghui merged commit 3ad7e6e into apache:master Oct 22, 2026
43 checks passed

Uh oh!

There was an error while loading. Please reload this page.

lhotari pushed a commit that referenced this pull request Oct 22, 2026
@Denovo1998 @lhotari
[fix][broker] Honor secondary tenant admin roles in HTTP admin reques…
99ba3de
…ts (#26911)

(cherry picked from commit 3ad7e6e)
@lhotari lhotari added release/5.0.1 cherry-picked/branch-5.0 labels Oct 22, 2026
This was referenced Nov 21, 2026
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27680
Closed
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27681
Closed
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27684
Closed
@lhotari lhotari added cherry-picked/branch-4.2 release/4.2.6 cherry-picked/branch-4.0 release/4.0.15 labels Nov 21, 2026
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Nov 26, 2026
@Denovo1998 @lhotari
[fix][broker] Honor secondary tenant admin roles in HTTP admin reques…
d5c9e37
…ts (apache#26911)

(cherry picked from commit 3ad7e6e)
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Nov 26, 2026
@Denovo1998 @lhotari
[fix][broker] Honor secondary tenant admin roles in HTTP admin reques…
6cc7047
…ts (apache#26911)

(cherry picked from commit 3ad7e6e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@codelipenghui codelipenghui codelipenghui approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Denovo1998 Denovo1998

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 cherry-picked/branch-5.0 release/4.0.15 release/4.2.6 release/5.0.1

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Denovo1998 @codelipenghui @lhotari
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.