fix: Rate limit bypass via HTTP method override and batch method spoofing#10234
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. |
📝 WalkthroughWalkthroughThis PR adds comprehensive rate limiting support for batch requests and method overrides, introduces new ParseServerOptions fields ( Changes
Sequence Diagram(s)sequenceDiagram
Client->>BatchHandler: POST /batch with _method overrides
BatchHandler->>MethodValidator: Check _method override
MethodValidator->>BatchHandler: Store _batchOriginalMethod: 'POST'
BatchHandler->>RateLimiter: Process sub-request with methodsToCheck
RateLimiter->>RateLimiter: Build set with request.method + _batchOriginalMethod
alt Array-based requestMethods
RateLimiter->>RateLimiter: Check some(methodsToCheck) against requestMethods
else RegExp-based requestMethods
RateLimiter->>RateLimiter: Test each method in methodsToCheck
end
RateLimiter-->>BatchHandler: Rate limit status
alt Limit Reached
BatchHandler-->>Client: 429 error
else Allowed
BatchHandler-->>Client: Process sub-request
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10234 +/- ##
=======================================
Coverage 92.60% 92.60%
=======================================
Files 192 192
Lines 16347 16351 +4
Branches 201 201
=======================================
+ Hits 15138 15142 +4
Misses 1192 1192
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/middlewares.js`:
- Around line 485-488: The rate-limit matching logic currently checks only
req.method and ignores req.originalMethod set by the method-override block, so
POST requests with a _method override can bypass POST-scoped limits; update the
method comparison in the rate-limit matcher (the code that determines whether a
rule applies by HTTP method) to consider the original method as well by using
something like const effectiveMethod = req.originalMethod || req.method and
matching against effectiveMethod (or explicitly checking both req.method and
req.originalMethod) wherever methods are compared in the rate-limit middleware.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8c48d3b8-b860-4cdf-bcf1-834f63b7ff09
📒 Files selected for processing (7)
spec/RateLimit.spec.jssrc/Options/Definitions.jssrc/Options/docs.jssrc/Options/index.jssrc/batch.jssrc/cloud-code/Parse.Cloud.jssrc/middlewares.js
|
Re: CodeRabbit suggestion to add This was intentionally not included. The Parse JS SDK sends all non-POST requests as The bypass is addressed by:
|
|
@coderabbitai resolve |
✅ Actions performedComments resolved and changes approved. |
# [9.6.0-alpha.36](9.6.0-alpha.35...9.6.0-alpha.36) (2026-03-18) ### Bug Fixes * Rate limit bypass via HTTP method override and batch method spoofing ([#10234](#10234)) ([7d72d26](7d72d26))
|
🎉 This change has been released in version 9.6.0-alpha.36 |
Issue
Rate limit bypass via HTTP method override and batch method spoofing (GHSA-vpvj-hfh8-388m)
Tasks