NextMyDay/internal/core/middleware
Claus Lohmar f7d232950f fix(security): prune and cap the rate limiter state
REVIEW-001 (M0) M3s: the fixed-window limiter's state map was never pruned,
so a flood of distinct keys grew it without bound (memory DoS).

Sweep elapsed windows on insert — gated on a size threshold and at most once
per window, so it stays amortised — and hard-cap the map (65536 entries) as
the backstop. Expose Len() for tests/observability and cover both the sweep
and the cap.
2026-10-14 11:30:03 +00:00
..
audit.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
correlation.go feat(core): add the store, identity plumbing and the door (SPEC-003/004) 2026-10-14 10:53:51 +00:00
middleware_test.go fix(security): prune and cap the rate limiter state 2026-10-14 11:30:03 +00:00
ratelimit.go fix(security): prune and cap the rate limiter state 2026-10-14 11:30:03 +00:00