refactor wall filter

This commit is contained in:
温少
2012-03-16 13:00:10 +08:00
13 changed files with 1621 additions and 1270 deletions
@@ -0,0 +1,20 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 这个场景测试访问Oracle系统对象
*
* @author admin
*/
public class OracleWallPermitFunctionTest extends TestCase {
public void test_permitTable() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle("select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual"));
}
}
@@ -0,0 +1,21 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 这个场景测试访问Oracle系统对象
*
* @author admin
*/
public class OracleWallPermitObjectTest extends TestCase {
public void test_permitTable() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle("select utl_inaddr.get_host_address from DUAL"));
Assert.assertFalse(WallUtils.isValidateOracle("select TO_CHAR(utl_inaddr.get_host_address) from DUAL"));
}
}
@@ -0,0 +1,21 @@
package com.alibaba.druid.bvt.filter.wall;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.filter.wall.WallUtils;
/**
* 这个场景测试访问Oracle系统对象
*
* @author admin
*/
public class OracleWallPermitSchemaTest extends TestCase {
public void test_permitTable() throws Exception {
Assert.assertFalse(WallUtils.isValidateOracle("select banner from sys.v_$version where rownum=1"));
Assert.assertFalse(WallUtils.isValidateOracle("select banner from sys.v where rownum=1"));
}
}
@@ -33,7 +33,7 @@ public class OnlineOracleTest3 extends TestCase {
}
public void test_connect() throws Exception {
executeQuery("select * from TAB");
executeQuery("select utl_inaddr.get_host_address from DUAL");
}
public void executeQuery(String sql) throws SQLException {