Skip to main content
Menu
Advisories

Banned-IP set-key raised to the caller on Redis failure, un-banning on outage

GHSA-VVV9-CVG5-GPCJPublished Updated GitHub

Description

_ban_exact_ip in guard_core/handlers/ipban_handler.py wrapped redis_handler.set_key so that a Redis failure (which raises GuardRedisError(503) out of RedisManager.safe_operation) propagated out of ban_ip on the exact-IP path, un-banning the IP during an outage and surfacing a 503 to the caller from the ban path. The CIDR path already clamped; the exact-IP path did not.

Impact

During a Redis outage, banning an exact-IP fails open (the IP is not banned) and the outage is leaked to the requester as a 503 from the ban path. Reported by CatamountJack.

Affected

guard-core < 3.13.0.

Patched in 3.13.0

The exact-IP path now mirrors the CIDR path, wrapping set_key in try/except that clamps the duration to LOCAL_CACHE_TTL_CAP_SECONDS (3600) and warns, so a Redis outage degrades to a local-memory ban with a clamped TTL instead of raising and un-banning.

Workaround

Ensure Redis availability for ban enforcement; a local-only ban still applies during outage after the fix.

Affected versions

References

GitHub · Guard-Core/guard-core