Skip to content

Commit

Permalink
add very short rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Feb 11, 2024
1 parent 9761d75 commit 98dbb14
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/pds/src/api/com/atproto/server/createAccount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert'
import express from 'express'
import { MINUTE, check } from '@atproto/common'
import { MINUTE, SECOND, check } from '@atproto/common'
import { randomStr } from '@atproto/crypto'
import { AtprotoData, ensureAtpDocument } from '@atproto/identity'
import { XRPCError } from '@atproto/xrpc'
Expand All @@ -26,10 +26,16 @@ import { normalizePhoneNumber } from '../../../../phone-verification/util'

export default function (server: Server, ctx: AppContext) {
server.com.atproto.server.createAccount({
rateLimit: {
durationMs: 5 * MINUTE,
points: 100,
},
rateLimit: [
{
durationMs: 5 * MINUTE,
points: 100,
},
{
durationMs: 5 * SECOND,
points: 2,
},
],
handler: async ({ input, req }) => {
const hasAvailability = await ctx.signupLimiter.hasAvailability()
// temporary hack: don't queue android users (user-agent `okhttp/*`) since the latest version of app isn't rolled out on that platform yet
Expand Down

0 comments on commit 98dbb14

Please sign in to comment.