Skip to content

chore: align REST rate limits with the DDP methods they replaced - #42104

Merged
dionisio-bot[bot] merged 4 commits into
developfrom
chore/equalize-rest-rate-limits
Sep 12, 2026
Merged

dionisio-bot[bot] merged 4 commits into
developfrom
chore/equalize-rest-rate-limits

Conversation

@ricardogarim

@ricardogarim ricardogarim commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Aligns the rate limits of REST endpoints with the DDP methods whose traffic they now carry.

A DDP method keeps its manual rule even when called over HTTP, because method.call/:method applies DDPRateLimiter itself. The rule only goes dormant when the client switches to a dedicated endpoint, and that endpoint then gets the generic REST default: 10 / 60s per IP (API_Enable_Rate_Limiter_Limit_Calls_Default). CORE-2629 was the first case noticed, on chat.sendMessage. This PR fixes four more and documents the ones we looked at and left alone.

↑ more permissive than today, = unchanged.

Endpoint REST today This PR vs today DDP rule replaced
spotlight 10 / 60s (default) 100 / 100s ↑ spotlight — 100 / 100s
directory 10 / 60s (default) 100 / 100s ↑ browseChannels — 100 / 100s
chat.followMessage 10 / 60s (default) 5 / 5s ↑ followMessage — 5 / 5s
chat.unfollowMessage 10 / 60s (default) 5 / 5s ↑ unfollowMessage — 5 / 5s
users.setStatus 5 / 60s 5 / 60s (kept) = setUserStatus — 1 / 1s
users.setAvatar 10 / 60s (default) 10 / 60s (kept) = setAvatarFromService — 1 / 5s
rooms.info 10 / 60s (default) 10 / 60s (kept) = getRoomById — 10 / 60s
im.create / dm.create 10 / 60s (default) 10 / 60s (kept) = createDirectMessage — 10 / 60s
users.forgotPassword 10 / 60s (default) 10 / 60s (kept) = sendForgotPasswordEmail — 10 / 60s

No endpoint ends up stricter than it is today. Why the = rows were left alone:

  • users.setStatus and users.setAvatar: their DDP rules only work per user. On a per-IP bucket an allowance of 1 rejects the second call in the window from anyone behind one address. The 5 / 60s on setStatus is also deliberate (chore: remove rate limiter for functions #38354), and setAvatarFromService never covered uploads or URLs, which the endpoint also carries.
  • rooms.info, im.create / dm.create, users.forgotPassword: the DDP value equals the REST default, so declaring it would only detach the route from API_Enable_Rate_Limiter_Limit_Calls_Default. Deployments behind a shared address rely on that setting for rooms.info, which the client hits on every discussion or omnichannel room open. The send-many-messages bypass was not carried over either; api-bypass-rate-limit covers the same roles.
  • users.resetAvatar (DDP 1 / 60s) and autotranslate.getSupportedLanguages (DDP 5 / 60s): the method is tighter than the REST default, and resetAvatar also serves the moderation console. Lowering limits to match is a separate call.
  • setEmail and setRealName (DDP 1 / 1s each) have no endpoint of their own: the profile form sends everything through users.updateOwnBasicInfo, which stays at 1 / 60s. That endpoint also changes the password, and the limit is brute-force protection from Chore: Convert users endpoints  #25635; matching the methods would loosen it sixty-fold.

Already aligned: chat.sendMessage, users.register, push.test, audit.auditions, audit.messages. sendSMTPTestEmail is still called as a method (admin action button), so its DDP rule still applies. userSetUtcOffset is no longer called at all; the client writes the offset through users.setPreferences.

That accounts for all 21 manual DDP rules in the repo (DDPRateLimiter.addRule and RateLimiter.limitMethod, 20 distinct methods): 4 fixed here, 5 already aligned, 9 documented above as left alone, 1 still on DDP, 1 superseded.

Issue(s)

Steps to test or reproduce

Run without TEST_MODE (env -u TEST_MODE yarn dev) and enable API_Enable_Rate_Limiter_Dev. On develop the eleventh navbar search inside a minute returns 429; here a hundred pass and the hundred-and-first is rejected.

Further comments

We considered keying the limiter by user instead of by address (#41970 added a per: 'user' option for that) and decided to adjust the route values for now and close that PR.

So these buckets are still keyed by IP, shared by everyone behind one address. With a wide window that dilutes well enough; spotlight is the one to watch, since the composer autocomplete calls it per keystroke. If it hurts in practice, per-user keying is the follow-up.

Endpoints that never had a manual DDP rule also lost the 20 / 10s per-user floor and sit on 10 / 60s per IP. That is a much larger set, and a conversation rather than a patch.

@dionisio-bot

dionisio-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8770314

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a76b5e6c-b2c3-4c83-8915-39fed1905a68

📥 Commits

Reviewing files that changed from the base of the PR and between 3fcab23 and 8770314.

📒 Files selected for processing (1)
  • .changeset/tall-pandas-repeat.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/tall-pandas-repeat.md

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Walkthrough

The change adds explicit rate limits to four REST endpoints: chat.followMessage, chat.unfollowMessage, spotlight, and directory. The changeset now documents only these endpoints.

Changes

REST rate limit alignment

Layer / File(s) Summary
Messaging endpoint limits
apps/meteor/server/api/v1/chat.ts
chat.followMessage and chat.unfollowMessage allow 5 requests per 5000 milliseconds.
Discovery endpoint limits and release metadata
apps/meteor/server/api/v1/misc.ts, .changeset/tall-pandas-repeat.md
spotlight and directory allow 100 requests per 100000 milliseconds. The changeset lists these four endpoints.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested labels: type: bug

Merge Risk: ⚪ Minimal · up to 87703

The reviewed rate-limit alignment introduces no substantiated merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: aligning selected REST endpoint rate limits with the replaced DDP methods.

Warning

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.43%. Comparing base (f18f33c) to head (8770314).
⚠️ Report is 7 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #42104      +/-   ##
===========================================
+ Coverage    69.41%   69.43%   +0.02%     
===========================================
  Files         4310     4310              
  Lines       177068   177426     +358     
  Branches     31500    31517      +17     
===========================================
+ Hits        122910   123199     +289     
- Misses       49045    49109      +64     
- Partials      5113     5118       +5     
Flag Coverage Δ
e2e 58.98% <ø> (-0.01%) ⬇️
e2e-api 46.35% <ø> (+<0.01%) ⬆️
unit 70.66% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ricardogarim
ricardogarim force-pushed the chore/equalize-rest-rate-limits branch from 18228a2 to 3fcab23 Compare September 11, 2026 16:41
@ricardogarim ricardogarim added this to the 8.9.0 milestone Sep 11, 2026
@ricardogarim

Copy link
Copy Markdown
Member Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@ricardogarim I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

@ricardogarim
ricardogarim marked this pull request as ready for review September 11, 2026 16:55
@ricardogarim
ricardogarim requested a review from a team as a code owner September 11, 2026 16:55

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

@sampaiodiego sampaiodiego left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please check the ones that were using DDPRateLimiter.addRule as well?

@sampaiodiego

Copy link
Copy Markdown
Member

we may want to increate the default rate limiter values at some point as well, they are currently too restrictive.. 10 requests per minute is far from an abusive limit.

@ricardogarim ricardogarim added the stat: QA assured Means it has been tested and approved by a company insider label Sep 12, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 12, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Sep 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 12, 2026
@ricardogarim ricardogarim removed this from the 8.9.0 milestone Sep 12, 2026
@dionisio-bot dionisio-bot Bot removed the stat: ready to merge PR tested and approved waiting for merge label Sep 12, 2026
@ricardogarim ricardogarim added this to the 8.9.0 milestone Sep 12, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 12, 2026
@dionisio-bot
dionisio-bot Bot added this pull request to the merge queue Sep 12, 2026
Merged via the queue into develop with commit d6956ab Sep 12, 2026
56 checks passed
@dionisio-bot
dionisio-bot Bot deleted the chore/equalize-rest-rate-limits branch September 12, 2026 11:52
This was referenced Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants