feat(PLA-8129): runtime Redis-SET allowlist for the decay backend - #2
Merged
Merged
Conversation
Adds a per-request allowlist check to cache_impl.go, run before any decay counter is touched: an operator SADDs a value to a Redis SET (allowlist:rl_ip / allowlist:rl_ua / allowlist:rl_subject) and it takes effect on the very next request, no deploy, no EnvoyFilter apply. Replaces the compiled-in Lua tables (IP_ALLOWLIST / USER_ID_ALLOWLIST) that made a config change a deploy. Matches ratelimiting.lua's existing, asymmetric exemption rules exactly (ip_rate_limit_with_pooling / user_agent_rate_limit_with_pooling / auth_rate_limit_with_pooling, :204-253): an allowlisted IP exempts rl_ip, rl_ua AND rl_subject together for the whole request; an allowlisted user-agent or user-id exempts only its own bucket; client_id is never exempted by any allowlist. This code has been running live in Depop's dev-default cluster since 2026-08-21 (deployed via a ConfigMap, source-controlled only there) without ever being pushed here, reviewed, or tested. Adds 8 tests covering the asymmetric exemption rules, the client_id exclusion, the no-allowlist baseline, and the Redis-down failure path (must still panic as redis.RedisError, matching the existing decay-pipeline failure convention).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the PLA-8129 runtime allowlist to
cache_impl.go: an operator SADDs avalue to a Redis SET (
allowlist:rl_ip/allowlist:rl_ua/allowlist:rl_subject)and it's exempted from rate limiting on the very next request — no deploy,
no EnvoyFilter apply. Replaces the compiled-in Lua tables that made a config
change a deploy.
Matches
ratelimiting.lua's existing, asymmetric exemption rules(
ip_rate_limit_with_pooling/user_agent_rate_limit_with_pooling/auth_rate_limit_with_pooling, :204-253):rl_ip,rl_uaANDrl_subjecttogether, for the whole requestclient_idis never exempted by any allowlistWhy this PR exists now
This code has been running live in Depop's
dev-defaultcluster since2026-08-21, deployed via a Kubernetes ConfigMap. It was never pushed to this
repo, never opened as a PR, never reviewed, and had zero tests. Confirmed
live via
ratelimit-forkdebug logs on 2026-09-03 as part of proving thePLA-8126 gRPC authorizer → PLA-8128 rate limiter join actually works. This
PR is that catch-up: real code review, on the actual running logic, plus the
test coverage it should have had from the start.
Tests
8 new tests in
test/redis_decay/allowlist_test.go, matching the style ofthe existing
cache_impl_test.gosuite:exemption (IP allowlisting also exempts UA/subject descriptors elsewhere
in the same request)
client_idis never exempted, even when IP is allowlistedno-op for the common case)
implementation
redis.RedisError, same as a decay-pipeline failure — the service layer'sfailure-mode policy must not be bypassed just because the failure
happened in this new phase
All 18 tests in the package pass (10 pre-existing + 8 new):
go build ./...andgo vet ./src/redis_decay/...are both clean.