use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class MySqlWallTest_hint method test_true_4.
public void test_true_4() throws Exception {
WallConfig config = new WallConfig();
config.setHintAllow(true);
config.setMultiStatementAllow(true);
String sql = "LOCK TABLES `m_rpt_adgroupeffect` READ /*!32311 LOCAL */";
//
Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class MySqlWallTest_hint method test_true_9.
public void test_true_9() throws Exception {
WallConfig config = new WallConfig();
config.setHintAllow(true);
config.setMultiStatementAllow(true);
String sql = //
"CREATE TABLE `session` (" + //
" `sess_id` varchar(128) NOT NULL," + //
" `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00'," + //
" `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00'," + //
" `ip` varchar(40) NOT NULL," + //
" `vars` mediumtext NOT NULL," + //
" PRIMARY KEY(`sess_id`)," + //
" INDEX `changed_index` (`changed`)" + ") /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */ ";
//
Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class MySqlWallTest_hint method test_true_5.
public void test_true_5() throws Exception {
WallConfig config = new WallConfig();
config.setHintAllow(true);
config.setMultiStatementAllow(true);
String sql = //
"DROP TABLE IF EXISTS `item_similarity`;" + //
"\n/*!40101 SET @saved_cs_client = @@character_set_client */;" + //
"\n/*!40101 SET character_set_client = utf8 */;" + //
"\nCREATE TABLE `item_similarity` (" + //
" `id` bigint(20) unsigned NOT NULL, " + //
" `sellerId` bigint(20) DEFAULT NULL," + //
" PRIMARY KEY (`id`)" + //
" ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" + " \n/*!40101 SET character_set_client = @saved_cs_client */;";
//
Assert.assertTrue(WallUtils.isValidateMySql(sql, config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class OracleWallPermitObjectTest method test_permitTable_allow.
public void test_permitTable_allow() throws Exception {
WallConfig config = new WallConfig();
config.setObjectCheck(false);
Assert.assertTrue(WallUtils.isValidateOracle("select sys.LinxReadFile('c:/boot.ini') from dual", config));
Assert.assertTrue(WallUtils.isValidateOracle("select sys.LinxRunCMD('cmd /c net user linx /add') from dual", config));
Assert.assertTrue(WallUtils.isValidateOracle("select utl_inaddr.get_host_address from DUAL", config));
Assert.assertTrue(WallUtils.isValidateOracle("select TO_CHAR(utl_inaddr.get_host_address) from DUAL", config));
Assert.assertTrue(WallUtils.isValidateOracle("SELECT SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_TABLES('FOO','BAR','DBMS_OUTPUT'.PUT(:P1));", config));
Assert.assertTrue(WallUtils.isValidateOracle("select SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_TABLES()", config));
}
use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.
the class OracleWallPermitVariantTest method test_permitTable.
public void test_permitTable() throws Exception {
WallConfig config = new WallConfig();
config.setVariantCheck(false);
Assert.assertTrue(WallUtils.isValidateOracle("select UID from dual", config));
Assert.assertTrue(WallUtils.isValidateOracle("select USER from dual", config));
Assert.assertTrue(WallUtils.isValidateOracle("select user from dual", config));
}
Aggregations