-
Notifications
You must be signed in to change notification settings - Fork 3.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
Do not pass default properties to access control checks #15202
Conversation
.map(property -> property.getName().getValue().toLowerCase(ENGLISH)) | ||
.collect(toImmutableSet()); | ||
Map<String, Object> explicitlySetProperties = properties.keySet().stream() | ||
.filter(specifiedPropertyKeys::contains) |
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.
lowercase here when invoking contains
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 is already lower cased in io.trino.metadata.PropertyUtil#evaluateProperties
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.
Can this class depend on that? maybe it should not, so that the code is "more obviously correct".
i.e. consisten with lowercase 3 lines up
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.
Also io.trino.spi.session.PropertyMetadata#PropertyMetadata
disallows to create a property with non lower cased property name.
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.
Also
io.trino.spi.session.PropertyMetadata#PropertyMetadata
disallows to create a property with non lower cased property name.
today.
if you rely on that other class guarantees, add a verify
here (.peek(...)
)
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.
Addressed as fixup
testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java
Outdated
Show resolved
Hide resolved
testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java
Outdated
Show resolved
Hide resolved
a02b42e
to
2ec6720
Compare
What’s the motivation for this change? If the values of default properties are not passed, how would the access control know what value they are supposed to take? |
I am sorry, I was under impression that the change is straightforward so I gave very limited commit message. The motivation is to make access control for table properties to be more practical and coherent with access for other objects.
In my opinion access control does not need to know or control what engine is doing in order to fulfill user requests, but it is more about controlling what users are doing. As example consider the below (that may happen with existing implementation):
In such situation, I believe users don't care about location of where data is stored. They may not even know that used catalog is a Hive connector. They just want to create a table. They have CREATE TABLE privilege and they ask engine to do whatever it needs, but please create a table for me. User didn't ask for any specific location. Few more issues with existing implementation:
The logic behind proposed implementation:
|
727e6ab
to
1919863
Compare
testing/trino-tests/src/test/java/io/trino/security/TestAccessControl.java
Outdated
Show resolved
Hide resolved
1e627b9
to
4f0d1a7
Compare
Does this need a release note? @kokosing |
I don't think so. |
This is follow-up trinodb#15202 where CTAS was omitted by mistake.
This is follow-up #15202 where CTAS was omitted by mistake.
Do not pass default properties to access control checks