fix(waf): IP 组同步间隔下限改为 1 分钟

移除同步周期 5 分钟限制;回看窗口仍保持最小 5 分钟。
This commit is contained in:
ryan
2026-07-20 15:41:31 +08:00
parent 351e8ce78c
commit 866f1df5e3
3 changed files with 11 additions and 8 deletions
+1
View File
@@ -29,6 +29,7 @@ sidebar: false
### 改进 ### 改进
- IP 组自动规则中的 `StatusCount` / `StatusRatio` 支持状态码类写法(如 `"2xx"`、`"4xx"`、`"5xx"`),便于按整类错误率匹配。 - IP 组自动规则中的 `StatusCount` / `StatusRatio` 支持状态码类写法(如 `"2xx"`、`"4xx"`、`"5xx"`),便于按整类错误率匹配。
- IP 组同步间隔下限由 5 分钟调整为 1 分钟,便于更频繁同步自动/订阅名单。
### 修复 ### 修复
@@ -58,7 +58,7 @@ const ipGroupSchema = z
subscription_url: z.string(), subscription_url: z.string(),
subscription_format: z.enum(['text', 'json']), subscription_format: z.enum(['text', 'json']),
subscription_mapping_rule: z.string(), subscription_mapping_rule: z.string(),
sync_interval_minutes: z.number().int().min(5), sync_interval_minutes: z.number().int().min(1),
}) })
.superRefine((value, context) => { .superRefine((value, context) => {
if (value.type === 'subscription' && !value.subscription_url.trim()) { if (value.type === 'subscription' && !value.subscription_url.trim()) {
@@ -329,7 +329,7 @@ export function IPGroupDialog({
<FormControl> <FormControl>
<Input <Input
type='number' type='number'
min={5} min={1}
value={field.value} value={field.value}
onChange={(event) => onChange={(event) =>
field.onChange(Number(event.target.value)) field.onChange(Number(event.target.value))
@@ -337,7 +337,7 @@ export function IPGroupDialog({
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
最小 5 分钟,默认 1440 分钟。 最小 1 分钟,默认 1440 分钟。
</FormDescription> </FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -376,7 +376,7 @@ export function IPGroupDialog({
<FormControl> <FormControl>
<Input <Input
type='number' type='number'
min={5} min={1}
value={field.value} value={field.value}
onChange={(event) => onChange={(event) =>
field.onChange(Number(event.target.value)) field.onChange(Number(event.target.value))
@@ -384,7 +384,8 @@ export function IPGroupDialog({
/> />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
定时从请求日志挖掘恶意 IP 的周期。最小 5 分钟。 定时从请求日志挖掘恶意 IP 的周期。最小 1 分钟,默认
1440 分钟。
</FormDescription> </FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
+4 -3
View File
@@ -32,7 +32,8 @@ const (
defaultWAFIPGroupSyncIntervalMinutes = 1440 defaultWAFIPGroupSyncIntervalMinutes = 1440
defaultWAFIPGroupAutoLookbackMinutes = 60 defaultWAFIPGroupAutoLookbackMinutes = 60
minWAFIPGroupSyncIntervalMinutes = 5 minWAFIPGroupSyncIntervalMinutes = 1
minWAFIPGroupAutoLookbackMinutes = 5
maxWAFIPGroupSyncIntervalMinutes = 43200 maxWAFIPGroupSyncIntervalMinutes = 43200
minPoWSessionTTLSeconds = 60 minPoWSessionTTLSeconds = 60
minPoWChallengeTTLSeconds = 30 minPoWChallengeTTLSeconds = 30
@@ -507,8 +508,8 @@ func parseIPGroupAutoConfig(raw json.RawMessage) (ipGroupAutoConfig, error) {
if config.LookbackMinutes <= 0 { if config.LookbackMinutes <= 0 {
config.LookbackMinutes = defaultWAFIPGroupAutoLookbackMinutes config.LookbackMinutes = defaultWAFIPGroupAutoLookbackMinutes
} }
if config.LookbackMinutes < minWAFIPGroupSyncIntervalMinutes { if config.LookbackMinutes < minWAFIPGroupAutoLookbackMinutes {
config.LookbackMinutes = minWAFIPGroupSyncIntervalMinutes config.LookbackMinutes = minWAFIPGroupAutoLookbackMinutes
} }
if config.LookbackMinutes > maxWAFIPGroupSyncIntervalMinutes { if config.LookbackMinutes > maxWAFIPGroupSyncIntervalMinutes {
config.LookbackMinutes = maxWAFIPGroupSyncIntervalMinutes config.LookbackMinutes = maxWAFIPGroupSyncIntervalMinutes