use of com.alibaba.druid.wall.spi.MySqlWallProvider in project Mycat_plus by coderczp.
the class FirewallConfig method init.
public void init() {
if (check) {
provider = new MySqlWallProvider(wallConfig);
provider.setBlackListEnable(true);
}
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project Mycat-Server by MyCATApache.
the class FirewallConfig method init.
public void init() {
if (check) {
provider = new MySqlWallProvider(wallConfig);
provider.setBlackListEnable(true);
}
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class WallStatTest_select_2 method testMySql.
public void testMySql() throws Exception {
WallProvider provider = new MySqlWallProvider();
assertTrue(provider.checkValid(sql));
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class WallStatTest_whiteList_syntaxError method testMySql.
public void testMySql() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setStrictSyntaxCheck(false);
String sql = "select xx * x *";
Assert.assertTrue(provider.checkValid(sql));
{
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(0, tableStat.getSelectCount());
Assert.assertEquals(0, provider.getBlackListHitCount());
Assert.assertEquals(0, provider.getWhiteListHitCount());
Assert.assertEquals(0, provider.getWhiteList().size());
Assert.assertEquals(0, provider.getBlackList().size());
Assert.assertEquals(1, provider.getCheckCount());
Assert.assertEquals(1, provider.getSyntaxErrorCount());
Assert.assertEquals(1, provider.getHardCheckCount());
}
Assert.assertTrue(provider.checkValid(sql));
{
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(0, tableStat.getSelectCount());
Assert.assertEquals(0, provider.getBlackListHitCount());
Assert.assertEquals(0, provider.getWhiteListHitCount());
Assert.assertEquals(0, provider.getWhiteList().size());
Assert.assertEquals(0, provider.getBlackList().size());
Assert.assertEquals(2, provider.getCheckCount());
Assert.assertEquals(2, provider.getSyntaxErrorCount());
Assert.assertEquals(2, provider.getHardCheckCount());
}
}
use of com.alibaba.druid.wall.spi.MySqlWallProvider in project druid by alibaba.
the class WallStatTest_alter_table method testMySql.
public void testMySql() throws Exception {
String sql = "alter table t add column fname varchar(50)";
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setAlterTableAllow(true);
Assert.assertTrue(provider.checkValid(sql));
WallTableStat tableStat = provider.getTableStat("t");
Assert.assertEquals(1, tableStat.getAlterCount());
}
Aggregations