Skip to content

fix: enable auth rate limiting by default#16963

Closed
StressTestor wants to merge 2 commits intoopenclaw:mainfrom
StressTestor:fix/16876-auth-rate-limit-default
Closed

fix: enable auth rate limiting by default#16963
StressTestor wants to merge 2 commits intoopenclaw:mainfrom
StressTestor:fix/16876-auth-rate-limit-default

Conversation

@StressTestor
Copy link
Copy Markdown

@StressTestor StressTestor commented Feb 15, 2026

Summary

  • Auth rate limiter was only created when explicitly configured, leaving the gateway unprotected by default
  • Changed to always create a rate limiter with sensible defaults unless explicitly set to enabled: false
  • Added enabled boolean to GatewayAuthRateLimitConfig type for explicit opt-out
  • Added tests for default and empty config scenarios

Fixes #16876

Test plan

  • Test rate limiter created with no config (default protection)
  • Test rate limiter created with empty config object
  • Existing rate limiter tests still pass
  • Full test suite passes (pnpm test:fast, pnpm check)

Greptile Summary

This PR fixes a security gap (#16876) where the gateway auth rate limiter was only created when gateway.auth.rateLimit was explicitly configured, leaving gateways unprotected by default against brute-force auth attempts.

  • src/gateway/server.impl.ts: Inverts the rate limiter creation logic from opt-in to opt-out. The limiter is now always created with sensible defaults (10 attempts, 60s window, 5min lockout) unless rateLimit.enabled is explicitly set to false. Passing undefined config to createAuthRateLimiter() correctly triggers all default values.
  • src/config/types.gateway.ts: Adds enabled?: boolean to GatewayAuthRateLimitConfig for explicit opt-out.
  • src/gateway/auth-rate-limit.test.ts: Adds two regression tests covering no-config and empty-config scenarios.

The change is minimal and well-targeted. All downstream consumers already handle rateLimiter as optional (AuthRateLimiter | undefined), so the behavioral change is safe.

Confidence Score: 5/5

  • This PR is safe to merge — it closes a security gap with minimal, well-tested changes.
  • The change is a 3-file, 27-line addition that flips rate limiter creation from opt-in to opt-out. The logic is straightforward (=== false check), the createAuthRateLimiter function already handles undefined config with sensible defaults, all downstream consumers handle the limiter as optional, and regression tests cover the key scenarios. No risk of breakage for existing configurations.
  • No files require special attention.

Last reviewed commit: 92a9a99

@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Feb 22, 2026
The rate limiter was only created when gateway.auth.rateLimit was
explicitly configured, leaving auth endpoints unprotected by default.

Now the limiter is always created with sensible defaults (10 attempts,
60s window, 5min lockout). Set rateLimit.enabled: false to opt out.

Add enabled field to GatewayAuthRateLimitConfig and regression tests.
@StressTestor StressTestor force-pushed the fix/16876-auth-rate-limit-default branch 2 times, most recently from 36f1198 to 19b64f3 Compare March 2, 2026 16:28
@StressTestor StressTestor force-pushed the fix/16876-auth-rate-limit-default branch from 19b64f3 to 2dcca5d Compare March 2, 2026 16:34
@StressTestor StressTestor closed this by deleting the head repository Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Authentication Rate Limiting is Opt-In Only - Disabled by Default

2 participants