瀏覽代碼

feat(waf): 增加 AllowOrDeny 字段处理- 在 WafLogDataClean配置中添加 AllowOrDeny 字段
- 实现 AllowOrDeny 字段的数据清洗逻辑

fusu 2 天之前
父節點
當前提交
e101817442
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      internal/service/admin/waflogdataclean.go

+ 4 - 0
internal/service/admin/waflogdataclean.go

@@ -52,6 +52,7 @@ var apiFieldMappings = map[string]map[string]FieldPathConfig{
 		"AllowAndDenyIps": {Paths: []string{"ip", "ips", "data.ip", "data.ips"}, FieldType: "array_string"},
 		"RuleID":          {Paths: []string{"ruleId", "data.ruleId", "ids", "data.ids"}, FieldType: "array_int"},
 		"Comment":         {Paths: []string{"comment", "data.comment", "desc"}},
+		"AllowOrDeny" :    {Paths: []string{"allowOrDeny"}, FieldType: "int"},
 	},
 	"CC": {
 		"AllowAndDenyIps": {Paths: []string{"ips","newIp", "data.newIp","data.ips", "ip",  "data.ip" }},
@@ -197,7 +198,10 @@ func (s *wafLogDataCleanService) extractField(jsonStr, fieldName string, config
 		} else {
 			cleaned.AllowAndDenyIps = validPathResult.String()
 		}
+	case "AllowOrDeny":
+		cleaned.AllowOrDeny = int(validPathResult.Int())
 	}
+
 }
 
 // FormatBackendList 格式化后端地址列表(已简化)