Skip to main content
Menu
Advisories

Summary _redis_request_count in guard_core/handlers/ratelimit_handler.py caught every Redis error (including GuardRedisError from a failed connection), logged it, and returned no count, so both…

GHSA-HM8G-XG6V-JJG9Published Updated GitHub

Description

_redis_request_count in guard_core/handlers/ratelimit_handler.py caught every Redis error (including GuardRedisError from a failed connection), logged it, and returned no count, so both check_rate_limit (the HTTP pipeline) and check_rate_limit_by_ip (websocket and framework-agnostic callers) fell back to the in-memory per-process window. redis_fail_open (default False) documents fail-closed behaviour on Redis failure for every check, but the rate limiter never raised.

Impact

During a Redis outage, or when a Redis-down state is induced, a deployment with N workers enforces N times its configured rate limit per client, and the shared window that bans and auto-ban counters depend on is gone, with only an error log line per request as the signal. An operator who chose redis_fail_open=False expecting requests to fail closed during an outage got the weaker limit instead.

Affected

All guard-core versions up to and including 3.14.0 with enable_redis=True.

Fixed in 3.15.0

Fixed in guard-core 3.15.0 (PyPI), merged in #83 (75d13343). redis_fail_open=False: the rate limiter raises GuardRedisError; the pipeline applies fail_secure (500 under fail-secure, pass-through otherwise) and fastapi-guard's websocket guard closes 1013. redis_fail_open=True: the in-memory window is used with one warning per process. Labelled Breaking in the 3.15.0 changelog.

Credit

Found by the maintainers while verifying the websocket integration for a downstream project.

Affected versions

References

GitHub · Guard-Core/guard-core