Search in sources :

Example 16 with WallConfig

use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.

the class WallConfigTest method test_insertAllow_false.

public void test_insertAllow_false() throws Exception {
    Properties properties = new Properties();
    properties.setProperty("druid.wall.insertAllow", "false");
    WallConfig config = new WallConfig();
    config.configFromProperties(properties);
    Assert.assertFalse(config.isInsertAllow());
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig) Properties(java.util.Properties)

Example 17 with WallConfig

use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.

the class WallDeleteWhereTest1 method testORACLE_false.

public void testORACLE_false() throws Exception {
    WallConfig config = new WallConfig();
    config.setDeleteWhereNoneCheck(true);
    Assert.assertFalse(WallUtils.isValidateOracle(sql, config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 18 with WallConfig

use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.

the class WallDropTest method testMySql.

public void testMySql() throws Exception {
    WallConfig config = new WallConfig();
    config.setDropTableAllow(false);
    Assert.assertFalse(WallUtils.isValidateMySql("DROP TABLE T1", config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 19 with WallConfig

use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.

the class MySqlWallTest25 method test_false.

public void test_false() throws Exception {
    WallConfig config = new WallConfig();
    config.setUpdateWhereNoneCheck(true);
    Assert.assertFalse(//
    WallUtils.isValidateMySql("update test.dml_health_check set id=?", //
    config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Example 20 with WallConfig

use of com.alibaba.druid.wall.WallConfig in project druid by alibaba.

the class WallUnionTest method testMySql.

public void testMySql() throws Exception {
    WallConfig config = new WallConfig();
    config.setSelectUnionCheck(true);
    Assert.assertTrue(WallUtils.isValidateMySql("select f1, f2 from t where f1=1 union select 1, 2", config));
    Assert.assertFalse(WallUtils.isValidateMySql("select f1, f2 from t where f1=1 union select 1, 2 --", config));
}
Also used : WallConfig(com.alibaba.druid.wall.WallConfig)

Aggregations

WallConfig (com.alibaba.druid.wall.WallConfig)82 Properties (java.util.Properties)8 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)4 WallFilter (com.alibaba.druid.wall.WallFilter)4 WallCheckResult (com.alibaba.druid.wall.WallCheckResult)3 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)2 OracleMockDriver (com.alibaba.druid.test.util.OracleMockDriver)2 WallContext (com.alibaba.druid.wall.WallContext)2 MySqlWallProvider (com.alibaba.druid.wall.spi.MySqlWallProvider)2 Filter (com.alibaba.druid.filter.Filter)1 SQLCommentHint (com.alibaba.druid.sql.ast.SQLCommentHint)1 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)1 SQLStartTransactionStatement (com.alibaba.druid.sql.ast.statement.SQLStartTransactionStatement)1 MySqlCommitStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCommitStatement)1 MySqlDeleteStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement)1 MySqlDescribeStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDescribeStatement)1 MySqlHintStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlHintStatement)1 MySqlLockTableStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlLockTableStatement)1 MySqlRenameTableStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStatement)1 MySqlReplaceStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement)1