-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
executor, privileges: fix infoschema.user_privileges privilege requirements #26070
Conversation
b932ddb
to
d4cb1d4
Compare
I tried it on MySQL, but why can I only see myself even if I have the mysql -h127.1 -P3306 -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 8.0.25 Homebrew
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant select on mysql.user to 'test_user'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
mysql -h127.1 -P3306 -utest_user
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 8.0.25 Homebrew
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from information_schema.user_privileges;
+-------------------------+---------------+----------------+--------------+
| GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE |
+-------------------------+---------------+----------------+--------------+
| 'test_user'@'localhost' | def | USAGE | NO |
+-------------------------+---------------+----------------+--------------+
1 row in set (0.00 sec) |
@djshow832 can you paste the output of MySQL expands 127.0.0.1 to localhost, but in your example you have I think it might be because I check for a match against |
mysql -hlocalhost -P3306 -utest_user
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 8.0.25 Homebrew
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from information_schema.user_privileges;
+-------------------------+---------------+----------------+--------------+
| GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE | IS_GRANTABLE |
+-------------------------+---------------+----------------+--------------+
| 'test_user'@'localhost' | def | USAGE | NO |
+-------------------------+---------------+----------------+--------------+
1 row in set (0.00 sec)
mysql> select * from mysql.user where user='root' limit 1\G
*************************** 1. row ***************************
Host: 127.0.0.1
User: root
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher: NULL
x509_issuer: NULL
x509_subject: NULL
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: caching_sha2_password
authentication_string:
password_expired: N
password_last_changed: 2020-03-27 16:27:34
password_lifetime: NULL
account_locked: N
Create_role_priv: Y
Drop_role_priv: Y
Password_reuse_history: NULL
Password_reuse_time: NULL
Password_require_current: NULL
User_attributes: NULL
1 row in set (0.00 sec) |
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.
same to Ming, mysql -h127.0.0.1 -P3306 -umy -p
seem whether granting the SELECT or not, the user 'my' here can only see themselves in MySQL8
OK, I've confirmed it is a bug. It requires |
@AilinKid @djshow832 This has been addressed in 2522c40 |
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.
LGTM
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 0da4dcf
|
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-4.0 in PR #26309 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.0 in PR #26310 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.1 in PR #26311 |
What problem does this PR solve?
Issue Number: #26069
Problem Summary:
The infoschema table showed the same results for everyone. That is not expected results. It is supposed to depend on the user's credentials.
What is changed and how it works?
What's Changed:
Accessing information_schema.user_privileges will now requires the SELECT privilege on mysql.user in order to show other user's privileges.
Related changes
Check List
Tests
Side effects
Release note