Bug #110582 | After executing 'set role', cannot access the database with "_" in the db name | ||
---|---|---|---|
Submitted: | 31 Mar 2023 16:52 | Modified: | 23 May 2023 16:51 |
Reporter: | LING-SEN PENG | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
Version: | 8.0.32 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[31 Mar 2023 16:52]
LING-SEN PENG
[31 Mar 2023 17:00]
LING-SEN PENG
I was able to fix the bug by changing the default value for "use_pattern_scan" to "false" in https://github.com/mysql/mysql-server/blob/8.0/sql/auth/sql_security_ctx.h#L93
[31 Mar 2023 20:26]
LING-SEN PENG
After executing 'set role', cannot access the database with "_" in the db name
[11 May 2023 13:08]
MySQL Verification Team
Hello LING-SEN PENG, Thank you for the bug report. I tried to reproduce your issue on windows 10 with workbench 8.0.32 using above procedure but I am not seeing any issues at my end. Please try below statement grant SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `my_test`.* to 'user1'; Regards, Ashwini Patil
[23 May 2023 16:51]
LING-SEN PENG
Per https://dev.mysql.com/doc/refman/8.0/en/grant.html, "The _ and % wildcards are permitted when specifying database names in GRANT statements that grant privileges at the database level (GRANT ... ON db_name.*). This means, for example, that to use a _ character as part of a database name, specify it using the \ escape character as \_ in the GRANT statement, to prevent the user from being able to access additional databases matching the wildcard pattern (for example, GRANT ... ON `foo\_bar`.* TO ...). " The SQL statement "grant SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `my_test`.* to 'user1';" will grant the permissions to myXtest and myYtest databases as well and this is not what the user wants.