mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add sql wall test
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.druid.bvt.filter.wall;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.filter.wall.WallUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OracleWallPermitTableTest extends TestCase {
|
||||
|
||||
public void test_permitTable() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from TAB"));
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from tab"));
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from SYS.TAB"));
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select * from SYS.\"TAB\""));
|
||||
}
|
||||
}
|
||||
@@ -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 WallUnionTest extends TestCase {
|
||||
|
||||
public void testMySql() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateMySql("select f1, f2 from t union select 1, 2"));
|
||||
}
|
||||
|
||||
public void testOracle() throws Exception {
|
||||
Assert.assertFalse(WallUtils.isValidateOracle("select f1, f2 from t union select 1, 2"));
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class OnlineOracleTest3 extends TestCase {
|
||||
}
|
||||
|
||||
public void test_connect() throws Exception {
|
||||
execute("select * from session_roles");
|
||||
executeQuery("select * from TAB");
|
||||
}
|
||||
|
||||
public void executeQuery(String sql) throws SQLException {
|
||||
|
||||
Reference in New Issue
Block a user