use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class MySqlWallTest80 method test_true.
public void test_true() throws Exception {
WallProvider provider = new MySqlWallProvider();
Assert.assertTrue(//
provider.checkValid("SELECT * FROM T WHERE FID = ? OR FID LIKE 1"));
Assert.assertEquals(1, provider.getTableStats().size());
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class MySqlWallTest82 method test_false.
public void test_false() throws Exception {
WallProvider provider = new MySqlWallProvider();
provider.getConfig().setStrictSyntaxCheck(false);
Assert.assertFalse(//
provider.checkValid("SELECT * FROM T WHERE FID = '\0a' OR LEAST(2,1,9,8) = 1"));
Assert.assertEquals(1, provider.getTableStats().size());
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class SQLServerWallTest_0 method initWallProvider.
private WallProvider initWallProvider() {
WallProvider provider = new SQLServerWallProvider();
provider.getConfig().setStrictSyntaxCheck(false);
provider.getConfig().setMultiStatementAllow(true);
provider.getConfig().setConditionAndAlwayTrueAllow(true);
provider.getConfig().setNoneBaseStatementAllow(true);
provider.getConfig().setLimitZeroAllow(true);
provider.getConfig().setConditionDoubleConstAllow(true);
provider.getConfig().setCommentAllow(true);
provider.getConfig().setSelectUnionCheck(false);
return provider;
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class SQLServerWallTest_10 method test_true.
public void test_true() throws Exception {
WallProvider provider = new SQLServerWallProvider();
String sql = "select top 50 * FROM [V_Goods_WithAvailableStockQuantity] where Status='����' and (Code like '%mu%' ESCAPE '\' or Model like '%mu%' ESCAPE '\' or Spec like '%mu%' ESCAPE '\' or BarCode like '%mu%' ESCAPE '\' or ProductName like '%mu%' ESCAPE '\' or dbo.F_GetPY(ProductName) like '%mu%' ESCAPE '\') ";
Assert.assertTrue(provider.checkValid(sql));
}
use of com.alibaba.druid.wall.WallProvider in project druid by alibaba.
the class SQLServerWallTest_11 method test_true.
public void test_true() throws Exception {
WallProvider provider = new SQLServerWallProvider();
provider.getConfig().setCommentAllow(true);
String sql = //
"SELECT KL_ArticleContent,KL_ArticleTitle " + //
"FROM dbo.KL_Article " + //
"WHERE KL_ArticleId =-4731 " + //
"UNION ALL " + "SELECT (SELECT TOP 1 CHAR(58)+CHAR(108)+CHAR(107)+CHAR(103)+CHAR(58)+ISNULL(CAST(name AS NVARCHAR(4000)),CHAR(32))+CHAR(58)+CHAR(109)+CHAR(122)+CHAR(104)+CHAR(58) FROM sys.sql_logins WHERE ISNULL(name,CHAR(32)) NOT IN (SELECT TOP 0 ISNULL(name,CHAR(32)) FROM sys.sql_logins ORDER BY 1) ORDER BY 1),NULL-- ";
Assert.assertFalse(provider.checkValid(sql));
}
Aggregations