1、错误信息改为中文
2、任务审核bug 3、指令查询不判断指令是否被删除 4、bugfix
This commit is contained in:
@@ -34,7 +34,7 @@ public class AlertMessage {
|
||||
private String modifyTime;
|
||||
@JsonProperty("alert_message_uuid")
|
||||
private String alertMessageUUID;
|
||||
|
||||
//1代表防护对象命中告警信息里的是目的ip,0代表防护对象命中告警信息里的是源ip
|
||||
@JsonProperty("protect_object_is_src_dst")
|
||||
private int protectIsSrcOrDst;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class StaticRuleObject {
|
||||
private String staticRuleURL;
|
||||
|
||||
@JsonProperty("static_rule_priority")
|
||||
@ExcelProperty("优先级")
|
||||
@ExcelIgnore
|
||||
@Max(value = 3)
|
||||
@Min(value = 1)
|
||||
@Schema(description = "优先级,1代表高2代表中3代表低", example = "1")
|
||||
|
||||
@@ -85,6 +85,9 @@ public class DynamicTaskInfo {
|
||||
|
||||
public void parseSql() {
|
||||
String bwSql = this.bwSql;
|
||||
if (bwSql == null) {
|
||||
return;
|
||||
}
|
||||
//解析SQL语句
|
||||
SQLStatementParser parser = new MySqlStatementParser(bwSql);
|
||||
// 使用Parser解析生成AST,这里SQLStatement就是AST
|
||||
|
||||
@@ -112,10 +112,10 @@ public class TemplateService {
|
||||
public Map<String, Object> updateAuditStatus(Integer id, Integer auditStatus) {
|
||||
Integer originalAuditStatus = templateMapper.queryAuditStatusById(id);
|
||||
if (originalAuditStatus == null) {
|
||||
throw new IllegalArgumentException("cannot find audit status of static rule " + id + ", maybe static rule doesn't exist?");
|
||||
throw new IllegalArgumentException("不能找到静态规则:" + id + ", 可能静态规则不存在?");
|
||||
}
|
||||
if (!AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(auditStatus)) {
|
||||
throw new IllegalArgumentException("invalid audit status");
|
||||
throw new IllegalArgumentException("审核状态修改不合逻辑");
|
||||
}
|
||||
Boolean success = templateMapper.updateAuditStatusById(id, auditStatus);
|
||||
|
||||
|
||||
@@ -88,17 +88,19 @@ public class TaskService {
|
||||
});
|
||||
taskMapper.newTaskDynamicRuleConcat(task.getTaskId(), task.getDynamicRuleIds());
|
||||
}
|
||||
if (task.getTaskType() != TaskTypeEnum.STATIC.getTaskType()){
|
||||
//校验防护对象是否存在
|
||||
boolean ProtectObjIdValid = task.getProtectObjectIds().stream()
|
||||
.allMatch(dynamicRuleMapper::queryProtectObjectById);
|
||||
if (!ProtectObjIdValid && !task.getProtectObjectIds().isEmpty()){
|
||||
throw new IllegalArgumentException("部分防护对象不存在");
|
||||
}
|
||||
//任务和防护对象多对多关联建立
|
||||
taskMapper.newTaskProtectObjectConcat(task.getTaskId(), task.getProtectObjectIds());
|
||||
}
|
||||
if (task.getTaskType() != TaskTypeEnum.STATIC.getTaskType()) {
|
||||
if (task.getProtectObjectIds() != null && !task.getProtectObjectIds().isEmpty()) {
|
||||
//校验防护对象是否存在
|
||||
boolean ProtectObjIdValid = task.getProtectObjectIds().stream()
|
||||
.allMatch(dynamicRuleMapper::queryProtectObjectById);
|
||||
if (!ProtectObjIdValid) {
|
||||
throw new IllegalArgumentException("部分防护对象不存在");
|
||||
}
|
||||
//任务和防护对象多对多关联建立
|
||||
taskMapper.newTaskProtectObjectConcat(task.getTaskId(), task.getProtectObjectIds());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return task.getTaskId();
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class WhiteListService {
|
||||
StaticRuleObject staticRuleObject = staticRuleMapper.queryStaticRuleById(ruleId);
|
||||
|
||||
if (staticRuleObject == null) {
|
||||
throw new IllegalArgumentException("invalid rule id");
|
||||
throw new IllegalArgumentException("无效的静态规则");
|
||||
}
|
||||
// 命中的whitelist列表:每一列包含ip port url
|
||||
return whiteListMapper.existWhiteListObject(staticRuleObject);
|
||||
@@ -192,11 +192,11 @@ public class WhiteListService {
|
||||
//查询目前curStatus
|
||||
Integer originalAuditStatus = whiteListMapper.queryWhiteListObjectAuditStuatusById(id);
|
||||
if (originalAuditStatus == null){
|
||||
throw new IllegalArgumentException("cannot find audit status of whitelist " + id + ", maybe whitelist doesn't exist?");
|
||||
throw new IllegalArgumentException("不能找到白名单 " + id + ", 可能该白名单不存在");
|
||||
}
|
||||
//判断是否可以修改
|
||||
if (!AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(auditStatus)) {
|
||||
throw new IllegalArgumentException("invalid audit status");
|
||||
throw new IllegalArgumentException("审核状态修改违规");
|
||||
}
|
||||
|
||||
Boolean success = whiteListMapper.updateWhiteListObjectAuditStatus(id, auditStatus);
|
||||
|
||||
Reference in New Issue
Block a user