PhoenixKit 2.22.19: Sign-in emails limited per IP and per site
PhoenixKit 2.22.19 closes a way to make a site send large amounts of email. The magic link, password reset and confirmation resend forms were limited per email address only, so a request for each of thousands of different addresses went through and each one sent an email.
Each of the three forms now has three limits:
- per address, as before: 3 requests in 5 minutes;
- per IP address: 10 requests in 5 minutes;
- per site: 300 requests in an hour, from anyone.
The site-wide limit only counts requests the other two let through, so someone hammering one address cannot use up everyone else’s allowance. When it is reached, an error naming the setting appears in the log. All limits can be changed under config :phoenix_kit, PhoenixKit.Users.RateLimiter, and the site-wide limit can be turned off with nil.
Upgrading
If you plan to ask many users to reset their passwords at once, raise the site-wide limit first.
Full release notes: PhoenixKit 2.22.19
2.22.19 · 11 September 2026
Security
-
The three endpoints that send mail to anyone who asks are no longer throttled per address alone. Magic link, password reset and confirmation resend each counted hits per email address, while login and registration already counted per IP too. An address bucket cannot see a spray: ten thousand addresses take one hit each, no bucket ever fires, and the install sends ten thousand emails — mailbox flooding for the people named, and sender-reputation and mailer-quota damage for the operator. Each endpoint now has three buckets:
- per address (unchanged, 3 per 5 minutes) — stops one person being hammered;
- per IP (new, 10 per 5 minutes) — stops a spray from one host;
- per install (new, 300 per hour) — the total the site will send at all, whoever asks and from wherever. A botnet with a fresh address and a fresh IP per request walks through the first two; only this bounds the mail bill.
The site-wide cap is charged last, by requests the narrower two already allowed. Charged first, an attacker hammering a single address — refused, and sending nothing — would drain the allowance for everybody else, which is the one way a site-wide limit becomes an attack in itself. It trips loudly (a logged error naming the setting to raise), and is meant as a circuit breaker: raise it before anything that sends a crowd to the forgot-password form at once, such as a forced credential rotation.
nilswitches it off. All of it is tunable underconfig :phoenix_kit, PhoenixKit.Users.RateLimiter.Public pages capture the visitor’s address during mount, which is the only point a LiveView can read connect info — captured anywhere else the bucket silently keys on nothing.
PhoenixKit 2.22.19. Install or update: {:phoenix_kit, "~> 2.22"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.