-
Notifications
You must be signed in to change notification settings - Fork 13.7k
chore: undo loadMissedMessages deprecation from #40711 #40981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+8
−29
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0aa7cf5
feat(chat): add room-type-agnostic chat.history endpoint
ggazzo daa2272
refactor(client): load missed messages via chat.history REST endpoint
ggazzo 992cb21
revert(client): keep chat.syncMessages for reconnect catch-up
ggazzo 3e3dcf5
refactor(client): load missed messages via chat.history, paginated
ggazzo ef097a5
revert: undo chat.history endpoint, restore loadMissedMessages method
ggazzo cacda99
chore: drop changeset for revert
ggazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server-side Meteor method
loadMissedMessagesfetches missed messages in a room after a given timestampstartwithout enforcing any limit or pagination. It callsMessages.findVisibleByRoomIdAfterTimestampand converts the resulting cursor directly to an array via.toArray().If an attacker (or any authorized user of a room) calls this method with a very old timestamp (e.g.,
new Date(0)) in a room/channel containing a large history of messages, the server will query and load all of those messages into memory at once before serializing and sending them to the client. This can lead to severe resource exhaustion, high CPU usage, and potentially an Out Of Memory (OOM) crash of the Node.js server process, resulting in a Denial of Service (DoS) for all users of the platform.Steps to Reproduce
An attacker can execute the following DDP method call over WebSockets for any room they have access to (e.g., a large public channel like
#general):If the channel has hundreds of thousands of messages, this triggers a massive database fetch and memory allocation, leading to server instability or crash.
Trace
graph TD subgraph SG0 ["apps/meteor/app/authorization/server/functions/canAccessRoom.ts"] ._Rocket.Chat_apps_meteor_app_authorization_server_functions_canAccessRoom.ts["Exports authorization functions and room access attributes for room access control."] end style SG0 fill:#2a2a2a,stroke:#444,color:#aaa subgraph SG1 ["apps/meteor/client/meteor/overrides/userAndUsers.ts"] Meteor.userId["Overrides Meteor.userId to return the reactive userId from the local store."] end style SG1 fill:#2a2a2a,stroke:#444,color:#aaa subgraph SG2 ["apps/meteor/client/meteor/user.ts"] watchUserId["Watches the userId store and returns the reactive current user ID."] end style SG2 fill:#2a2a2a,stroke:#444,color:#aaa subgraph SG3 ["apps/meteor/client/meteor/watch.ts"] watch["watch"] end style SG3 fill:#2a2a2a,stroke:#444,color:#aaa subgraph SG4 ["apps/meteor/server/methods/loadMissedMessages.ts"] loadMissedMessages{{"Server-side Meteor method to fetch missed messages for a room after a timestamp."}} end style SG4 fill:#2a2a2a,stroke:#444,color:#aaa loadMissedMessages --> Meteor.userId loadMissedMessages --> ._Rocket.Chat_apps_meteor_app_authorization_server_functions_canAccessRoom.ts Meteor.userId --> watchUserId watchUserId --> watchFix with AI
Triage: Reply
!fp <reason>(false positive),!valid(confirmed), or!accepted_risk <reason>. Any other reply is saved as a triage note.Reason is optional but improves future scans — e.g.
!fp internal endpoint, not user-facing.View finding in Hacktron