use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest128 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setCommentAllow(false);
String sql = "SELECT name, '******' password, createTime from user where name like 'admin' AND (CASE WHEN (7885=7885) THEN 1 ELSE 0 END)";
Assert.assertFalse(provider.checkValid(sql));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest131 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setCommentAllow(true);
Assert.assertFalse(provider.checkValid("select * from t where id = 1 /*!30000union all select 2*/"));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest135 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
Assert.assertFalse(provider.checkValid("SELECT * FROM Users WHERE id = '1' AND MID(VERSION(),1,1) = '5';"));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest139 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
String sql = //
"select count(1) as total " + //
" from (" + //
" select '' buyer_nick from dual " + //
" where 1=0 " + //
" union " + //
" select distinct buyer_nick " + //
" from sys_info.orders " + //
" where 1=1 and receiver_district in ('平谷区')" + //
") a " + //
"inner join (" + //
" select buyer_nick from (" + //
" select distinct buyer_nick " + //
" from sys_info.orders " + //
" where 1=1 and created > '2013-07-28' " + //
" ) recent_days " + //
"inner join (" + //
" select distinct buyer_nick " + //
" from sys_info.orders " + //
" where 1=1 and seller_nick in ('创维官方旗舰店') " + //
" ) seller_nick using(buyer_nick) " + ") b using(buyer_nick)";
Assert.assertTrue(provider.checkValid(sql));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest140 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
String sql = //
"SELECT name, '******' password, createTime from user " + //
"where name like 'admin%' " + " AND 8600=CONVERT(INT,(SELECT CHAR(113)+CHAR(118)+CHAR(100)+CHAR(114)+CHAR(113)+(SELECT (CASE WHEN (8600=8600) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(118)+CHAR(98)+CHAR(97)+CHAR(113))) AND '%'=''";
Assert.assertFalse(provider.checkValid(sql));
}
Aggregations