fix: privacy leak in getRoomInfo and UI crash safety#1128
Open
deepak0x wants to merge 2 commits intoRocketChat:developfrom
Open
fix: privacy leak in getRoomInfo and UI crash safety#1128deepak0x wants to merge 2 commits intoRocketChat:developfrom
deepak0x wants to merge 2 commits intoRocketChat:developfrom
Conversation
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.
This PR fixes a critical privacy issue in
EmbeddedChatApi.getRoomInfo()and improves UI stability when room information cannot be fetched.Closes #1127
Problem
1. Privacy Leak in
getRoomInfoPreviously,
getRoomInfo()called the Meteor methodrooms/getwith empty parameters. By default, this method returns all rooms (public channels, private groups, and DMs) that the authenticated user is a member of.As a result, the Embedded Chat API exposed room data outside the scope of the configured embedded room (
this.rid), violating the principle of least privilege and leaking private user data to the embedding context.2. UI Crash on Failed Room Fetch
When room information could not be retrieved (for example due to a network error or archived room access),
getRoomInfo()returnednull. This causedChatHeaderto crash when attempting to access properties on the missing data, resulting in a white screen.Solution
Privacy Fix
getRoomInfo()inEmbeddedChatApi.tsto use therooms.infoREST endpoint.this.rid), ensuring only the current room’s data is returned.Error Handling
getRoomInfo()to return a safe fallback object ({ result: [] }) when the request fails or no room is found.UI Safety
ChatHeader.jsto safely handle empty or missing room data using a defensive fallback (roomData || {}), preventing runtime crashes.Changes
packages/api/src/EmbeddedChatApi.ts
rooms/gettorooms.infopackages/react/src/views/ChatHeader/ChatHeader.js