-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: configurable email and sms rate limiting (#1800)
Adds two new configuration values for rate limiting the sending of emails and sms messages: - GOTRUE_RATE_LIMIT_EMAIL_SENT - GOTRUE_RATE_LIMIT_SMS_SENT It is implemented with a simple rate limiter that resets a counter at a regular interval. The first intervals start time is set when the counter is initialized. It will be reset when the server is restarted, but preserved when the config is reloaded. Syntax examples: ``` 1.5 # Allow 1.5 events over 1 hour (legacy format) 100 # Allow 100 events over 1 hour (1h is default) 100/1h # Allow 100 events over 1 hour (explicit duration) 100/24h # Allow 100 events over 24 hours 100/72h # Allow 100 events over 72 hours (use hours for days) 10/30m # Allow 10 events over 30 minutes 3/10s # Allow 3 events over 10 seconds ``` Syntax in ABNF to express the format as value: ``` value = count / rate count = 1*DIGIT ["." 1*DIGIT] rate = 1*DIGIT "/" ival ival = ival-sec / ival-min / ival-hr ival-sec = 1*DIGIT "s" ival-min = 1*DIGIT "s" ival-hr = 1*DIGIT "h" ``` This change was a continuation of #1746 adapted to support the recent preservation of rate limiters across server reloads. --------- Co-authored-by: Chris Stockton <chris.stockton@supabase.io> Co-authored-by: Stojan Dimitrovski <sdimitrovski@gmail.com>
- Loading branch information
1 parent
8cc2f0e
commit 5e94047
Showing
12 changed files
with
292 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.