-
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
Change SQL path to match spec #19160
Conversation
917c7b5
to
0ec7a37
Compare
960e042
to
6d30d53
Compare
6747413
to
5b6afe4
Compare
core/trino-main/src/main/java/io/trino/security/AccessControlManager.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/FunctionResolver.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorMaterializedViewDefinition.java
Outdated
Show resolved
Hide resolved
f5461e8
to
9f84275
Compare
A single transaction must be used for plan building and assertion
Simplify function access control methods for better integration with catalog functions. * Return boolean from catalog access check calls instead of throwing * Return boolean from function check calls instead of throwing * Merge simple function checks with table function check * Add canCreateViewWithExecuteFunction for use in ViewAccessControl
I agree that they draw from the same namespace but that doesn't mean implementors want to have same logic. Can you advise how such a logic should be implemented? Further, the change seems to introduce a side-effect which may be considered a security problem. Lines 1103 to 1108 in 1f46063
Trino 429 lowers that to require read only access. |
This assumption is incorrect. There’s nothing about scalar functions that makes them inherently safe vs table functions. The only difference between them is that one processes single values, while the other processes sequences of values. Both could very easily do unsafe things if they wanted to and their implementation allowed it (e.g., make external calls, read files, etc.) In fact, one of the changes we’re planning in the future will allow scalar functions to be callable in batches, making them no different than a table function. |
{ | ||
wrapAccessDeniedException(() -> delegate.checkCanGrantExecuteFunctionPrivilege(context, functionName, invoker, false)); | ||
return delegate.canCreateViewWithExecuteFunction(context, functionName); |
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.
Hello @dain , is it intended to use delegate.canCreateViewWithExecuteFunction()
instead of delegate.canExecuteFunction()
here..? (I guess it is intended to use VIEW DEFINER
permission by default)
Description
Update the function resolution usage of SQL path to match the specification. The path is now stored in views, and view expression (for pushdown). If the view does not have a path then the only
system.builtin
is visible. Unauthorized SQL path element are now skipped in function resolution, so authorized functions later in the path are now considered. In order to make thes changes, function security APIs and implementations have been changed as followssystem.builtin
. These functions are considered safe for all users and are typically required for the engine to function properly.Session
to create a new session for the view context.Release notes
(x) Release notes are required, with the following suggested text: