-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: perform topic permission checks for KSQL service principal #3261
feat: perform topic permission checks for KSQL service principal #3261
Conversation
ksql-rest-app/src/main/java/io/confluent/ksql/rest/server/computation/DistributingExecutor.java
Show resolved
Hide resolved
d7e0a01
to
160d8f6
Compare
160d8f6
to
2279f5e
Compare
ksql-engine/src/test/java/io/confluent/ksql/security/KsqlAuthorizationImplTest.java
Outdated
Show resolved
Hide resolved
2279f5e
to
8ce3aff
Compare
ksql-engine/src/main/java/io/confluent/ksql/security/KsqlAuthorizationValidatorImpl.java
Outdated
Show resolved
Hide resolved
ksql-engine/src/main/java/io/confluent/ksql/security/KsqlAuthorizationValidatorImpl.java
Outdated
Show resolved
Hide resolved
cd77b40
to
a919d06
Compare
Update: I decided to back to the initial proposal where the permissions checks are done on the I needed to check after the topic has been created to validate the User and KSQL have read/write permissions on those topics. For the |
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.
I don't think DistributingExecutor
is the right place for this logic (it has nothing to do with distributing the command). Furthermore, I think that separating it from the site of topic creation might cause us issues down the line (what if I refactor the TopicCreateInjector to be applied somewhere other than where it is now?). That being said - I think that this check should be done either inside the TopicCreateInjector or, if possible, even couple it with the KafkaTopicClient to make sure that we don't ever create a topic without later checking for permissions.
Lastly - is there any work being done by Kafka team to allow us to check whether or not we would have write/read permissions on a topic? e.g. is there a call that allows us to create (verify only) and also return the allowed permissions?
@agavra Kafka has an API to validate if a topic can be created. KSQL already supports that: 0ea157b However, the problem with this PR is not checking if a User can create a topic. The problem is that the User and KSQL must have Doing it in the The only way I found is to do those |
Sorry if I was unclear about the Kafka extensions - I meant if Kafka is working on extending the
Why not? Do we ever want to create a topic we can't read and write from? I feel like the API could very well be
Yes - but that makes the code harder to iterate on and more coupled, which slows us down in the long term. |
Got it. I like your idea of validating R/W permissions with Kafka during the creating request. I'm not aware of plans to extend the API to include that, though. There is one request I will make to validate a DELETE operation (like the CREATE) too. I will request your proposal as well. However, I don't think they will add it by 5.4 where I am planning to improve these error messages. For 5.4, I could probably add the same behavior on the Anyway, that fixes the problem when checking if a newly created topic has |
I think that makes sense - I still don't love having it in the Distributing executor, but I guess we don't have a good workaround :/ |
Description
KSQL performs topic permission checks for the CLI user requesting to execute a command. This returns correct authorization error messages if the CLI user does not have access to the statement resources.
However, some commands require that the KSQL server executes them in the background. This PR to perform those permissions checks for the KSQL server as well.
The following output messages are displayed:
Testing done
Reviewer checklist