use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class MySqlWallTest93 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
Assert.assertTrue(//
provider.checkValid("desc tablename"));
Assert.assertEquals(0, provider.getTableStats().size());
}
use of com.alibaba.druid.wall.WallProvider 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());
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class MySqlWallTest95 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setCommentAllow(false);
Assert.assertFalse(//
provider.checkValid("select * from test /*!40101fff*/"));
}
use of com.alibaba.druid.wall.WallProvider 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.WallProvider in project druid by alibaba.
the class MySqlWallTest_comment method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setCommentAllow(false);
Assert.assertTrue(provider.checkValid("/* this is comment */ SELECT id FROM t "));
Assert.assertTrue(provider.checkValid("-- this is comment \n SELECT * FROM t"));
Assert.assertTrue(provider.checkValid("#this is comment \n SELECT * FROM t"));
Assert.assertFalse(provider.checkValid("/*!40101fff*/ select * from t"));
Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 #this is comment \n and b=1"));
Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 -- this is comment \n and c=1"));
Assert.assertTrue(provider.checkValid("SELECT * FROM t where a=1 /* this is comment */ and d=1"));
Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 \n and e=1"));
Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- AND c=1 \n and f=1"));
Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */ and g=1"));
Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 #and c=1 "));
Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 -- and c=1"));
Assert.assertFalse(provider.checkValid("SELECT * FROM t where a=1 /* and c=1 */"));
}
Aggregations