-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[cleanup][broker] Validate originalPrincipal earlier in ServerCnx #19270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cleanup][broker] Validate originalPrincipal earlier in ServerCnx #19270
Conversation
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
michaeljmarshall
left a comment
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.
There are some edge cases in the current solution that I think will require larger refactoring. Converting this to a draft for now.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ServerCnxTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
I removed this logic from the PR to make it easier to accept. It would be good to submit a follow up PR to propose making the broker's logic stricter. |
|
@lhotari @nicoloboschi PTAL. |
|
/pulsarbot rerun-failure-checks |
|
I cherry-picked this change to the release branches because #19455 depends on it. |
…ache#19270) (cherry picked from commit fd3ce8b) (cherry picked from commit 2847dd1) (cherry picked from commit 01bd986)
…rCnx (apache#19270)" This reverts commit b233d6b.
…ache#19270) (cherry picked from commit fd3ce8b) (cherry picked from commit 2847dd1) (cherry picked from commit 01bd986)
|
Hi @michaeljmarshall did you have any plans to update the protocol spec for this cleanup? Just want to make sure it can catch up with the release schedule. |
|
The docs were updated here: apache/pulsar-site#408. |
Motivation
The current
ServerCnxvalidates the proxy role on certain protocol messages. This is unnecessary. Instead, we should verify that theauthRoleand theoriginalPrincipalare a valid combination before going to theConnectedstate.Modifications
invalidOriginalPrincipalwithvalidateRoleAndOriginalPrincipal.invalidOriginalPrincipal.validateRoleAndOriginalPrincipalwhen transitioning fromConnectingtoConnectedstate.Verifying this change
Added new test in
ServerCnxTestto validate the authorization.Documentation
doc-requiredI updated the appropriate Javadocs, but we should also update the protocol spec to indicate valid combinations of the
Connectcommand.Matching PR in forked repository
PR in forked repository: michaeljmarshall#13