-
Notifications
You must be signed in to change notification settings - Fork 13k
regression(federation): Old federation users #37102
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
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
90e9504
feat(federation): add username validation and user creation/updating …
ggazzo f124c24
refactor(federation): findOneByUsername for federated user
ggazzo 5c265e4
refactor(federation): simplify user identification and room creation …
ggazzo c7eef81
refactor(federation): enhance user creation logic with structured upd…
ggazzo 80a91b7
refactor(federation): update mui type in IUserNativeFederated interfa…
ggazzo 7b87f00
review
ggazzo bbd0a59
refactor(federation): improve runWithBackoff function
ggazzo 62afcad
refactor(federation): include 'federation' field in room queries for …
ggazzo a0c6a47
refactor(federation): remove deprecated callback for adding users to …
ggazzo d49e4c6
fix: accept internal invites
ggazzo 4243420
refactor(callbacks): remove unused Username type import
ggazzo 630c1cf
refactor(invite): include 'federation' and 'federated' fields in user…
ggazzo 5523a91
Revert "refactor(federation): improve runWithBackoff function"
sampaiodiego 1e9469f
fix invite from synapse
sampaiodiego ebb2acf
fix backoff delay
sampaiodiego fe0e73b
fix(federation): power level
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
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
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
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.
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.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Verify necessity of fetching full user documents.
The selective projection was removed, causing all user fields to be fetched instead of only
_id,name,username,settings, andcustomFields. While the PR context mentions federation fixes, the downstream code (lines 76-79, 135-174) only uses_id,name,username, andcustomFields.Run the following script to check if federation-related fields (e.g.,
federated,isRemote,federatedId) are accessed elsewhere in the call chain:Additionally, please search the web to confirm whether this aligns with Matrix Federation specification requirements for user data:
🏁 Script executed:
Length of output: 2124
🌐 Web query:
💡 Result:
Short answer — what gets shared over federation for direct/1:1 Matrix messages:
If it's a room-based 1:1 DM: room PDUs are sent to participant homeservers. That includes the event envelope (room_id, event type, sender user_id, event_id, origin/origin_server_ts, prev_events/auth_events, content). If E2EE is used the content is encrypted, but metadata (room membership, sender ID, room_id, timestamps, and any unencrypted state) is still shared. [1][2]
If it's a true send-to-device message (e.g., Olm/Device key/one-to-one keying): servers exchange m.direct_to_device EDUs containing sender user_id, event type, message_id and the encrypted payload — delivered to the target device(s) on the remote homeserver. These are not PDUs in a room graph but are federated EDUs. [1][2]
Other federated data related to DMs: profile/profile queries (displayname, avatar_url) are available via federation queries; presence or presence-invite EDUs may be exchanged; media referenced by mxc:// URIs requires homeserver-to-homeserver fetches. Note that redactions remove content but usernames/IDs and replicated copies on remote homeservers can remain. [1][2][3]
Notes: end-to-end encryption protects message content from remote servers only if the client used E2EE; servers still see routing/room/participant metadata. [1][2][3]
Sources: Matrix federation spec (send-to-device / PDUs) and Matrix privacy notice. [1][2][3]
Restore selective projection on Users.findUsersByUsernames
Reinstate
{ projection: { _id: 1, name: 1, username: 1, settings: 1, customFields: 1 } }on line 74 to avoid fetching full user documents when only those fields are used (callbacks and subscription creation here don’t require any additional properties). This also aligns with the explicit projection applied later at lines 153–156.🤖 Prompt for AI Agents