use of com.actiontech.dble.config.model.FirewallConfig in project dble by actiontech.
the class ServerPrivileges method checkFirewallSQLPolicy.
/**
* @see <a href="https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter">wallfilter config guide</a>
*/
@Override
public boolean checkFirewallSQLPolicy(String user, String sql) {
if (isManagerUser(user)) {
// manager User will ignore firewall blacklist
return true;
}
boolean isPassed = true;
FirewallConfig firewallConfig = DbleServer.getInstance().getConfig().getFirewall();
if (firewallConfig != null && firewallConfig.isBlackListCheck()) {
WallCheckResult result = firewallConfig.getProvider().check(sql);
if (!result.getViolations().isEmpty()) {
isPassed = false;
ALARM.warn("Firewall to intercept the '" + user + "' unsafe SQL , errMsg:" + result.getViolations().get(0).getMessage() + " \r\n " + sql);
}
}
return isPassed;
}
Aggregations