use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest99 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setCommentAllow(false);
String sql = "select * from t where id = ? or substr(bin(97>>7), -1, 1) = 0";
Assert.assertFalse(provider.checkValid(sql));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest_concat method test_true.
public void test_true() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setSelectHavingAlwayTrueCheck(true);
Assert.assertTrue(//
provider.checkValid("select * from tb_product_word where name='' or CONCAT(name,style)='' or CONCAT(shop,style)='' or CONCAT(ename,style)=''"));
Assert.assertEquals(1, provider.getTableStats().size());
Assert.assertTrue(provider.getTableStats().containsKey("tb_product_word"));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest91 method initWallProvider.
private WallProvider initWallProvider() {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setStrictSyntaxCheck(false);
provider.getConfig().setMultiStatementAllow(true);
provider.getConfig().setConditionAndAlwayTrueAllow(true);
provider.getConfig().setNoneBaseStatementAllow(true);
provider.getConfig().setLimitZeroAllow(true);
provider.getConfig().setConditionDoubleConstAllow(true);
provider.getConfig().setCommentAllow(true);
provider.getConfig().setSelectUnionCheck(false);
return provider;
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest92 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
Assert.assertFalse(//
provider.checkValid("SELECT * FROM T WHERE FID = 40 OR 1 = (SELECT (CASE WHEN (4484=4484) THEN 1 ELSE 0 END))"));
Assert.assertEquals(1, provider.getTableStats().size());
Assert.assertTrue(provider.getTableStats().containsKey("t"));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class MySqlWallTest94 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
Assert.assertTrue(//
provider.checkValid("select * from test having 1=1"));
Assert.assertEquals(1, provider.getTableStats().size());
}
Aggregations