Skip to content

Commit 91e56a0

Browse files
committed
feat(auth): add per-IP rate limiting to signup, signin, and password reset
1 parent b74f8da commit 91e56a0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

apps/sim/lib/auth/auth.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,19 @@ export const auth = betterAuth({
181181
provider: 'pg',
182182
schema,
183183
}),
184+
rateLimit: {
185+
enabled: true,
186+
customRules: {
187+
'/sign-up/email': { window: 600, max: 3 },
188+
'/sign-in/email': { window: 60, max: 10 },
189+
'/forget-password': { window: 600, max: 3 },
190+
},
191+
},
192+
advanced: {
193+
ipAddress: {
194+
ipAddressHeaders: ['cf-connecting-ip', 'x-forwarded-for'],
195+
},
196+
},
184197
session: {
185198
cookieCache: {
186199
enabled: true,

0 commit comments

Comments
 (0)