R3: edge hardening — body cap, rate-limit observability, auto-flag, landing split #34
Reference in New Issue
Block a user
Delete Branch "feature/r3-edge-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase R3 of
PRERELEASE.md(TODO 2 + 8 + 3), feeding from the R2 trip report.Gateway
GATEWAY_MAX_BODY_BYTES(1 MiB): Connect per-message read limit +http.MaxBytesReaderon the public mux; oversizedExecute->resource_exhausted.MaxConcurrentStreams250,IdleTimeout3m) +ReadHeaderTimeout10s; values re-checked in R7.gateway_rate_limited_total{class}+ Debug per rejection; a 30 s reporter drains the per-key tracker into a Warn summary andPOST /api/v1/internal/ratelimit/report.AdminPerMinute/AdminBurstpolicy now 429-guards the/_gmmount ahead of its Basic-Auth; session-resolve infra failures log their cause at Warn (the R2 0.04%unauthenticated).Backend
accounts.flagged_high_rate_atbaked into the R1 baseline (the contour schema must be wiped after merge —DROP SCHEMA backend CASCADE+ restart, the R1 procedure); jet regenerated (also restores the missinggame_drafts/game_hiddenmodels).internal/ratewatch: bounded in-memory episode window + the conservative auto-flag (1000 rejected / 10 min,BACKEND_HIGHRATE_FLAG_*, set-once, operator clears, no auto-ban).Landing split
landingtarget ingateway/Dockerfile(caddy:2-alpine + the shared Vite build); the gateway dropslanding.htmlfrom the embed and 308-redirects/->/app/; the contour caddy routes/app/,/telegram/+ the Connect path to the gateway and the catch-all to the landing container; the CI probe checks both/and/app/.Observability/docs: Edge/UX dashboard panel (rate vs rejections by class); ARCHITECTURE par.2/11/12/13, FUNCTIONAL(+_ru), TESTING, READMEs, PRERELEASE refinements + tracker (R3 done).
Verified locally: gofmt/vet/build clean; 34 Go packages unit-green; the full integration suite green; UI check/test/build green; gateway+landing+backend images build; the landing container serves
/(no-cache, junk-path fallback) and the gateway image redirects/->/app/with no landing content.After merge: wipe the contour schema, then probe
/,/app/,/_gm/throttled; optionally a shortloadtesthammer run to watch the metric, the Warn summaries, the auto-flag and the operator clear end to end.- GATEWAY_MAX_BODY_BYTES (1 MiB): connect WithReadMaxBytes + http.MaxBytesReader on the public mux; explicit http2.Server MaxConcurrentStreams/IdleTimeout and an http.Server ReadHeaderTimeout (R2 report follow-up). - gateway_rate_limited_total{class} counter, Debug per rejection, a rejection tracker drained every 30 s into a Warn summary per key and a report POST to /api/v1/internal/ratelimit/report (feeds the admin view + auto-flag). - The dead AdminPerMinute/AdminBurst policy now guards the /_gm mount (429), ahead of its Basic-Auth. - resolve() logs the cause of infra session-resolve failures at Warn (the transient unauthenticated dips from the R2 run); unknown tokens stay silent.