Verify authorization access for SET AUTHORIZATION statements#16691
Conversation
c4bb91a to
173f26e
Compare
ksobolew
left a comment
There was a problem hiding this comment.
There are two concerns here:
-
Whether impersonation is the right precondition for this
- We discussed this when we worked on this last time, and this was one of the suggestions. I think it makes sense, but I'm no strongly sold on it yet.
-
This requires all access control to implement this in a correct way, which is error prone.
- I would suggest moving the logic to
AccessControlManagerand remove thecheckCanSetViewAuthorizationfrom the access control interface(s).
- I would suggest moving the logic to
Bonus concern:
- The commit message seems malformed :) It should explain why impersonation is the correct thing to do, not just that it's delegated to the access control.
core/trino-main/src/main/java/io/trino/execution/SetViewAuthorizationTask.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/security/TestFileBasedSystemAccessControl.java
Outdated
Show resolved
Hide resolved
...trino-plugin-toolkit/src/main/java/io/trino/plugin/base/security/FileBasedAccessControl.java
Outdated
Show resolved
Hide resolved
173f26e to
f4d4e3a
Compare
|
AC, PTAL |
ksobolew
left a comment
There was a problem hiding this comment.
So file-based access controls will have their own model for this? We were discussing things like checking for impersonation, does that mean this is not viable here or just undesirable?
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/security/AuthorizationRule.java
Outdated
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/security/AuthorizationRule.java
Outdated
Show resolved
Hide resolved
...trino-plugin-toolkit/src/main/java/io/trino/plugin/base/security/FileBasedAccessControl.java
Outdated
Show resolved
Hide resolved
...plugin-toolkit/src/main/java/io/trino/plugin/base/security/FileBasedSystemAccessControl.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Why not return Optional like from all the others?
There was a problem hiding this comment.
Because this one if it is not present is denied by default.
...oolkit/src/test/java/io/trino/plugin/base/security/BaseFileBasedSystemAccessControlTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Does this warrant a separate commit?
There was a problem hiding this comment.
Why no roles in connector access control tests?
There was a problem hiding this comment.
there is also authorization.json, however file based connector access control does not support roles.
checkArgument(!rules.hasRoleRules(), "File connector access control does not support role rules");
...kit/src/test/java/io/trino/plugin/base/security/BaseFileBasedConnectorAccessControlTest.java
Outdated
Show resolved
Hide resolved
...kit/src/test/java/io/trino/plugin/base/security/BaseFileBasedConnectorAccessControlTest.java
Outdated
Show resolved
Hide resolved
|
AC, PTAL |
f4d4e3a to
f71b287
Compare
f71b287 to
94acb6e
Compare
dain
left a comment
There was a problem hiding this comment.
The message on the second commit should be rewritten as the new solution is to add a file based access control rule for set authorization checks. Also, I think the PR message and release notes will need a rewrite.
core/trino-main/src/main/java/io/trino/execution/SetViewAuthorizationTask.java
Outdated
Show resolved
Hide resolved
...trino-plugin-toolkit/src/main/java/io/trino/plugin/base/security/FileBasedAccessControl.java
Outdated
Show resolved
Hide resolved
8edefc5 to
8083741
Compare
ae08d58 to
bcd8574
Compare
bcd8574 to
1c98782
Compare
Using new rules will allow to control who can grant AUTHORIZATION (move ownership) to whom. In order to perform the SET AUTHORIZATION statement one has also ownership access to referred entity. So to be authorized to perform: ALTER TABLE T SET AUTHORIZATION USER U; one has to have access to modify the table T and proper authorization rule to move ownership to user U:
This property is no longer needed. It is required that plugin that implements access control make sure that control for SET AUTHORIZATION is implemented securely.
1c98782 to
c04f7c2
Compare
With this pull request we are going to assume from all pluggable access control to make sure that SET AUTHORIZATION statements are secure to be performed. Previously it was not clear if it is engine or access control responsibility. Hence we had
legacy.allow-set-view-authorizationconfig property.To accomplish that now:
hive.security=sql-standardrequires admin role privilege to performALTER ... SET AUTHORIZATION...statementsThanks to the above
legacy.allow-set-view-authorizationcan be removed.Release notes:
Hive
securty requires admin role privilege to performALTER ... SET AUTHORIZATION...` statementsSecurity:
ALTER ... SET AUTHORIZATION...to whom authorization can be set.legacy.allow-set-view-authorizationconfiguration property