Repository navigation
[fix][broker] Check topic permissions for binary GetSchema and GetOrCreateSchema - #26643
Merged
lhotari merged 2 commits intoSep 19, 2026
Merged
Conversation
…reateSchema Align the binary schema commands with the REST schema endpoints. CommandGetSchema now requires LOOKUP on the topic, which producers, consumers and readers already hold. CommandGetOrCreateSchema requires PRODUCE, like the REST schema upload. A refused request gets AuthorizationError, through the new BrokerServiceException.NotAuthorizedException. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
lhotari
approved these changes
Sep 19, 2026
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
The REST schema endpoints check topic permissions (
GET_METADATAto read,PRODUCEto upload inSchemasResourceBase), but the binaryCommandGetSchemaandCommandGetOrCreateSchemahandlers inServerCnxdid not check any permission.Modifications
CommandGetSchemarequiresLOOKUPon the topic. Producers, consumers and readers already hold it,since they look the topic up first; the default provider treats
LOOKUPandGET_METADATAalike.CommandGetOrCreateSchemarequiresPRODUCEon the topic, like the REST schema upload.AuthorizationError, through the newBrokerServiceException.NotAuthorizedExceptionmapped ingetClientErrorCode.ClientChannelHelpernow decodes the two schema responses for tests.This PR and #26644 both add
BrokerServiceException.NotAuthorizedException; whichever is merged secondwill merge master.
Verifying this change
This change added tests and can be verified as follows:
ServerCnxTest: each command refused without the permission (the schema registry or the topic isnever reached) and allowed with it.
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