Details
-
Task
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
GRANT OPTION is not working as expected. Check below test case.
MariaDB [(none)]> GRANT SELECT ON mysql.* TO 'irfan'@'localhost' IDENTIFIED BY 'irfan' WITH GRANT OPTION;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [(none)]> GRANT UPDATE, REFERENCES ON mysql.* TO 'irfan'@'localhost';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [(none)]> SHOW GRANTS FOR 'irfan'@'localhost';
|
+--------------------------------------------------------------------------------------------------------------+
|
| Grants for irfan@localhost |
|
+--------------------------------------------------------------------------------------------------------------+
|
| GRANT USAGE ON *.* TO 'irfan'@'localhost' IDENTIFIED BY PASSWORD '*A0927C41A900C56A5D035EF05ED250A252A5421B' |
|
| GRANT SELECT, UPDATE, REFERENCES ON `mysql`.* TO 'irfan'@'localhost' WITH GRANT OPTION |
|
+--------------------------------------------------------------------------------------------------------------+
|
2 rows in set (0.000 sec)
|
So, at this point GRANT OPTION is only allocated to SELECT but it assigned to UPDATE, REFERENCES privilege too.
Let's verify If UPDATE, REFERENCES can be assigned to other user from assigned user.
$ mysql -uirfan -p -hlocalhost
|
Enter password:
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 26
|
Server version: 10.3.10-MariaDB Homebrew
|
|
MariaDB [(none)]> SELECT CURRENT_USER();
|
+-----------------+
|
| CURRENT_USER() |
|
+-----------------+
|
| irfan@localhost |
|
+-----------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [(none)]> GRANT SELECT ON mysql.* TO 'irfan1'@'localhost' IDENTIFIED BY 'irfan1';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [(none)]> GRANT UPDATE, REFERENCES ON mysql.* TO 'irfan1'@'localhost' IDENTIFIED BY 'irfan1';
|
Query OK, 0 rows affected (0.000 sec)
|
So, user can assign privileges which are not granted with GRANT OPTION i.e. UPDATE, REFERENCES