mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve sql wall
This commit is contained in:
@@ -718,6 +718,24 @@ public abstract class WallProvider {
|
||||
}
|
||||
|
||||
private WallCheckResult checkWhiteAndBlackList(String sql) {
|
||||
// check black list
|
||||
if (blackListEnable) {
|
||||
WallSqlStat sqlStat = getBlackSql(sql);
|
||||
if (sqlStat != null) {
|
||||
blackListHitCount.incrementAndGet();
|
||||
violationCount.incrementAndGet();
|
||||
|
||||
if (sqlStat.isSyntaxError()) {
|
||||
syntaxErrrorCount.incrementAndGet();
|
||||
}
|
||||
|
||||
sqlStat.incrementAndGetExecuteCount();
|
||||
recordStats(sqlStat.getTableStats(), sqlStat.getFunctionStats());
|
||||
|
||||
return new WallCheckResult(sqlStat);
|
||||
}
|
||||
}
|
||||
|
||||
if (whiteListEnable) {
|
||||
WallSqlStat sqlStat = getWhiteSql(sql);
|
||||
if (sqlStat != null) {
|
||||
@@ -736,23 +754,6 @@ public abstract class WallProvider {
|
||||
return new WallCheckResult(sqlStat);
|
||||
}
|
||||
}
|
||||
// check black list
|
||||
if (blackListEnable) {
|
||||
WallSqlStat sqlStat = getBlackSql(sql);
|
||||
if (sqlStat != null) {
|
||||
blackListHitCount.incrementAndGet();
|
||||
violationCount.incrementAndGet();
|
||||
|
||||
if (sqlStat.isSyntaxError()) {
|
||||
syntaxErrrorCount.incrementAndGet();
|
||||
}
|
||||
|
||||
sqlStat.incrementAndGetExecuteCount();
|
||||
recordStats(sqlStat.getTableStats(), sqlStat.getFunctionStats());
|
||||
|
||||
return new WallCheckResult(sqlStat);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user