fix(hub): bind email budget reserve to a bounded resend chain
The global reserve is claimed atomically with the budget check by deleting a live attempt for the same address (under 5 failures, under 3 resends, chain under 30 minutes), so it cannot fund mail to other addresses, branch or race.
This commit is contained in:
parent
6ea14d0ec2
commit
fea876654b
5 changed files with 196 additions and 33 deletions
5
hub/migrations/0004_email_resend_chain.sql
Normal file
5
hub/migrations/0004_email_resend_chain.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
-- Resends from a browser with a live attempt may draw on a reserved global budget, but
|
||||
-- only along a bounded chain: each attempt records how many resends led to it and when
|
||||
-- the chain began.
|
||||
ALTER TABLE email_attempts ADD COLUMN resends INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE email_attempts ADD COLUMN chain_started INTEGER NOT NULL DEFAULT 0;
|
||||
Loading…
Add table
Add a link
Reference in a new issue