mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor wall filter
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user