Bug #17581 Triggers meta-data should be protected by SUPER privilege
Submitted: 20 Feb 2006 13:13 Modified: 11 Sep 2006 9:48
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.0-BK/5.1 BK OS:Any (all)
Assigned to: Alexander Nozdrin CPU Architecture:Any

[20 Feb 2006 13:13] Alexander Nozdrin
Description:
The operations for retrieving meta-data of triggers (SHOW TRIGGERS; SELECT *
FROM INFORMATION_SCHEMA.TRIGGERS) should be allowed only for the users having
SUPER privilege.

Now, USAGE privilege is enough to retrieve this information.

How to repeat:
(station)[~/MySQL/devel/5.0-bug7787]> ./client/mysql -u root test
mysql> CREATE TABLE t1 (c INT);
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE TRIGGER trg1 AFTER INSERT ON t1 FOR EACH ROW SET @a = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT USAGE ON *.* TO u1@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW GRANTS FOR u1@localhost;
+----------------------------------------+
| Grants for u1@localhost                |
+----------------------------------------+
| GRANT USAGE ON *.* TO 'u1'@'localhost' |
+----------------------------------------+
1 row in set (0.00 sec)

mysql> Bye

(station)[~/MySQL/devel/5.0-bug7787]> ./client/mysql -u u1 test
mysql> SELECT CURRENT_USER();
+----------------+
| CURRENT_USER() |
+----------------+
| u1@localhost   |
+----------------+
1 row in set (0.00 sec)

mysql> SHOW TRIGGERS;
+---------+--------+-------+------------+--------+---------+----------+----------------+
| Trigger | Event  | Table | Statement  | Timing | Created | sql_mode | Definer        |
+---------+--------+-------+------------+--------+---------+----------+----------------+
| trg1    | INSERT | t1    | set @a = 1 | AFTER  | NULL    |          | root@localhost |
+---------+--------+-------+------------+--------+---------+----------+----------------+
1 row in set (0.00 sec)

mysql> SELECT * FROM information_schema.triggers;
[cut]
1 row in set (0.01 sec)