mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
wall filter
This commit is contained in:
@@ -18,6 +18,8 @@ public class OracleWallPermitTableTest extends TestCase {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from tab"));
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from SYS.TAB"));
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from SYS.\"TAB\""));
|
||||
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from all_users"));
|
||||
}
|
||||
|
||||
public void test_permitTable_subquery() throws Exception {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.alibaba.druid.bvt.filter.wall;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.filter.wall.WallUtils;
|
||||
|
||||
/**
|
||||
* 这个场景,被攻击者用于测试当前SQL拥有多少字段
|
||||
* @author wenshao
|
||||
*
|
||||
*/
|
||||
public class WallDropTest extends TestCase {
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("DROP TABLE T1"));
|
||||
}
|
||||
|
||||
public void testOracle() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("DROP TABLE T1"));
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,11 @@ public class OnlineOracleTest3 extends TestCase {
|
||||
dataSource.setMaxActive(50);
|
||||
dataSource.setPoolPreparedStatements(true);
|
||||
dataSource.setMaxOpenPreparedStatements(100);
|
||||
// dataSource.setFilters("wall");
|
||||
}
|
||||
|
||||
public void test_connect() throws Exception {
|
||||
executeQuery("select utl_inaddr.get_host_address from DUAL");
|
||||
executeQuery("select * from all_users");
|
||||
}
|
||||
|
||||
public void executeQuery(String sql) throws SQLException {
|
||||
|
||||
Reference in New Issue
Block a user