OTP send hardening: layered rate limits (per-address cap, per-IP) #21
Reference in New Issue
Block a user
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?
Context
The OTP email-send surface (SD-0001 §5.2 / §6.6) currently has exactly one anti-abuse
control: the per-address 60s resend cooldown (INV-3). That stops accidental double-sends
but nothing else — it still allows ~1,440 emails/day to one victim address (mail bombing)
and unlimited spraying across many addresses from one client.
Wanted: layered controls (industry-standard stack)
backoff; protects a victim inbox from sustained bombing.
many addresses. Likely middleware/edge enforcement, not domain-layer.
the happy path; passwordless signup lives on first-attempt friction.
Keep the anti-enumeration property (§6.6 uniform responses) intact, and keep the honest
retry property (INV-9: failed delivery doesn't burn the cooldown).
Notes
on honest UX copy for capped users — small but real surface, deserves its own plan.
hardening half.
Source
backend/app/domains/accounts/service.py::request_code