Skip to content
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

User information exists after the privileges are revoked in mysql.tables_priv #38421

Closed
mikecaat opened this issue Oct 12, 2022 · 5 comments · Fixed by #38552
Closed

User information exists after the privileges are revoked in mysql.tables_priv #38421

mikecaat opened this issue Oct 12, 2022 · 5 comments · Fixed by #38552
Assignees
Labels
severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@mikecaat
Copy link

Bug Report

Thanks for watching the issue. I found a MySQL compatibility broken case,
which is the mysql.tables have rows that user don't have any privileges to the table.

1. Minimal reproduce step (Required)

CREATE user test;
GRANT SELECT ON `mysql`.`db` TO test;
REVOKE SELECT ON `mysql`.`db` FROM test;
SELECT * FROM `mysql`.`tables_priv`;

2. What did you expect to see? (Required)

mysql.tables_priv doesn't have the row related to test user.

3. What did you see instead (Required)

I assumed that what Table_priv is NULL means the test user don't have any privileges to the table.
But, I think it's better to remove the row.

MySQL [(none)]> SELECT * FROM `mysql`.`tables_priv`;
+------+-------+------+------------+---------+---------------------+------------+-------------+
| Host | DB    | User | Table_name | Grantor | Timestamp           | Table_priv | Column_priv |
+------+-------+------+------------+---------+---------------------+------------+-------------+
| %    | mysql | test | db         |         | 2022-10-12 15:56:22 |            |             |
+------+-------+------+------------+---------+---------------------+------------+-------------+
1 row in set (0.03 sec)

When I test with MySQL 5.7, it removes the line when the user privilege is revoked.

4. What is your TiDB version? (Required)

MySQL [(none)]> SELECT tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                       |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.1.1
Edition: Community
Git Commit Hash: 5263a0abda61f102122735049fd0dfadc7b7f8b2
Git Branch: heads/refs/tags/v6.1.1
UTC Build Time: 2022-08-25 10:42:41
GoVersion: go1.18.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
@mikecaat mikecaat added the type/bug The issue is confirmed as a bug. label Oct 12, 2022
@CbcWestwolf
Copy link
Member

/assign

@wxbty
Copy link
Contributor

wxbty commented Oct 18, 2022

hi @CbcWestwolf ! can this task be assigned to me? if you don't have time

@CbcWestwolf
Copy link
Member

can this task be assigned to me?

Sure!

@CbcWestwolf
Copy link
Member

/assign wxbty

@dveeden
Copy link
Contributor

dveeden commented Oct 26, 2022

Looks similar to #38363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants