use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUnionTest4 method testMySql.
public void testMySql() throws Exception {
WallConfig config = new WallConfig();
config.setSelectUnionCheck(true);
Assert.assertTrue(WallUtils.isValidateMySql("SELECT id, product FROM T1 t where id=1 UNION (SELECT * FROM (SELECT 1,'x') X)", config));
Assert.assertFalse(WallUtils.isValidateMySql("SELECT id, product FROM T1 t where id=1 UNION (SELECT * FROM (SELECT 1,'x') X) -- ", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUpdateWhereTest1 method test_check_false.
public void test_check_false() throws Exception {
WallConfig config = new WallConfig();
config.setUpdateWhereAlayTrueCheck(false);
config.setConditionAndAlwayTrueAllow(true);
config.setCommentAllow(true);
Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
Assert.assertTrue(WallUtils.isValidateMySql(sql1, config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class WallUpdateWhereTest1 method test_check_true.
public void test_check_true() throws Exception {
WallConfig config = new WallConfig();
config.setUpdateWhereAlayTrueCheck(true);
config.setConditionAndAlwayTrueAllow(true);
config.setCommentAllow(true);
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
Assert.assertFalse(WallUtils.isValidateMySql(sql1, config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class MySqlWallDescribteTest method test_allow.
public void test_allow() throws Exception {
WallConfig config = new WallConfig();
config.setDescribeAllow(true);
Assert.assertTrue(WallUtils.isValidateMySql("describe t", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class MySqlWallTest_hint method test_false_1.
public void test_false_1() throws Exception {
WallConfig config = new WallConfig();
config.setHintAllow(true);
config.setMultiStatementAllow(true);
String sql = "select * from person where id = '3'/**/union select 0,1,v from (select 1,2,user/*!() as v*/) a where '1'<>''";
//
Assert.assertFalse(WallUtils.isValidateMySql(sql, config));
}
Aggregations