fix: enable auth rate limiting by default#16963
Closed
StressTestor wants to merge 2 commits intoopenclaw:mainfrom
Closed
fix: enable auth rate limiting by default#16963StressTestor wants to merge 2 commits intoopenclaw:mainfrom
StressTestor wants to merge 2 commits intoopenclaw:mainfrom
Conversation
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
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.
36f1198 to
19b64f3
Compare
19b64f3 to
2dcca5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enabled: falseenabledboolean toGatewayAuthRateLimitConfigtype for explicit opt-outFixes #16876
Test plan
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.rateLimitwas 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) unlessrateLimit.enabledis explicitly set tofalse. Passingundefinedconfig tocreateAuthRateLimiter()correctly triggers all default values.src/config/types.gateway.ts: Addsenabled?: booleantoGatewayAuthRateLimitConfigfor 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
rateLimiteras optional (AuthRateLimiter | undefined), so the behavioral change is safe.Confidence Score: 5/5
=== falsecheck), thecreateAuthRateLimiterfunction already handlesundefinedconfig 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.Last reviewed commit: 92a9a99