Skip to content

[auth] Sign-in rate limit is the provider default and cannot be configured #2634

Closed

Description

@rickylabs

Summary

With the better-auth backend, the sign-in rate limit is better-auth's built-in rule. NetScript has no configuration that reaches it, and the plugin path cannot pass provider options at all.

Evidence (main at b0eb079, same on v0.0.9)

  • plugins/auth/services/src/backend-registry.ts:250-255 builds better-auth with prisma, provider and secret only. betterAuthOptions, which packages/auth-better-auth/src/better-auth.ts would forward, is never passed on the plugin path.
  • AuthConfig in packages/plugin-auth-core/src/config/mod.ts has no rate-limit field.
  • better-auth's built-in rule for /sign-in* is 3 requests per 10 s per IP and path. That rule replaces the global window / max, so only rateLimit.customRules can change it. It is active only in production.

Expected behavior

Auth configuration has a documented rate-limit section that is forwarded to the provider as customRules, so an app can set the sign-in limit. The default is stated in the docs.

Acceptance

  • AuthConfig accepts a rate-limit section, validated by the config schema.
  • The better-auth backend on the plugin path forwards it as rateLimit.customRules, proven by a test that sets a sign-in limit and observes it.
  • With no configuration, behaviour is unchanged and the docs state the effective default.
  • The auth documentation describes the option.

Related: #883, #882.

Acceptance evidence: real-provider and schema validation, defaults, and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions