remote_billing: Add rate-limiting for confirmation email sending.

These should be rate-limited by both IP using our regular
sends_email_by_ip bucket as well as by server, using a new bucket
dedicated to this.
This commit is contained in:
Mateusz Mandera
2024-01-17 23:47:15 +01:00
committed by Tim Abbott
parent 07c4291749
commit 649b4885e8
5 changed files with 193 additions and 0 deletions

View File

@@ -291,6 +291,12 @@ DEFAULT_RATE_LIMITING_RULES = {
# 1000 per day per file
(86400, 1000),
],
# A zilencer-only limit that applies to requests to the
# remote billing system that trigger the sending of an email.
"sends_email_by_remote_server": [
# 10 emails per day
(86400, 10),
],
}
# Rate limiting defaults can be individually overridden by adding
# entries in this object, which is merged with

View File

@@ -256,6 +256,7 @@ RATE_LIMITING_RULES: Dict[str, List[Tuple[int, int]]] = {
"sends_email_by_ip": [],
"email_change_by_user": [],
"password_reset_form_by_email": [],
"sends_email_by_remote_server": [],
}
CLOUD_FREE_TRIAL_DAYS: Optional[int] = None