Repository navigation
fix(auth): sweep the in-process challenge store, and take redis 8 and cryptography 50 - #4
Merged
Merged
Conversation
… cryptography 50 Nothing expires a key in a dict. LocMemChallengeStore dropped a lapsed record only when something looked that same key up again, and the two kinds that accumulate are never looked up twice: a code requested and never used, and a rate-limit counter -- one per address, per destination, per account tried. Both were held for the life of the process, so an anonymous caller could grow a worker's memory by asking for codes. The write paths sweep what has expired first; the Redis store was always fine, because Redis expires its own keys. `cryptography<51` and `redis<9`, here and in the generated project. redis 8's own type hints make two `cast(int, ...)` around `hincrby` redundant and refuse a `dict[str, str]` as `hset(mapping=)`, Mapping being invariant in its key.
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
LocMemChallengeStore. Nothing expires a key in a dict, and the storedropped a lapsed record only when something looked that same key up again -- which the two
kinds that accumulate never are: a code requested and never used, and a rate-limit counter,
one per address, per destination and per account tried. Both were held for the life of the
process, so an anonymous caller could grow a worker's memory by asking for login codes. The
two write paths sweep what has expired first. The Redis store was always fine.
cryptography<51andredis<9, here and in the generatedproject. redis 8's own type hints make two
cast(int, ...)aroundhincrbyredundant andrefuse a
dict[str, str]ashset(mapping=), Mapping being invariant in its key.Checks
make checkclean: ruff, ruff format, mypy (1213 files),manage.py check,makemigrations --check,protos --check, every optional app enabled.pytest --cov: 3162 passed, 2 skipped, 95.10% coverage. One regression test added for thesweep.
Dependencies were upgraded to current releases locally (Django 6.1.2, cryptography 50.0.2,
redis 8.1.0, strawberry-graphql-django 0.93, grpcio 1.84, mypy 2.4, ruff 0.17, pytest 9.1) and
only those two caps needed widening.
🤖 Generated with Claude Code