-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix authorization not working when subscription permission is empty #11113
fix authorization not working when subscription permission is empty #11113
Conversation
@rdhabalia @hangc0276 |
This looks like a behaviour change. |
|
@hangc0276 @eolivelli @codelipenghui Could you help review these changes? |
@wuzhanpeng This PR will break the existing subscription behavior although the existing behavior not expected. It will cause the existing applications which doesn't grant role and subscription permission, subscribe failed after upgrading Pulsar to the version including this PR. We'd better start a discussion in dev@pulsar.apache.org first. |
move to 2.8.2 |
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.
+1 for moving to the dev mailing list.
@@ -120,7 +120,7 @@ public void initialize(ServiceConfiguration conf, ConfigurationCacheService conf | |||
// list is empty) |
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.
It appears that the original intent of this code was to consider an empty list as a special case that had special logic. I don't have enough context to know why, but it might be worth reviewing #2981, where this code was first introduced. If I had to guess, it's because it doesn't make much sense to have a subscription that cannot be consumed.
If this change is accepted, the comment on this line and the one above need to be updated:
Lines 119 to 120 in 879ab3a
// validate if role is authorize to access subscription. (skip validatation if authorization | |
// list is empty) |
@wuzhanpeng Hello, is there an email address for discussion? |
@wuzhanpeng:Thanks for your contribution. For this PR, do we need to update docs? |
@wuzhanpeng is this a bug fix (no need to update docs?) |
I am going to remove the 2.8 label for now. @wuzhanpeng do you plan to continue with this work, or should we close this PR? |
@wuzhanpeng - if you're still interested in making this change, I think this feature might be viable if we put it behind a feature flag. The underlying question for this PR is how to interpret a lack of configuration for a subscription. Given that Additionally, I notice that admin roles not included in the subscription's allow list will get rejected from consuming a subscription. It's worth discussing if admins get implicit permission to consume from a subscription. Note that admins will have permission to update the subscription at a namespace level with |
I've created #15597 to make this behavior configurable. Please feel free to add your feedback on the mailing list thread: https://lists.apache.org/thread/x6zg2l7hrtopd0yty93fhctsnm9n0wbt. |
Closed as stale and conflict. Please rebase and resubmit the patch if it's still relevant. |
Motivation
This PR fixed the problem that
org.apache.pulsar.broker.authorization.AuthorizationProvider#canConsumeAsync
returnedtrue
whenorg.apache.pulsar.common.policies.data.AuthPolicies#getSubscriptionAuthentication
was empty (i.e. the set ofsubscription_auth_roles
in admin policies is empty). This is equivalent to allowingsubscription permissions
not to be checked during authorization.Modifications
canConsumeAsync
ofPulsarAuthorizationProvider
and its relative test case.