forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: fix EXECUTE privileges for UDFs
EXECUTE privileges are now correctly checked for each user-defined function referenced in a query. Informs cockroachdb#103842 Release note (bug fix): A bug has been fixed that allowed users to execute a user-defined function without having EXECUTE privileges on the function. This bug has been present since version 22.2 when UDFs were introduced.
- Loading branch information
Showing
17 changed files
with
266 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
pkg/sql/logictest/testdata/logic_test/mixed_version_udf_execute_privileges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# LogicTest: cockroach-go-testserver-upgrade-to-master | ||
|
||
# Verify that all nodes are running previous version binaries. | ||
|
||
query T nodeidx=0 | ||
SELECT crdb_internal.node_executable_version() | ||
---- | ||
23.1 | ||
|
||
query T nodeidx=1 | ||
SELECT crdb_internal.node_executable_version() | ||
---- | ||
23.1 | ||
|
||
query T nodeidx=2 | ||
SELECT crdb_internal.node_executable_version() | ||
---- | ||
23.1 | ||
|
||
# Create test user. | ||
|
||
statement ok | ||
CREATE USER testuser1 | ||
|
||
# Create a user-defined function. | ||
|
||
statement ok | ||
CREATE FUNCTION f() RETURNS INT LANGUAGE SQL AS 'SELECT 1' | ||
|
||
user testuser1 | ||
|
||
query I | ||
SELECT f() | ||
---- | ||
1 | ||
|
||
# Upgrade node 0 and verify that the user can use the function in mixed version | ||
# mode. | ||
|
||
upgrade 0 | ||
|
||
user testuser1 nodeidx=0 | ||
|
||
query I | ||
SELECT f() | ||
---- | ||
1 | ||
|
||
# Upgrade all nodes. | ||
|
||
upgrade 1 | ||
|
||
upgrade 2 | ||
|
||
# Verify that all nodes are now running 23.2 binaries. | ||
|
||
query B nodeidx=0 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '23.1-%' | ||
---- | ||
true | ||
|
||
query B nodeidx=1 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '23.1-%' | ||
---- | ||
true | ||
|
||
query B nodeidx=2 | ||
SELECT crdb_internal.node_executable_version() SIMILAR TO '23.1-%' | ||
---- | ||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/generated_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.