Skip to content

Feat/msc4258 fed user dir - basic version#4

Merged
mcalinghee merged 12 commits into
develop_tchapfrom
feat/msc4258-fed-user-dir
Apr 28, 2026
Merged

Feat/msc4258 fed user dir - basic version#4
mcalinghee merged 12 commits into
develop_tchapfrom
feat/msc4258-fed-user-dir

Conversation

@mcalinghee
Copy link
Copy Markdown

@mcalinghee mcalinghee commented Feb 17, 2026

Description

MSC Federated User Directory :
https://github.com/tchapgouv/matrix-spec-proposals/blob/fed-user-dir/proposals/4258-federated-user-directory.md

  • returns empty result if search_term is less than 3 characters
  • get the first (limit) local results then do a federated search if we do not enough result
  • the result is a concatenation : local + federated results within the limit
  • the federated search is blocked but a timeout is set to 2sec (can be configured with msc4258_federation_search_timeout) and do not backoff the federated server
  • new configuration msc4354_enabled: to enable this feature otherwise it will work as before
  • new configuration msc4258_federation_search_timeout: allow to set the timeout if we need adapt this on servers

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

TODO:

  • add configuration to allow federated user search (msc4258_enabled)
  • add search token
  • perfom test on performance side
  • add search scope
  • make sure CI are passing through
  • rework selection of target homeserver
  • more results on more servers(when too many servers) if user asks for it

MatMaul and others added 4 commits August 25, 2025 14:49
* change release process to produce only python package

* remove macos13 os

* remove aarch64 architecture

* remove tar of debs packages

* add comment

* add release process for tchap

---------

Co-authored-by: Mathieu Velten <matmaul@gmail.com>
- Block federation requests and events authenticated using a known insecure signing key. See [CVE-2026-24044](https://www.cve.org/CVERecord?id=CVE-2026-24044) / [ELEMENTSEC-2025-1670](GHSA-qwcj-h6m8-vp6q). ([\element-hq#19459](element-hq#19459))

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEE7qit+jwB/tnnqkQqItYrhFUnGfwFAmmN9ucACgkQItYrhFUn
# Gfxn0RAAphtPC/LnSaefBHgNNKN0cnFK6N9FvuvKyEkqKYQNNoCaAGW2NzmeFfcX
# lPKCZWaABgCQUTxQWf2ck2VlGe3SwcLTUwcIjnlVs8uYP8JiTek8743Czx8T88M1
# TlotLgnH93nNudXOCXAThYbktrOZZtJM1E7AWJLUfQcUFS30ZbEgCYAmCuJ60OgL
# jn80CKHQJxw9u1Hty1G9yN2j0gLjO4KRkSuQ7jc3ouG2Fx/HQZ8H1/zX/H4niClN
# Y5VAPp0V0VN9KKV1xJXayDQ25ytAqkZvOpBnMIhHmCEFKElio3BlpjnlajsGfIqW
# 6SKwmDczjrdKwbnOFtOFUzqs2LWm9RZOo8mrdDpb4uWiZ8ANnyffajrROzRGCI8d
# 8NeOJKYl9fHZrEtAiZYPBYJNOtmW/+CtxckfOkBKri4i8ryDsXS2iER7LrMc2tyd
# oZVVDLX2l74KLw4NziSxqheQVKFShSWBxuDb2AVk15BhoMZd7YcAP+VFtmf0ZtUD
# XBaGQ+oWA4C2a8WSVHPXezSwt78sKcILH1bL6ZzUUen0k8bavjxW0xb3Db4F00D1
# P/SXHdN18XYdsjYcpC1b1zuUUVLD5wXnVj2fKAWlierokD1Y3Q6G6NREI/L4G350
# asu+ejyQrJn3VKoFtGccfGdvNlp8BKxCvWNXA/cy5042HUuSJiY=
# =/PNG
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Feb 12 16:51:03 2026 CET
# gpg:                using RSA key EEA8ADFA3C01FED9E7AA442A22D62B84552719FC
# gpg: Can't check signature: No public key

# Conflicts:
#	.github/workflows/release-artifacts.yml
#	synapse/app/_base.py
Comment thread synapse/handlers/user_directory.py Outdated
Comment thread synapse/rest/client/user_directory.py Outdated
@mcalinghee mcalinghee marked this pull request as ready for review April 25, 2026 11:59
@mcalinghee mcalinghee changed the title Feat/msc4258 fed user dir Feat/msc4258 fed user dir - basic version Apr 25, 2026
@mcalinghee mcalinghee force-pushed the feat/msc4258-fed-user-dir branch from a93adaf to 394dd7c Compare April 25, 2026 12:22
@mcalinghee mcalinghee force-pushed the feat/msc4258-fed-user-dir branch from 394dd7c to 514738b Compare April 25, 2026 14:09
Comment thread synapse/federation/federation_server.py Outdated
Comment thread synapse/federation/transport/server/federation.py
return 200, local_results

# Return local result if we have reach limit (no need to call federation search)
if len(local_results) > limit:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we need something a bit smarter here, otherwise we will never ask the federation most of the time. Perhaps we should limit the local results to limit/4 or something like that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

we do an conservative approach here : we prefer to prioritize the local results over the federation
If the user does not find a result from local results, he will keep typing to narrow his result and the federation will called and find the correct results

Comment thread synapse/federation/federation_client.py Outdated
Comment thread synapse/federation/federation_client.py Outdated
@mcalinghee mcalinghee merged commit a48e5b6 into develop_tchap Apr 28, 2026
25 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants