pingcap / pingcap/tidb

grant user privilege use "_" Wildcard characters which cover the specially user privilege

Open
#41,259 0 comments 0 reactions 0 assignees View on GitHub
affects-8.5 may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

open a session A execute below sql:
CREATE DATABASE testDB_db01;
CREATE DATABASE testDB_db02;
CREATE DATABASE testDB1;
CREATE USER 'testUser'@'%' IDENTIFIED BY 'pingcap';
FLUSH PRIVILEGES;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX ON testDB_db01.* TO 'testUser'@'%';
open another session B use user testUser execute below sql:
user testDB_db01;
CREATE TABLE user_1(id INT);
INSERT INTO user_1 VALUES(2);
comeback to session A execute below sql:
GRANT SELECT ON `testDB\_%`.* TO 'testUser'@'%';
comeback to session B execute below sql:
user testDB_db01;
CREATE TABLE user_2(id INT);
INSERT INTO user_1 VALUES(3);

### 2. What did you expect to see? (Required)
these sqls execute in the session B all return successfully;
### 3. What did you see instead (Required)
after execute "GRANT SELECT ON `testDB\_%`.* TO 'testUser'@'%';" this sql ,these sqls execute in the session B return fail;
### 4. What is your TiDB version? (Required)
5.4.3 and 6.5.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.