-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add query integrity check in AccessControlManager #13878
Conversation
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.
LGTM given it has already been reviewed #13632. Make sure the tests pass.
presto-main/src/test/java/com/facebook/presto/security/TestAccessControlManager.java
Outdated
Show resolved
Hide resolved
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.
LGTM . Minor comment
@Override | ||
public void checkQueryIntegrity(Identity identity, String query) | ||
{ | ||
requireNonNull(identity, "extraCredentials is null"); |
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 thought requireNonNull
was only for checking constructor args.
See #13705 (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.
While I am not completely sure about the context behind the comment that you linked to, I feel that it is reasonable to validate that the input that the class is getting from an external agent. So I can generalize it to when something out of the class creates an instance by calling the constructor or to validate arguments passed to a public method of a class.
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.
@mayankgarg1990 , definitely I see the need for null checking params in public methods.
However seems like in presto we usually do not null check method parameters using requireNonNull
. We do that only for constructor arguments. cc @mbasmanova .
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.
@ajaygeorge - If you take a look AccessControlManager
that has been doing this since 2015 - so there are examples already in the codebase. Also, it is better that we focus on what makes sense rather than how things are being done.
f188cf4
to
3257797
Compare
presto-main/src/main/java/com/facebook/presto/security/AccessControlManager.java
Outdated
Show resolved
Hide resolved
Perhaps, clarify what "integrity" means here. |
3257797
to
cbca15f
Compare
I feel that integrity generally refers to ensuring that the query is what was expected. The exact details are up for the implementation and this PR just adds the API to implement to perform the check. I am unable to think of how I can clarify what "integrity" means. I will be glad if you can share what is the missing context that you will like or if you have some suggestion. |
@mayankgarg1990 I'd like to come up with a one-liner for the release notes that would be meaningful to the reader. We can start with |
cbca15f
to
33db74d
Compare
@mbasmanova - I didn't pay attention to this comment. The token is an implementation detail and in general the idea is to use the identity object (where extra information can be passed as I have changed the comment - |
@mayankgarg1990 I like these proposals. |
Thank you for the feedback @mbasmanova . I had already updated the code, I have updated the PR description as well |
@highker , @mbasmanova - can one of you help with merging this PR? |
Resubmitting #13632