Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
5.5(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
-
None
Description
create table t1 (a int);
|
insert into t1 values (1);
|
|
eval select * into outfile "../../tmp/outfile-test.1" from t1;
|
|
SELECT load_file("../../tmp/outfile-test.1") as file from t1;
|
|
create user test@localhost;
|
grant select on test.* to test@localhost;
|
|
create definer=test@localhost sql security definer view v1 as select * from t1;
|
|
SELECT load_file("../../tmp/outfile-test.1") as file from v1;
|
|
drop view v1;
|
|
create definer=test@localhost sql security definer view v1 as select load_file("../../tmp/outfile-test.1") as file from t1;
|
|
--echo # should be an error, but no
|
SELECT * from v1;
|
|
drop view v1;
|
create definer=root@localhost sql security definer view v1 as select * from t1;
|
|
connect (con1,localhost,test,,);
|
|
SELECT load_file("../../tmp/outfile-test.1") as file from v1;
|
|
connection default;
|
|
drop view v1;
|
create definer=root@localhost sql security definer view v1 as select load_file("../../tmp/outfile-test.1") as file from t1;
|
|
connection con1;
|
|
SELECT * from v1;
|
|
connection default;
|
disconnect con1;
|
|
drop view v1;
|
drop table t1;
|
drop user test@localhost;
|
result:
create table t1 (a int);
|
insert into t1 values (1);
|
select * into outfile "../../tmp/outfile-test.1" from t1;
|
SELECT load_file("../../tmp/outfile-test.1") as file from t1;
|
file
|
1
|
|
create user test@localhost;
|
grant select on test.* to test@localhost;
|
create definer=test@localhost sql security definer view v1 as select * from t1;
|
SELECT load_file("../../tmp/outfile-test.1") as file from v1;
|
file
|
1
|
|
drop view v1;
|
create definer=test@localhost sql security definer view v1 as select load_file("../../tmp/outfile-test.1") as file from t1;
|
# should be an error, but no
|
SELECT * from v1;
|
file
|
1
|
|
drop view v1;
|
create definer=root@localhost sql security definer view v1 as select * from t1;
|
SELECT load_file("../../tmp/outfile-test.1") as file from v1;
|
file
|
NULL
|
drop view v1;
|
create definer=root@localhost sql security definer view v1 as select load_file("../../tmp/outfile-test.1") as file from t1;
|
SELECT * from v1;
|
file
|
NULL
|
drop view v1;
|
drop table t1;
|
drop user test@localhost;
|
for EXEC priviledge everything is correct:
create table t1 (a int);
|
insert into t1 values (1);
|
|
create function one1() returns int return 1;
|
|
|
SELECT one1() as func from t1;
|
|
create user test@localhost;
|
grant select on test.* to test@localhost;
|
|
create definer=test@localhost sql security definer view v1 as select * from t1;
|
|
SELECT one1() as func from v1;
|
|
drop view v1;
|
|
create definer=test@localhost sql security definer view v1 as select one1() as func from t1;
|
create definer=root@localhost sql security definer view v2 as select one1() as func from t1;
|
|
SELECT * from v2;
|
--error ER_VIEW_INVALID
|
SELECT * from v1;
|
|
drop view v1;
|
create definer=root@localhost sql security definer view v1 as select * from t1;
|
|
connect (con1,localhost,test,,);
|
|
--error ER_PROCACCESS_DENIED_ERROR
|
SELECT one1() as func from v1;
|
|
connection default;
|
|
drop view v1,v2;
|
create definer=test@localhost sql security definer view v1 as select one1() as func from t1;
|
|
create definer=root@localhost sql security definer view v2 as select one1() as func from t1;
|
|
connection con1;
|
|
--error ER_VIEW_INVALID
|
SELECT * from v1;
|
SELECT * from v2;
|
|
connection default;
|
disconnect con1;
|
|
drop view v1,v2;
|
drop table t1;
|
drop function one1;
|
drop user test@localhost;
|
Attachments
Issue Links
- relates to
-
MDEV-22374 VIEW with security definer require FILE privilege from definer not invoker in case of INTO OUTFILE
- Stalled