Limits
For: an operator who sizes the limits of a deployment, or a developer who reads a rate_limited answer.
What it does: this page lists each limit that core asks the limiter for, and each count that core keeps in a row. A full limit answers 429 rate_limited.
Before you start
Section titled “Before you start”- Read Set up a shared limiter. The default limiter counts per isolate, so these numbers hold only with a shared limiter.
The rate limits
Section titled “The rate limits”A key ends in the address, the IP, or the user id. A request with no client IP uses unknown in place of the IP, unless limits.noClientIp refuses it.
Each row gives the default window. Change a limit tells how a deployment sets another window.
The first two parts of a key are its family, such as magic-link:email. A refusal emits the event limit.hit with the family and no part of the key. Each family of LIMIT_FAMILIES has one row here, and a site check holds the table to the code.
| Key | Window | Maximum | Flow |
|---|---|---|---|
magic-link:ip:<ip> |
15 minutes | 20 | Magic link request |
magic-link:email:<email> |
15 minutes | 5 | Magic link request |
social-start:ip:<ip> |
15 minutes | 30 | Social start and link start, for every provider |
social-link:user:<userId> |
15 minutes | 10 | Link start of a provider, after the start key |
social-callback:ip:<ip> |
15 minutes | 30 | Callback form post of a provider, such as Apple’s, before the read of its form. A post past it reads no byte. CALLBACK_POST_LIMIT |
passkey-options:ip:<ip> |
15 minutes | 30 | Passkey sign-in options and re-authentication options |
passkey-verify:ip:<ip> |
15 minutes | 20 | Passkey sign-in verify and passkey sign-up verify |
passkey-sign-up:ip:<ip> |
1 hour | 10 | Passkey sign-up options, after the name rule and the sign-up rule, before the captcha |
passkey-sign-up:all-day:deployment |
24 hours | passkey.signUp.dailyCap, default 1000 |
Passkey sign-up options, after the per-IP limit and the captcha. It needs a shared limiter |
handoff-start:ip:<ip> |
15 minutes | 30 | Handoff start |
handoff-redeem:ip:<ip> |
15 minutes | 20 | Handoff redeem |
password-sign-up:ip:<ip> |
1 hour | 10 | Password sign-up |
password-sign-up:email:<email> |
1 hour | 5 | Password sign-up |
password:ip:<ip> |
15 minutes | 20 | Password sign-in |
password:email:<email> |
15 minutes | 10 | Password sign-in |
password:user:<userId> |
15 minutes | 10 | Password check of a user with no address, in place of the address key |
password-resend:ip:<ip> |
15 minutes | 20 | Verify mail resend |
password-resend:email:<email> |
15 minutes | 3 | Verify mail resend |
password-verify-code:ip:<ip> |
15 minutes | 30 | Sign-up code verify, before the per-address limit |
password-verify-code:email:<email> |
15 minutes | 10 | Sign-up code verify. With maxAttempts wrong tries per code (5 by default), it bounds the guesses on one address |
password-verify-code:email-day:<email> |
24 hours | 10 | Sign-up code mails, at the sign-up and each resend, before any read. With maxAttempts tries per code, one address gets at most 10 times maxAttempts guesses a day |
password-reset:ip:<ip> |
15 minutes | 20 | Reset request |
password-reset:email:<email> |
15 minutes | 5 | Reset request |
password-reset-post:ip:<ip> |
15 minutes | 20 | Reset form post |
password-change:user:<userId> |
15 minutes | 10 | Password change |
otp:ip:<ip> |
15 minutes | 20 | Email code request, both purposes |
otp:email:<email> |
15 minutes | 3 | Email code request, both purposes, and the re-authentication code |
otp:email-day:<email> |
24 hours | 20 | Email code request, both purposes, and the re-authentication code |
otp-verify:ip:<ip> |
15 minutes | 30 | Email code verify, reset, re-authentication code, and change-of-address code |
otp-verify:email:<email> |
15 minutes | 10 | Email code verify, reset, re-authentication code, and change-of-address code |
phone-otp:ip:<ip> |
15 minutes | 10 | Phone code request and phone add, before the read of the number |
phone-otp:phone:<phone> |
15 minutes | 3 | Phone code request, after the form and region checks |
phone-otp:phone-day:<phone> |
24 hours | 10 | Phone code request, after the form and region checks |
phone-otp:all-day:deployment |
24 hours | phone.dailyCap, default 1000 |
Every SMS of the deployment, each code and each note to a taken number, before the row and the send. It needs a shared limiter. For a phone code request, it counts after the answer |
phone-verify:ip:<ip> |
15 minutes | 30 | Every phone code check |
phone-verify:phone:<phone> |
15 minutes | 10 | Phone sign-in code check |
phone-add:user:<userId> |
15 minutes | 3 | Phone add, after the fresh rule and before the request limits. The note to a taken number counts too |
phone-add:phone:<phone> |
24 hours | 10 | Phone add, over every user, after the form and region checks. The note to a taken number counts too |
anonymous:ip:<ip> |
1 hour | 10 | Anonymous sign-in that makes a user, before the captcha. A live anonymous session answers itself and counts nothing |
anonymous:all-day:deployment |
24 hours | anonymous.dailyCap, default 1000 |
Anonymous sign-in that makes a user, after the per-IP limit and the captcha. It needs a shared limiter |
anonymous-delete:user:<userId> |
1 hour | 5 | Anonymous delete, after the check that the user is anonymous |
totp-code:user:<userId> |
15 minutes | 10 | Every second factor code check: a TOTP code, a backup code, or an email code |
totp-code:user-day:<userId> |
24 hours | 30 | Every second factor code check |
totp-setup:user:<userId> |
15 minutes | 5 | The proof of the TOTP setup, and the password check of each method enable and of the method disable, on one budget |
totp-verify:ip:<ip> |
15 minutes | 30 | Second factor challenge |
second-factor-passkey:ip:<ip> |
15 minutes | 30 | The passkey options of a second factor challenge |
second-factor-email:user:<userId> |
15 minutes | 5 | Second factor email code send |
totp:email-day:<email> |
24 hours | 20 | Second factor email code send |
invite:user:<userId> |
15 minutes | 20 | Invite, per inviting user |
invite:email:<email> |
1 hour | 5 | Invite, per invited address |
invitation-accept:ip:<ip> |
15 minutes | 20 | Invitation accept |
slug-check:user:<userId> |
1 minute | 60 | Organization slug check, create, and rename to a new slug, on one budget, before the slug read |
token-create:user:<userId> |
1 hour | 20 | API token create, and organization token create: one key for both |
token-use:tk:<tokenId> |
The token’s rateLimitSeconds |
The token’s rateLimitMax |
Each call of one API token with a window, after the hash lookup and before the quota spend. The app sets the window in process, or tokens.defaultRateLimit fills it. A change of the window starts a new count |
token-use:to:<tokenId> |
The token’s rateLimitSeconds |
The token’s rateLimitMax |
Each call of one organization token with a window, by the rule of token-use:tk:<tokenId> |
reauth:user:<userId> |
15 minutes | 10 | Re-authentication, right or wrong |
reauth-mail:user:<userId> |
15 minutes | 3 | Re-authentication code mail, before the address keys of every mailed code |
session-revoke:user:<userId> |
15 minutes | 30 | Session revoke, revoke-others, and revoke-all together |
user-update:user:<userId> |
15 minutes | 30 | Profile update |
passkey-rename:user:<userId> |
15 minutes | 30 | Passkey rename, also for an unknown id. A refused name counts no try |
email-change:user:<userId> |
1 hour | 5 | Change of address request |
email-change:email:<email> |
15 minutes | 3 | Change of address request, per new address |
email-change-confirm:ip:<ip> |
15 minutes | 20 | Change of address link confirm |
unlink:user:<userId> |
15 minutes | 10 | Unlink of a provider, also for an unknown id |
user-delete:user:<userId> |
1 hour | 5 | Account delete and the request of its mailed link, also when it answers sole_owner. A stale session counts no try |
user-delete-confirm:ip:<ip> |
15 minutes | 20 | Account delete link confirm. A malformed token counts no try |
token-live:session:<sessionId> |
1 minute | 120 | The live check of a session JWT |
operator:ip:<ip> |
1 hour | 5 | Operator key rotation, right or wrong secret |
operator-secrets:ip:<ip> |
1 hour | 120 | Operator secret status, secret rewrap, and info, one count for the three, right or wrong secret. A rewrap of 100 000 rows at 1000 rows per call needs 100 calls |
operator-users:ip:<ip> |
1 hour | 600 | Every secret call to the user, session, and audit routes, right or wrong secret. OPERATOR_USERS_PER_IP |
operator-users:secret:<name> |
1 hour | 600 | Every call of one operator secret to the user, session, and audit routes, after the secret matches, from any IP. OPERATOR_USERS_PER_SECRET |
operator:user:<userId> |
1 hour | 600 | Every call of a platform operator, after the operator user guard passes. A /sso/register of the compatibility package counts three times, one per core write |
operator-impersonate:user:<userId> |
1 hour | 20 | Impersonation starts of one platform operator |
operator-delete:actor:<kind>:<id> |
1 hour | 100 | Every call of one actor to the operator delete route, before the body and the scope check. The subject is secret:<name> or user:<userId>. A delete cannot be undone, so the count bounds what a leaked credential destroys. OPERATOR_DELETE_PER_ACTOR |
operator-create:actor:<kind>:<id> |
1 hour | 200 | Every call of one actor to the operator create route, before the body and the scope check. The subject is secret:<name> or user:<userId>. Each create can mail the person once, so a leaked credential must not become a mail cannon. OPERATOR_CREATE_PER_ACTOR |
user-invite-confirm:ip:<ip> |
15 minutes | 20 | The confirm POST of an invitation link, before the token check, so a malformed token counts too. INVITE_CONFIRM_PER_IP |
oauth-register:ip:<ip> |
1 hour | 10 | OAuth client registration |
oauth-authorize:ip:<ip> |
15 minutes | 60 | OAuth authorize, and each GET /oauth/device with no session. The count runs before a request is held for the sign-in |
oauth-token:ip:<ip> |
15 minutes | 60 | OAuth token and revoke. A device poll counts here unless it names a known code and the client of that code. A failed client auth of any poll counts here too |
oauth-token-origin:ip:<ip> |
15 minutes | 60 | The origin check of a foreign origin at the token endpoint and its preflight |
oauth-device:ip:<ip> |
15 minutes | 30 | The device authorization request, before the client auth, so a failed auth counts too |
oauth-device-poll:code:<hash> |
The code life | One per interval, plus 10: 130 for the defaults |
Each poll of one known device code by the client of the code, before the client auth. The client is the Basic id, the assertion sub, or the form client_id. A poll under another client id counts on oauth-token:ip. A poll past the limit answers slow_down |
oauth-device-verify:ip:<ip> |
15 minutes | 20 | Each post of the device page from one IP |
oauth-device-verify:session:<sessionId> |
15 minutes | 5 | Each post of the device page from one session: a guessed user code costs one |
oauth-device-verify:code:<hash> |
15 minutes | 10 | Each post of the device page that finds one live user code, by its keyed hash. It bounds how many sessions see the consent of one code |
oauth-introspect:ip:<ip> |
1 minute | 600 | OAuth introspection, before the client auth, so a failed auth counts too |
oauth-introspect:client:<clientId> |
1 minute | 600 | OAuth introspection by one resource server, after its client auth |
oauth-end-session:ip:<ip> |
15 minutes | 60 | OIDC end-session, GET and POST together, before the hint check |
oauth-credentials:client:<clientId> |
1 minute | 120 | The client_credentials grant of one client, after its client auth. oauth-token:ip counts each request first, so a service on one IP gets 60 tokens per 15 minutes. Keep the token until its expires_in ends, and ask for a new one only then |
sso-discover:ip:<ip> |
15 minutes | 30 | SSO discovery, JSON or form |
sso-start:ip:<ip> |
15 minutes | 30 | SSO start of an OIDC or a SAML connection, before the connection read |
sso-acs:ip:<ip> |
15 minutes | 60 | SAML form post to the ACS |
sso-domain-verify:org:<organizationId> |
1 hour | 10 | SSO domain verify, before any resolver |
sso-manage:user:<userId> |
15 minutes | 30 | Each SSO domain, SSO connection, and SCIM token route, before the manager guard |
sso-large-read:user:<userId> |
1 hour | 6 | POST /sso/connections/create and POST /sso/connections/update, at the start of their body read, after sso-manage:user and the manager guard. So one account holds the user half of the body budget at most 6 times 32 s in an hour. A write with a declared length whose read cannot start answers 503 body_busy before this count and sso-manage:user, and counts on neither. A write with no length counts at its start, and can then get that 503 at its first chunk. A read that takes more than 8 s spends the rest of the window. It spends at each end: whole, a 408, a 413 past its cap, a 503 in the middle of the read, and a closed socket. The spend lands in the window in which the read ends. So a read that ends after its window ended fills the next window. The account then starts no large read until the window ends, up to 1 hour from the end of that read. At 1 MiB per second, the largest valid write takes 4.5 s. After a 408, send the write again in the next window, on a faster link. SSO_LARGE_READ_PER_USER |
scim-auth:ip:<ip> |
15 minutes | 60 | Each failed SCIM token check: a missing, wrong, expired, or revoked token. A valid token never counts here |
scim:token:<tokenId> |
10 minutes | 1200 | Each call of one SCIM token, after the token check |
setup-open:ip:<ip> |
1 hour | 60 | Each try to open a setup link, a bad token too |
setup-page:ip:<ip> |
1 hour | 60 | Each load of the confirm page GET /sso/setup. It has its own key, so a reload of the page spends no open |
setup-open:link:<linkId> |
1 hour | 20 | Each open of a live setup link, after the token check |
setup-draft:link:<linkId> |
1 hour | 60 | Each draft write of a setup session: a domain add or verify, the draft connection, and the pending SCIM token. A refused body counts too |
setup-status:ip:<ip> |
1 hour | 600 | Each load of the setup page GET /sso/setup/status, before the cookie check |
setup-test:connection:<connectionId> |
1 hour | 20 | Each test start of one connection, for a setup session and for a manager. A start that the checks refuse does not count |
username:user:<userId> |
1 hour | 5 | Username set, after the fresh rule and the name rules |
username-available:ip:<ip> |
15 minutes | 30 | Username check, before the name rules |
password:username:<username> |
15 minutes | 10 | Password sign-in by username, on the stored form, after the name rules |
password:phone:<phone> |
15 minutes | 10 | Password sign-in by phone, after the E.164 check |
multi-session:ip:<ip> |
15 minutes | 60 | Each multi-session route: the list, the switch, and the sign-out of one session, before the session read |
id-token-nonce:ip:<ip> |
15 minutes | 60 | The nonce of the ID-token route, before the nonce write |
id-token:ip:<ip> |
15 minutes | 30 | The ID-token sign-in, before the nonce spend and the token verify |
For an IPv4 address, <ip> is the address. An IPv4-mapped IPv6 address gives its IPv4 form. Any other IPv6 address gives its /64 prefix, written 2001:db8:1:2::/64. The users of one /64 share each per-IP count. A host that gives one /64 to many tenants makes them share each count. A request with no client IP keys unknown. A value that is not an IP keys text: and the value, for example the answer of a custom clientIp. So no header text gets the key unknown or the key of an address, and each text is a client of its own. Core exports ipKey, so an app’s own limiter can key the same way.
otp:email-day:<email> and totp:email-day:<email> read one cap of 20 per 24 hours: one number, two keys. The keys are apart because an email code request needs no password. A person who knows the address must not use up the mails of the second factor.
password:email, password:username, and password:phone count apart, one key for each kind of identifier. So from many IPs, one account with an address, a username, and a phone takes up to 30 guesses per 15 minutes. This is a known residual. A count per account would close it, but its 429 would tell that a phone and an address name one account. password:ip bounds each IP at 20 guesses.
A phone code request and a phone add send their SMS after the answer. So a refusal of phone-otp:all-day:deployment at a request or an add gives no 429. The answer stays { sent: true }, and core writes one sms.not_sent line with the reason capped. A 429 there would come only on the branch that sends, so its time and status would tell whether a number has an account. Watch the line: it is the only sign that the cap stops codes.
The phone add counts on phone-add:phone, not on the two phone-otp keys of a number. So an add by another account spends no sign-in count of the person who holds the number.
phone-otp:all-day:deployment counts in a fixed window that opens at the first send. The count starts again when the window ends. So up to 2 × dailyCap sends can go out in a short span across the end of a window. The stored key holds the maximum, so a new dailyCap starts a new count.
The per-number phone keys read the number as given. Two E.164 forms can name one handset, such as +4407700900123 and +447700900123. Each form then gets its own count. Core uses no phone library and does not rewrite a number. Give an SMS port that refuses a form that its supplier rewrites.
The stored key of an owned limiter is the key, the seconds, and the maximum, joined by U+001F.
Change a limit
Section titled “Change a limit”limits.windows gives a limit family another window. The key is the family, the first two parts of a key of the table.
Entry of limits.windows |
The window that it sets |
|---|---|
"otp:email": { max: 5 } |
5 code requests for each address in the default 15 minutes |
"password:ip": { max: 10, seconds: 300 } |
10 sign-in tries for each IP in 5 minutes |
maxis the count of calls, a whole number from 1 to 100000.secondsis the length of the window, a whole number from 1 to 86400. Leave it out to keep the default length.- Core refuses a family that it does not know at the start, so a wrong name never changes nothing in silence.
- The stored key holds the window. So a new window starts a new count, and the old count ends with its own window.
GET /operator/infolistslimits.windowsin the config keys, with no value.
Six families take their window from another setting, and limits.windows refuses each one. Change that setting.
| Family | The setting of its window |
|---|---|
token-use:tk, token-use:to |
The rateLimit of the token |
oauth-device-poll:code |
The poll interval of the device code |
phone-otp:all-day |
phone.dailyCap |
anonymous:all-day |
anonymous.dailyCap |
passkey-sign-up:all-day |
passkey.signUp.dailyCap |
A request with no client IP
Section titled “A request with no client IP”clientIp gives null when the request has no client IP. The default clientIp reads cf-connecting-ip, which only Cloudflare sets.
limits.noClientIp: "shared", the default. Each per-IP limit counts the request on the one keyunknown. So one caller with no IP can spend the count of each other caller with no IP.limits.noClientIp: "refuse".handleanswers 403client_ip_missingbefore any route. No limit counts the request, and no key is shared.
Use "refuse" when your proxy always sets the client IP. A request with no IP then did not come through that proxy.
With "refuse", an in-process call of auth.api with ip: null throws at its first per-IP limit. Pass the client IP of the person. For a call with no person, such as a job, pass a fixed text that names the caller. A text that is not an IP keys text: and the text, so it has a count of its own.
A clientIp function that throws still answers 500 internal. Only a null is a request with no client IP.
The device code
Section titled “The device code”A user code of the device grant has 8 letters of a set of 20, about 34.5 bits. With n live codes, one guess passes with p = n / 20^8, about n × 3.9 × 10⁻¹¹.
The device page counts each post on three keys of 15 minutes: the session, the IP, and a found code. The three owned limiters open a window at the first call after the last window ended. So a window that opened just before a code started still takes guesses in the code’s first minutes. One key then gets at most max − 1 + max × ceil(life / 15 minutes) guesses at one code.
| Code life | Per session | Per IP |
|---|---|---|
| 10 minutes, the default | 9 guesses, p ≈ n × 3.5 × 10⁻¹⁰ | 39 guesses, p ≈ n × 1.5 × 10⁻⁹ |
| 30 minutes, the most | 14 guesses, p ≈ n × 5.5 × 10⁻¹⁰ | 59 guesses, p ≈ n × 2.3 × 10⁻⁹ |
The limiter port does not promise this window shape. A custom limiter with windows on the clock allows 10 guesses per session and 40 per IP for a 10-minute code. An attacker with k addresses multiplies the IP bound by k. A limiter that counts per isolate multiplies each bound by the count of isolates.
The counts in rows
Section titled “The counts in rows”These counts live in their rows, so they hold under every limiter.
| Count | Maximum | The answer |
|---|---|---|
| Wrong guesses of one email code | emailOtp.maxAttempts, 5 by default |
too_many_attempts |
| Wrong guesses of one phone code | phone.maxAttempts, 3 by default |
too_many_attempts |
| Wrong codes of one second factor challenge | 5 | too_many_attempts |
| Email code sends of one second factor challenge | 3 | rate_limited |
| API tokens of one user | 50 | token_limit |
| Live sessions of one user | session.maxPerUser, 100 by default |
No refusal. A session create past it ends the oldest session of the user, with the reason capped. An impersonation session does not count. On D1 and SQLite, n creates at once can leave n minus 1 sessions past the cap until the next create. So can the creates of a user with an unverified address on Postgres and MySQL. The creates of a verified user there wait on each other and stay at the cap |
| Calls of one API token with a quota | Its remaining. A due refill sets it to refillAmount |
token_exhausted. One compare-and-set per try. A lost try tries again while another call spent, 20 tries at most, then conflict |
The metadata of one API token |
4096 bytes as JSON, and 14 levels of [ and { in its values, under the nesting limit of a request body |
invalid_body |
| Memberships of one user | organizations.limits.perUser |
organization_limit |
| Members of one organization | organizations.limits.membersPerOrganization |
member_limit |
| Pending invitations of one organization | organizations.limits.pendingInvitationsPerOrganization |
invitation_limit |
The metadata of one organization |
4096 bytes as JSON, and 14 levels of [ and { in its values, under the nesting limit of a request body |
invalid_body |
| Teams of one organization | organizations.limits.teamsPerOrganization |
team_limit |
| Members of one team | organizations.limits.membersPerTeam. A team member add and an accept count |
team_member_limit |
| Stored roles of one organization | organizations.dynamicRoles.maxPerOrganization, 50 by default |
role_limit |
| Live tokens of one organization | 50 | organization_token_limit |
| SSO connections of one organization | sso.limits.connectionsPerOrganization, 10 by default |
connection_limit |
| SSO domains of one organization | sso.limits.domainsPerOrganization, 20 by default |
domain_limit |
| Live SCIM tokens of one organization | 2 | token_limit |
| Members of one SCIM group | 10000 | SCIM 400 invalidValue |
| Members of a group that one SCIM request names | 1000, from the D1 Free budget of 50 queries, on every store | SCIM 400 invalidValue |
| Members of a group that one SCIM request takes away | 1000 | SCIM 400 invalidValue |
| Members whose role one rename or delete of a mapped SCIM group computes | 1000 | SCIM 400 invalidValue |
| Results of one SCIM list page | 100 | The page ends there |
| One request body of any other route | 65536 bytes, 262144 for POST /social/apple/callback, and 8388608 for the two SSO connection writes, by a stream read that stops at the cap. Each cap is the next power of two above the largest valid body of its route contract |
413 body_too_large |
| Nesting of one JSON request body | 16 levels of [ and { |
400 invalid_body |
| Items of one JSON request body | 4096 of [, {, and , outside its strings |
400 invalid_body |
| Pairs of one form request body | 128, one more than its & separators. The OAuth token route has the most fields, 12, and the limit is 8 times the next power of two |
400 invalid_body, the invalid_request of an OAuth form route, or sso_failed at the SAML ACS |
| One SCIM request body | 1 MiB | SCIM 413 |
| Nesting and items of one SCIM request body | 16 levels of [ and {, and 65536 items of [, {, and , outside its strings |
SCIM 400 invalidSyntax |
| The bytes that the body reads of the routes with a cap above 65536 bytes hold at once in one isolate | 16777216, 2 reads of the largest cap, in two halves that do not lend bytes to each other. A read counts the bytes that it holds | 503 body_busy with Retry-After: 1, SCIM 503 |
| The bytes that the body reads above the floor of signed-in users hold at once, in each isolate | 8388608, the user half of the budget. A read counts here after a session check names its user: the SSO connection writes | 503 body_busy with Retry-After: 1 |
| The bytes that every other body read above the floor holds at once, in each isolate | 8388608, the anonymous half of the budget: the SAML ACS, the Apple callback, and SCIM | 503 body_busy with Retry-After: 1, SCIM 503 |
| The bytes that the body reads above the floor of one client hold at once | 4194304, a quarter of the budget, for an IP. A user may hold the cap of its read in the user half. A user runs one large read at a time: a second answers 503 before any byte. A client is its IP before a session and its user after one. A request with no client IP is one client, unknown, with the share of one IP |
503 body_busy with Retry-After: 1, SCIM 503 |
| The wait of a body read above the floor for its next bytes | 10 s | 408 body_timeout, SCIM 408 |
| The time of one whole body read above the floor | The time of its cap at 131072 bytes per second, or at 262144 for a signed-in user, and at least 10 s. That is 32 s for an SSO connection write, 10 s for the others | 408 body_timeout, SCIM 408 |
| One SAML form at the ACS | 1 081 519 bytes | sso_failed |
| One decoded SAML Response | 256 KB, depth 64, 5000 elements | sso_failed |
| The metadata XML of a provider | 100 KB | invalid_body |
The halves of the body budget leave two limits by design. The anonymous half holds the shares of 2 IPs of 4 MiB each. Such a read ends within 10 s, so 2 IPs must send 8 MiB each 10 s to keep the half full. While it is full, the SAML ACS, the Apple callback, and SCIM answer 503 to every client before a session. An IPv6 client keys by its /64 prefix, so a /63 prefix gives 2 keys. On a host with no clientIp, the callers with no header are one such key. One account that stalls an SSO connection write of 8 MiB fills the user half for at most 32 s. Then the SSO connection writes of other users answer 503. An account runs one large read at a time, and starts at most 6 in an hour. So one account can delay the SSO connection writes of others by up to 32 s, 6 times per hour. A write with a declared length that gets that 503 before its read starts counts on no limit of its user. So an admin who sends such a write again after Retry-After loses no write of the hour. A write with no length counts at its start, and can then get the 503 at its first chunk. A write that takes more than 32 s gets 408 body_timeout, so an admin must send it at 256 KiB per second or more. A large read of a user that takes more than 8 s spends the rest of the account’s window of sso-large-read:user. It spends at each end: whole, a 408, a 413 past its cap, a 503 in the middle of the read, and a closed socket. The spend lands in the window in which the read ends. So a read that ends after its window ended fills the next window. The account then starts no large read until the window ends, up to 1 hour from the end of that read. Before the spend of slow reads, 19 accounts at 6 times 32 s, 3648 s, held the user half for the hour. A careful account ends each read within 8 s and spends nothing. If each of its 6 reads ends so, a hold for the hour takes 450 reads, 3600 s / 8 s, from 75 accounts. At 10 password sign-ups per IP per hour, they come from 8 IPs. Each read sends about 8 MiB, so the hour takes about 3600 MiB of upload. But the last read of a window has no start left to spend, so it can run to 32 s. Then one account holds the half for 5 times 8 s and 32 s, 72 s, in a window. So the least for the hour is 50 accounts with 300 reads, from 5 IPs, with about 2400 MiB of upload. An account that manages no organization starts no large read. POST /sso/connections/create and POST /sso/connections/update refuse each of its writes before any byte. The refusal is the 403 of the manager guard, or an earlier one, such as 401, 503, 429, 400, or 404. POST /sso/connections/delete reads its body first, at most 64 KiB, and then runs the manager guard. A read at the floor holds no half of the body budget. So each account of that residual owns an organization and holds a second factor, with a verified address. A verified user creates an organization with one request and enrols TOTP with two, so the counts hold at that cost more per account.
Through the compatibility package, /sso/register and /sso/update-provider run a pre-check of the manager guard before their read. The pre-check reads at most 100 member rows of the caller, the first that the storage gives. A caller who is no platform operator, with no row of the owner rank among them, gets 403 before the read. An owner whose row is past those rows can still write through POST /sso/connections/create and POST /sso/connections/update, because their query names the row.
Off Workers, pass clientIp, as Deploy says. Without it, every request with no cf-connecting-ip header is one client, unknown, with the share of one IP, 4 MiB. So one caller with no header can hold that share, and then every caller with no header gets 503. The clients with an IP key keep the rest of the anonymous half. A caller can also set the header to any key, and so pick its own share.
The lives
Section titled “The lives”| Item | Life |
|---|---|
| Session | session.ttlDays, 30 days by default, with a sliding refresh after session.slidingRefreshDays. With session.absoluteDays, at most that many days after the sign-in |
| Magic link | magicLink.ttlMinutes, 15 minutes by default |
| Email code | emailOtp.ttlMinutes, 10 minutes by default |
| Phone code | phone.ttlMinutes, 5 minutes by default |
| Reset link | password.resetTtlMinutes, 15 minutes by default |
| Social state and binding cookie | 10 minutes |
| Passkey challenge | 5 minutes |
| Handoff code | 2 minutes |
| Second factor challenge | 5 minutes |
| Second factor setup | 15 minutes |
| Invitation | organizations.invitationTtlDays, 7 days by default |
| Session JWT | jwtMint.ttlMinutes, 15 minutes by default |
| OAuth authorization code | oauth.codeTtlMinutes, 5 minutes by default |
| OAuth held request | 10 minutes |
| OAuth refresh token | oauth.refreshTtlDays, 30 days by default |
| OAuth device code and user code | oauth.device.codeTtlMinutes, 10 minutes by default |
| Pending SSO domain | 7 days |
| Recheck of a verified SSO domain | 30 days after its last check. Three failures that span 72 hours lose the domain |
| SSO state of an OIDC start, and SAML request | 10 minutes |
| SCIM token | expiresInDays, 1 to 730, or no end |