feat(security): Cloudflare-aware IP trust and admin-tunable anti-DDoS

- resolveClientIp: trust cf-connecting-ip only behind cf-ray/cdn-loop, use nginx x-real-ip otherwise (anti-spoof)
- antiddos-config: Redis-backed live config (antiddos:config) with 30s cache, 13 ANTI_DDOS_* env vars
- ddos-guard: consume tunable rates/tiers via getAntiddosConfig
- admin panel at /admin/devops/antiddos (save/reset/unban actions, PERMS.SETTINGS_VIEW)
- register new admin page in housekeeping migration matrix (146 -> 147)
This commit is contained in:
openhands
2026-09-22 22:22:51 +02:00
parent fd4d0fa1cb
commit f0c27eb815
17 changed files with 1151 additions and 63 deletions
@@ -272,6 +272,36 @@ export const systemMigrationEntries: readonly MigrationEntry[] = [
localization: "PARTIAL",
accessibility: "PARTIAL",
}),
plannedSystemEntry({
surface: "admin",
legacyPath: "/admin/devops/antiddos",
sourceFile: "src/app/admin/devops/antiddos/page.tsx",
targetPath: "/admin/system/configuration/antiddos",
decision: "REHOST",
capabilities: {
read: [PERMS.SETTINGS_VIEW],
mutate: [PERMS.SETTINGS_EDIT],
},
dependencies: {
queries: [
"antiddos:config override",
"WebsiteSetting antiddos_*",
"blocked anti-DDoS IPs",
"GET /api/health",
],
mutations: [
"saveAntiddosSettings",
"resetAntiddosSettings",
"unbanAntiddosIp",
],
},
auditRequirement: "MUTATION",
localization: "PARTIAL",
accessibility: "PARTIAL",
notes: [
"Tunable anti-DDoS rates and block tiers; Cloudflare detection is read-only and driven by cf-ray/cdn-loop presence",
],
}),
plannedSystemEntry({
surface: "admin",
legacyPath: "/admin/emulator",