Skip to content

feat(system-config): add flow_rate_limits and pin the Android origin form - #68

Merged
Bccorb merged 1 commit into
mainfrom
feat/flow-rate-limits
Sep 13, 2026
Merged

Bccorb merged 1 commit into
mainfrom
feat/flow-rate-limits

Conversation

@Bccorb

@Bccorb Bccorb commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of the mobile track (fells-code/seamless-templates#40). Consumed by a following seamless-auth-api PR that reads these values into its limiters.

  • flow_rate_limits (object, defaulted): windowSeconds (900), otp.perIp (10), otp.perIdentity (5), magicLink.perIp (20), magicLink.perIdentity (5), oauth.perIp (30), oauth.perProvider (10). The defaults are exactly the constants the API has hardcoded in src/middleware/rateLimit.ts today, so a deployment that sets nothing behaves as it did, and a partial value fills the flows it leaves out. The patch schema accepts the key. Exports FlowRateLimitsSchema, FlowRateLimits, DefaultFlowRateLimits.
    • Why: per-IP limits are what a mobile audience trips first. Carriers put thousands of subscribers behind one IPv4 address, so 10 OTP sends per IP per 15 minutes refuses a phone audience at modest scale. Operators need to raise perIp without touching perIdentity.
  • origins gains a comment and a test pinning the Android WebAuthn origin form, android:apk-key-hash:<base64url>. Zod 4's z.url() accepts it as an opaque URL, and native passkeys depend on that; until now nothing said so, and a future tightening to a hostname check would have broken Android silently.

Test plan

  • npm test: 243 passing (new: defaults, partial fill, rejections, Android origin)
  • npm run typecheck, npm run lint, npm run format:check, npm run build

…form

The auth API limits how often one caller may start an OTP, magic link or
OAuth flow with constants fixed in code. Those suit a web audience and refuse
a mobile one, because carriers put thousands of subscribers behind one
address. flow_rate_limits carries the same values as an object key whose
defaults are exactly those constants, so a deployment that sets nothing
behaves as it did and a partial value fills the flows it leaves out.

origins gains a test and a comment for android:apk-key-hash:<base64url>,
which z.url() accepts as an opaque URL and native passkeys depend on.
@Bccorb
Bccorb merged commit c934d8f into main Sep 13, 2026
1 check passed
@Bccorb
Bccorb deleted the feat/flow-rate-limits branch September 13, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant