-
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
Allow multiple filters and masks from access control #11654
Allow multiple filters and masks from access control #11654
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.
Looks Good!
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.
To me this does not change anything (I mean it is safe change) as we now allow multiple row filters and column masks. Now it is more explicit.
Anyway, I would like to hear @martint opinion too.
...plugin-toolkit/src/main/java/io/trino/plugin/base/security/FileBasedSystemAccessControl.java
Show resolved
Hide resolved
...trino-plugin-toolkit/src/main/java/io/trino/plugin/base/security/FileBasedAccessControl.java
Show resolved
Hide resolved
A couple of comments:
|
In regards to SPI, please see #11667
There are authorization systems that allows to configure row filters and column masking on schema as well as on table. So there is a case where it is set on both entities and so multiple filters or masks are returned. |
0320401
to
151164e
Compare
I modified the commits to add new methods and deprecated the old ones instead of replacing. |
85742c4
to
3184de1
Compare
Can just collect to array directly.
The engine is perfectly capable of processing multiple row filter and column mask expressions, given that it supports running multiple system access controls and each of them can provide an expression. See: `io.trino.security.AccessControlManager#getColumnMasks` and `io.trino.security.AccessControlManager#getRowFilters`. So inability to provide more than one expression per access control looks like an artificial restriction. Case in point: the file-based access control, which is also already capable of providing multiple expressions for both row filters and column masks (it just picked the first one and discarded the rest).
Now that the `SystemAccessControl` can provide multiple filtering and masking expressions, there's no reason for the `ConnectorAccessControl` not to follow suit.
3184de1
to
a63e04b
Compare
*/ | ||
default List<ViewExpression> getRowFilters(ConnectorSecurityContext context, SchemaTableName tableName) | ||
{ | ||
return emptyList(); |
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.
The new method should delegate to the old method.
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.
True. As I was removing them I realized the same, not sure how it happened
Description
It's an improvement to the SPI between the engine and the access control interfaces.
SPI interfaces
The engine is perfectly capable of processing multiple row filter and column mask expressions, given that it supports running multiple system access controls and each of them can provide an expression. See:
io.trino.security.AccessControlManager#getColumnMasks
andio.trino.security.AccessControlManager#getRowFilters
. So inability to provide more than one expression per access control looks like an artificial restriction. Case in point: the file-based access control, which is also already capable of providing multiple expressions for both row filters and column masks (it just picked the first one and discarded the rest).Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
(x) No release notes entries required. (I guess)
( ) Release notes entries required with the following suggested text: