mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql wall
This commit is contained in:
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.filter.wall;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.filter.wall.WallConfig;
|
||||
import com.alibaba.druid.filter.wall.WallUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
@@ -13,8 +14,15 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class MySqlWallPermitTableTest extends TestCase {
|
||||
|
||||
public void test_permitTable() throws Exception {
|
||||
public void test_default() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("select benchmark( 500000, sha1( 'test' ) )"));
|
||||
}
|
||||
|
||||
public void test_allow() throws Exception {
|
||||
WallConfig config = new WallConfig();
|
||||
config.setTableCheck(false);
|
||||
|
||||
Assert.assertTrue(WallUtils.isValidateMySql("select benchmark( 500000, sha1( 'test' ) )", config));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.filter.wall.WallConfig;
|
||||
import com.alibaba.druid.filter.wall.WallUtils;
|
||||
|
||||
/**
|
||||
@@ -17,4 +18,10 @@ public class OracleWallPermitFunctionTest extends TestCase {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual"));
|
||||
}
|
||||
|
||||
public void test_permitTable_allow() throws Exception {
|
||||
WallConfig config = new WallConfig();
|
||||
config.setFunctionCheck(false);
|
||||
Assert.assertTrue(WallUtils.isValidateOracle("select SYS_CONTEXT ('USERENV', 'CURRENT_USER') from dual", config));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.filter.wall.WallConfig;
|
||||
import com.alibaba.druid.filter.wall.WallUtils;
|
||||
|
||||
/**
|
||||
@@ -22,4 +23,14 @@ public class OracleWallPermitObjectTest extends TestCase {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_TABLES()"));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user