Sign-in rate limits are counted per worker, in memory, and reset on every restart #59
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Postulo/postulo#59
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
allauth's rate limits are on, with sensible values:
They are counted in Django's cache. Postulo sets no
CACHESat all, so Django falls backto
LocMemCache— a dictionary inside one process. The production image runsso there are three independent counters, and which one a request lands on is up to the
load balancer. Ten failed attempts a minute becomes about thirty. Every restart, deploy or
worker recycle empties them.
Verified by reading the settings back from a running configuration: the cache is
django.core.cache.backends.locmem.LocMemCache, and the worker count is indocker/Dockerfile.Why it matters
This is the control standing between somebody's job search — employment history, home
address, every application they have made — and an unlimited password guessing rate. The
limits are configured correctly and then not enforced as configured, which is worse than
either having them or not, because the numbers written down are not the numbers in force.
Shape
POSTULO_CACHE_URL, so an operator with Redisor Memcached points at it and the counters become instance-wide.
Redis and always has a database.
django.core.cache.backends.db.DatabaseCacheplus thetable its
createcachetablemakes, created by a migration so nobody has to run acommand.
cache share a counter.
While in here: the limits themselves deserve a look.
login: 30/m/ipis per address, andseveral people behind one address share it.
Classification
Bug, security. Not breaking — a cache table is added, nothing changes shape.