Bug #17033 | trigger privilege checks | ||
---|---|---|---|
Submitted: | 2 Feb 2006 9:48 | Modified: | 6 Feb 2006 9:45 |
Reporter: | Sergei Golubchik | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.1.6 | OS: | |
Assigned to: | CPU Architecture: | Any |
[2 Feb 2006 9:48]
Sergei Golubchik
[6 Feb 2006 15:54]
Dmitry Lenev
Hi! Actually thanks for recent fixes of bug #15166 and bug #15196 current 5.1 behaves sligthly differently. I am pasting small script for mysqltest program that will demonstrate current behavior: CREATE DATABASE mysqltest_db1; CREATE USER mysqltest_dfn@localhost; GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost; CREATE TABLE mysqltest_db1.t1 (id int, val int); INSERT INTO mysqltest_db1.t1 VALUES (1,1), (2,2); --connect (dfn_con,localhost,mysqltest_dfn,,mysqltest_db1) SHOW GRANTS; # Grants for mysqltest_dfn@localhost # GRANT USAGE ON *.* TO 'mysqltest_dfn'@'localhost' # GRANT TRIGGER ON `mysqltest_db1`.* TO 'mysqltest_dfn'@'localhost' # Statement 1 CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:= NEW.id; # Statement 2 CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET NEW.val:= 100; --connection default # Statement 3 --error ER_COLUMNACCESS_DENIED_ERROR INSERT INTO mysqltest_db1.t1 VALUES (3, 3); # ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for column 'id' in table 't1' # Statement 4 --error ER_COLUMNACCESS_DENIED_ERROR UPDATE mysqltest_db1.t1 SET val= 10 WHERE id=2; # ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for column 'val' in table 't1' # End of test
[13 May 2010 1:56]
Roel Van de Paar
And current behavior is different again it seems mysql> create trigger trg1 before insert on t1 for each row set @a:=new.a; ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) ... mysql> CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:= NEW.id; ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)