add sql wall test

This commit is contained in:
温少
2012-03-15 23:24:32 +08:00
parent 5ddff762bd
commit 905d47d9f5
11 changed files with 1533 additions and 39 deletions
@@ -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 {