Repository navigation
[fix][broker] Check topic permissions for partitions and subscriptions added to a transaction - #26644
Merged
Merged
Conversation
…s added to a transaction AddPartitionToTxn now requires PRODUCE on each partition, and AddSubscriptionToTxn requires CONSUME on each subscription with its name, as producing and subscribing do. One refused participant fails the request with AuthorizationError. The scalable-topic path does not register participants and is unchanged. The message returned to a client that does not own the transaction now goes through the role logging anonymizer. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 of 11 tasks
lhotari
approved these changes
Sep 19, 2026
Radiancebobo
pushed a commit
to Radiancebobo/pulsar
that referenced
this pull request
Oct 8, 2026
…s added to a transaction (apache#26644)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
CommandAddPartitionToTxnandCommandAddSubscriptionToTxnonly checked that the client owns thetransaction. The partitions and subscriptions added to it were not checked against the client's topic
permissions, unlike producing to a partition or subscribing.
Modifications
AddPartitionToTxnrequiresPRODUCEon each partition.AddSubscriptionToTxnrequiresCONSUMEon each topic, with the subscription name passed to theprovider (
AuthenticationDataSubscription), as subscribe does.AuthorizationError, through the newBrokerServiceException.NotAuthorizedException. The scalable-topic path does not registerparticipants and is unchanged.
anonymizer.
This PR and #26643 both add
BrokerServiceException.NotAuthorizedException; whichever is merged secondwill merge master.
Verifying this change
This change added tests and can be verified as follows:
ServerCnxTest: partitions and subscriptions refused without the permission (nothing isregistered with the coordinator), including a request where only one of two partitions is refused;
the existing
sendAddPartitionToTxnResponse*andsendAddSubscriptionToTxnResponse*tests coverthe allowed path.
Does this pull request potentially affect one of the following parts:
The binary protocol messages are unchanged; the broker now answers
AuthorizationErrorto thesecommands when the client lacks the permission.
🤖 Generated with Claude Code