You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Server: validate rateLimit.windowMs before creating the limiter #452
createChatHandler validates rateLimit.maxRequests but passes rateLimit.windowMs to createRateLimiter without equivalent validation. Zero, negative, NaN, or infinite window values should not be silently accepted.
Expected behavior
Reject a rateLimit.windowMs that is not a finite number greater than zero, with a clear startup error.
Tests
windowMs: 0 and negative values throw.
NaN and Infinity are rejected.
Valid positive finite values and the default remain supported.
Yours, @ashutoshpalhare. One correction to the report: windowMs of 0 or below already throws, from createRateLimiter in packages/core/src/limits/rate-limit.ts:60 (windowMs must be greater than 0). What gets through is NaN and Infinity, because NaN <= 0 is false. The same goes for limit/maxRequests (packages/server/src/handler.ts:83).
So fix it in core: make rate-limit.ts:59-60 check Number.isFinite(x) && x > 0 for both limit and windowMs, and add the cases from your issue to packages/core/tests/limits/rate-limit.test.ts. If you also want the server to say which option is wrong (rateLimit.windowMs rather than windowMs), add that check at handler.ts:83, with a test in packages/server/tests/storage-config.test.ts or handler.test.ts. Patch changesets for @chatcops/core (and @chatcops/server if you touch it).
@ashutoshpalhare it's been five days since my review on #581 without an update, so I'm opening this one up again. That's the usual rule in CONTRIBUTING.md, not a judgment. The code in #581 is right, only the description is missing (Closes #452, "How I tested this" and "AI assistance"). If you're still on it, fill those in and comment here, and we'll sort it out.
Activity
anurag629 commentedon Oct 29, 2026
Yours, @ashutoshpalhare. One correction to the report:
windowMsof 0 or below already throws, fromcreateRateLimiterinpackages/core/src/limits/rate-limit.ts:60(windowMs must be greater than 0). What gets through isNaNandInfinity, becauseNaN <= 0is false. The same goes forlimit/maxRequests(packages/server/src/handler.ts:83).So fix it in core: make
rate-limit.ts:59-60checkNumber.isFinite(x) && x > 0for bothlimitandwindowMs, and add the cases from your issue topackages/core/tests/limits/rate-limit.test.ts. If you also want the server to say which option is wrong (rateLimit.windowMsrather thanwindowMs), add that check athandler.ts:83, with a test inpackages/server/tests/storage-config.test.tsorhandler.test.ts. Patch changesets for@chatcops/core(and@chatcops/serverif you touch it).anurag629 commentedon Nov 11, 2026
@ashutoshpalhare it's been five days since my review on #581 without an update, so I'm opening this one up again. That's the usual rule in CONTRIBUTING.md, not a judgment. The code in #581 is right, only the description is missing (
Closes #452, "How I tested this" and "AI assistance"). If you're still on it, fill those in and comment here, and we'll sort it out.bhushan4work commentedon Nov 11, 2026
as this is open again , I ll take this from here. will raise a pr shortly
fix(server): validate rateLimit.windowMs at startup (#452) (#594)