improve WallFilter

This commit is contained in:
wenshao
2013-03-18 19:07:47 +08:00
parent c7689315a4
commit 6574a0d8cc
5 changed files with 98 additions and 40 deletions
@@ -24,62 +24,62 @@ import com.alibaba.druid.wall.spi.WallVisitorUtils;
public class WallConfig implements WallConfigMBean {
private boolean noneBaseStatementAllow = false;
private boolean noneBaseStatementAllow = false;
private boolean callAllow = true;
private boolean selelctAllow = true;
private boolean selectIntoAllow = true;
private boolean selectIntoOutfileAllow = false;
private boolean selectWhereAlwayTrueCheck = true;
private boolean selectHavingAlwayTrueCheck = true;
private boolean selectUnionCheck = true;
private boolean callAllow = true;
private boolean selelctAllow = true;
private boolean selectIntoAllow = true;
private boolean selectIntoOutfileAllow = false;
private boolean selectWhereAlwayTrueCheck = true;
private boolean selectHavingAlwayTrueCheck = true;
private boolean selectUnionCheck = true;
private boolean selectAllColumnAllow = true;
private boolean selectAllColumnAllow = true;
private boolean deleteAllow = true;
private boolean deleteWhereAlwayTrueCheck = true;
private boolean deleteAllow = true;
private boolean deleteWhereAlwayTrueCheck = true;
private boolean updateAllow = true;
private boolean updateWhereAlayTrueCheck = true;
private boolean updateAllow = true;
private boolean updateWhereAlayTrueCheck = true;
private boolean insertAllow = true;
private boolean mergeAllow = true;
private boolean insertAllow = true;
private boolean mergeAllow = true;
private boolean multiStatementAllow = false;
private boolean multiStatementAllow = false;
private boolean truncateAllow = false;
private boolean truncateAllow = false;
private boolean commentAllow = false;
private boolean commentAllow = false;
private boolean describeAllow = false;
private boolean describeAllow = false;
private boolean schemaCheck = true;
private boolean tableCheck = true;
private boolean functionCheck = true;
private boolean objectCheck = true;
private boolean variantCheck = true;
private boolean schemaCheck = true;
private boolean tableCheck = true;
private boolean functionCheck = true;
private boolean objectCheck = true;
private boolean variantCheck = true;
private boolean mustParameterized = false;
private boolean mustParameterized = false;
private boolean doPrivilegedAllow = false;
private boolean doPrivilegedAllow = false;
protected final Set<String> denyFunctions = new ConcurrentSkipListSet<String>();
protected final Set<String> denyTables = new ConcurrentSkipListSet<String>();
protected final Set<String> denySchemas = new ConcurrentSkipListSet<String>();
protected final Set<String> denyVariants = new ConcurrentSkipListSet<String>();
protected final Set<String> denyObjects = new ConcurrentSkipListSet<String>();
protected final Set<String> denyVariants = new ConcurrentSkipListSet<String>();
protected final Set<String> denyObjects = new ConcurrentSkipListSet<String>();
protected final Set<String> readOnlyTables = new ConcurrentSkipListSet<String>();
protected final Set<String> readOnlyTables = new ConcurrentSkipListSet<String>();
private String dir;
private String dir;
private boolean inited;
private boolean inited;
private String tenantTablePattern;
private String tenantColumn;
private String tenantTablePattern;
private String tenantColumn;
private boolean wrapAllow = true;
private boolean metadataAllow = true;
private boolean wrapAllow = true;
private boolean metadataAllow = true;
public WallConfig(){
@@ -458,6 +458,13 @@ public class WallVisitorUtils {
if (Boolean.FALSE == leftResult || Boolean.FALSE == rightResult) {
return false;
}
if (leftResult == Boolean.TRUE || rightResult == Boolean.TRUE) {
final WallConditionContext current = wallConditionContextLocal.get();
if (current != null) {
current.setPartAllowTrue(true);
}
}
if (Boolean.TRUE == leftResult && Boolean.TRUE == rightResult) {
return true;