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

Show grants using more than two roles return incorrect result #30855

Closed
xuanyu66 opened this issue Dec 19, 2021 · 4 comments · Fixed by #31322
Closed

Show grants using more than two roles return incorrect result #30855

xuanyu66 opened this issue Dec 19, 2021 · 4 comments · Fixed by #31322
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@xuanyu66
Copy link
Contributor

xuanyu66 commented Dec 19, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE DATABASE IF NOT EXISTS tispark_test;
CREATE TABLE IF NOT EXISTS tispark_test.table_test(i int, s varchar(128));
CREATE ROLE IF NOT EXISTS 'test_read', 'test_write';
GRANT SELECT ON tispark_test.table_test TO 'test_read'@'%';
GRANT UPDATE ON tispark_test.table_test TO 'test_write'@'%';
CREATE USER IF NOT EXISTS 'tispark_unit_test_user' IDENTIFIED BY '';
GRANT 'test_read','test_write' TO 'tispark_unit_test_user'@'%';
SHOW GRANTS FOR 'tispark_unit_test_user'@'%' USING 'test_read','test_write';

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

MySQL version: 8.0.27
image

3. What did you see instead (Required)

image

Actually, if I use command SET ROLE 'test_read', 'test_write', it still can select rows from table tispark_test.table_test. So I think it's a bug for SHOW GRANTS

4. What is your TiDB version? (Required)

TiDB version:5.3.0
image

@xuanyu66 xuanyu66 added the type/bug The issue is confirmed as a bug. label Dec 19, 2021
@sunxiaoguang
Copy link
Contributor

cc @pingcap/tidb-committers

@wjhuang2016
Copy link
Member

@morgo PTAL

@morgo morgo added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major and removed severity/moderate labels Dec 24, 2021
@morgo
Copy link
Contributor

morgo commented Dec 24, 2021

I can take a look next year when I get back from vacation if this is still open :-) I have found SHOW GRANTS compatibility very hard, but it is important to get right because users make decisions based on this.

@djshow832 djshow832 self-assigned this Jan 5, 2022
@djshow832 djshow832 added affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. labels Jan 5, 2022
ti-chi-bot pushed a commit that referenced this issue Jan 6, 2022
@github-actions
Copy link

github-actions bot commented Jan 6, 2022

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
6 participants