Why restrict Matrix user directory and profile lookups
This page covers two ways a self-hosted Synapse homeserver can reveal its users: the user directory search and the profile lookups that return a user's display name and avatar. It also covers the settings that control how far those surfaces reach. The typical situation is an organization that wants colleagues to find each other inside the server, but does not want outsiders or remote servers to enumerate its staff. Synapse's defaults decide how much is visible before anyone changes anything, so the first task is to confirm what a stranger can see today. Check the current defaults for the directory and profile options in the Synapse configuration manual for your release, rather than assuming them from older guides.
Tighten these surfaces when the server is open to public registration, federates with many unknown domains, or hosts users whose membership is sensitive, such as clinicians, public servants or staff in regulated roles. A directory that returns anyone who shares a public room with a searcher can turn a single room into a roster. Tightening has costs. Users will no longer find each other by typing a partial name, so they will need to start conversations from a full Matrix ID or from a shared room. Bridges, bots and service accounts that depend on directory search may stop working, so test them before the change reaches production. Decide first who genuinely needs to be discoverable, and by which route, because that answer determines which setting you turn off.
Treat the change as a documented access decision. List every surface that answers queries, then test each one from an unauthenticated client and from a server on another domain, and record what each returns before and after the change. If you run Matrix Authentication Service, confirm which requests still reach Synapse and which are handled by the authentication layer, since that split affects where a control must be applied. Tell users what will change, including how to start a direct message with a colleague they cannot find. Keep the test results with your configuration in version control so an upgrade does not quietly restore a broader default.
How a profile or directory request reaches your homeserver
A request starts from one of three places: a local user searching the directory, a remote server asking for a profile over federation, or an unauthenticated client calling the public API. Each path passes the homeserver, which is the trust boundary where settings decide the answer. Check the user directory search scope, the profile visibility controls, and the federation whitelist, then confirm each path against your own server with test accounts. This flow is simplified and illustrative.
Simplified illustrative flow of three lookup paths through the homeserver boundary.
Directory and profile settings and when each fits
This table compares the Synapse settings that decide who can find your users and read their profiles, and what each one costs in discoverability. Confirm every option name and default against the Synapse configuration manual for your version before you change anything. The main takeaway is that directory search and profile lookups are controlled separately, so tighten both if strangers and remote servers should learn nothing about your users.
| Setting | What it controls | Discoverability versus privacy | When it fits |
|---|---|---|---|
| user_directory.enabled | Turns local user directory search on or off for client searches. | Off removes search, so users must know exact IDs to start a conversation. | Closed servers where people are invited by full ID. |
| user_directory.search_all_users | Lets a search return local users who share no room with the searcher. | Widest discoverability. Any account can find local users by partial name. | Open community servers with public sign-up. Avoid on private deployments. |
| Default room-based search scope | Search returns users who share a room with the searcher or appear in a public room. | Balanced. Visibility follows room membership, so private rooms limit exposure. | Most organizations. Confirm how remote users appear in the manual. |
| user_directory.exclude_remote_users | Keeps federated users out of directory search results. | Less exposure of contacts on other servers, but cross-server discovery suffers. | Restricted federation or where federated user lists are sensitive. |
| limit_profile_requests_to_users_who_share_rooms | Limits profile lookups to users who share a room with the requester. | Stops strangers reading display names and avatars, but can slow first contact. | Private or enterprise servers that keep federation enabled. |
| require_auth_for_profile_requests | Requires an authenticated session for profile requests made through the client API. | Blocks anonymous profile scraping. Confirm whether federated lookups are affected. | Servers that never need public profile reading. |
| include_profile_data_on_invite | Sends the inviter's profile data along with room invites. | Helps invitees recognize the sender, but shares profile data before they accept. | Servers where display names are sensitive before acceptance. |
| Profile field restrictions | Would limit which profile fields, such as display name or avatar, are exposed. | No field-level switch is confirmed here. Check the manual before planning one. | Use policy and client guidance until a supported option is confirmed. |
Setting up tighter profile and directory controls
This sequence narrows what strangers and federated servers can learn about your users through profile requests and directory search. It produces a documented baseline, a discoverability policy that stakeholders agreed to, and a tested configuration change that you can roll out without surprising the people it affects.
Record current profile and directory behavior
Create a local test account and a second test account, then run queries from a machine on a separate network so you see what outsiders see. Request the profile of each account, search the user directory for both, and note which fields appear and whether a federated server can resolve them. Record the results in a dated table. Done when you have a baseline you can compare against after the change.
Agree the discoverability policy with stakeholders
Bring security, privacy, compliance and community or support leads together to decide who should be able to find whom. Typical questions include whether anyone on the internet may search the directory, whether users on other servers may see profile fields, and whether display names or avatars must be visible before someone joins a shared room. Write the decisions in a short policy with a named owner. Done when every setting you plan to change has a documented decision and reason.
Map each decision to a Synapse setting
Using the configuration manual for your installed version, find the keys that control profile requests and the user directory. Check whether profile requests require authentication, whether they are limited to users who share a room, and whether directory search covers all users or only users in shared or public rooms. Confirm the default and exact behavior of each key in that version. Done when each policy decision maps to one key and one stated value.
Apply and check the change in staging
Edit the homeserver configuration on a staging server that matches production in server name, Synapse version and database engine. Keep a copy of the current file so you can revert. Before restarting or reloading, read the upgrade notes for your version, since restart and configuration handling can differ between releases. Done when the staging file differs from production only in the agreed keys and Synapse starts without configuration errors in its logs.
Restart and verify with local and federated accounts
Restart Synapse, including every worker process if you run workers, and confirm each process came up cleanly. Repeat the tests from the baseline using a local account and a federated account on another server. Confirm that profile fields and directory results match the policy and that existing shared-room conversations still work. Done when both test accounts show the expected results and the logs show no new errors.
Roll out to production and tell users
Apply the verified file to production during a maintenance window you have announced, using the same restart steps you confirmed in staging. Repeat the external tests and compare the results with the baseline. Then notify users what they will no longer see or be found by, and where to send questions. Done when production matches staging, the change is recorded in your change log, and the announcement has reached the affected users.
Choosing a discoverability policy by audience
A server that only staff can reach has little reason to answer strangers. Close every surface that serves people outside the company, and keep local search so colleagues can find each other. Federation is usually off, which removes most remote lookup paths before any profile or directory setting applies.
- Federation: Set
federation_domain_whitelistto an empty list so the server neither sends nor accepts federation traffic, and firewall the federation listener as a second control. - User directory: Keep the directory enabled for local users, and set
user_directory.search_all_usersto false so search returns only users who share a room with the searcher or appear in a public room. - Profile requests: Set
require_auth_for_profile_requeststo true so unauthenticated callers cannot read display names or avatars. - Public room listing: Keep
allow_public_rooms_without_authandallow_public_rooms_over_federationoff, since no outside party needs the room list.
Test from a machine on the public internet and from an account on another server, and confirm that neither can see staff names. Confirm each key name and default against the configuration manual for your Synapse version before you rely on it.
A public-facing server wants people to find rooms and each other, but every open lookup is also a scraping surface. Decide which surfaces serve discovery and close the rest. The public room list and user search are the two lookups most often confused, and they should be set separately.
- Public rooms: Enable
allow_public_rooms_without_authonly if the room list is meant to be read from the open web. Treatallow_public_rooms_over_federationas a separate decision for each community. - User search: Leave
user_directory.search_all_usersfalse unless you want every local user listed. Enabling it makes bulk enumeration of accounts easy. - Profile data: Use
limit_profile_requests_to_users_who_share_roomsso profile reads are limited to users with a shared room. Review whether profile data is included in invites. - Rate limits: Lookups from strangers need throttling, and this is tuned separately from login and message limits.
- Federation: Keep federation open only if you accept that remote servers can see whatever the policy exposes, and that the whitelist will not narrow lookups for them.
Test the public surfaces as an anonymous visitor and as a logged-in user on another server, and record what each returns. Repeat the test after every Synapse upgrade, because default values can change between releases.
A server that federates with named partners sits between the two models. The federation_domain_whitelist setting is the gate that matters most for directory exposure: a server outside the list cannot query your profiles or search results. Inside the list, you still choose how much each partner can see, so the policy has two layers.
- Whitelist first: List only partner domains in
federation_domain_whitelist, and firewall the federation listener to the partners' address ranges where those ranges are known and stable. - Directory scope: Remote users appear in search only when they share a room with the searcher or are in a public room, so the rooms you share with partners determine what they can find.
- Profile visibility: Decide whether partner servers may read profiles, using
require_auth_for_profile_requestsand the profile limits, and test the result with a partner account. - Public rooms: Keep
allow_public_rooms_over_federationoff unless partners need your room list. - Change control: Each partner added or removed changes who can search and read profiles, so record it as an access change with an owner.
Before go-live, ask each partner for a test account and confirm which profile and directory results they receive. Confirm in the configuration manual how the whitelist interacts with directory behavior in your Synapse version.
Security and operational considerations
Profile and directory settings decide how much of your user base is visible to strangers and to other homeservers. The cards below cover what leaks, what breaks when you tighten lookups, and what to watch and retest over time.
Username enumeration through search
The user directory answers search queries, and by default it can return users who share a room with the requester or who sit in public rooms. An attacker who can create an account can walk the directory with common name patterns and build a list of valid IDs for phishing or credential attacks. Check which search scope your server allows, and test with a throwaway account from outside your user base.
Synapse configuration manualProfile data reaching federated servers
Display names and avatars are returned when another server requests a user's profile, and that request can come from any federated server that shares a room with the user or looks them up. Profile fields may carry more personal information than staff expect, such as full names or department labels. Decide which fields your users should publish, and confirm with a federation test from a second server what a remote requester can actually retrieve.
Effect on bridges and bots
Bridges, bots and service accounts often resolve users and profiles through the directory or profile endpoints to create puppets, mirror rooms or match identities. Restricting lookups can silently break these integrations, which tend to fail in logs rather than in the user interface. Inventory each integration's lookup calls and grant only the scope it needs, with the bridge and bot owners confirming their behavior after each change.
Logging and monitoring directory queries
Directory searches and profile requests are useful signals for spotting scraping and enumeration, but they only help if your logs capture them with enough context. Decide how long to retain request logs, who may read them, and which alerts matter, such as one account issuing many searches in a short window. Confirm that log retention and access rules match your data protection policy before you turn on detailed logging.
Admin API and reverse proxy interaction
Reverse proxy rules decide which client and federation paths reach Synapse, and some lookup-related endpoints sit close to admin paths in the routing table. A rule that is too broad can expose administrative routes, while a rule that is too narrow can break clients that depend on search. Review the proxy configuration together with the Admin API restrictions, and test each path from an external network and from the federation port.
Retesting after each Synapse upgrade
Directory and profile behavior has changed in past releases and can change again when defaults or endpoints are updated. The upgrade notes for each release should be read in full, and the lookup tests should be rerun on a staging copy before production. Record the expected results for a search from an unrelated account, a profile fetch from a remote server and a bridge lookup, so each upgrade has a clear pass or fail check.
Questions teams ask before restricting Matrix lookups
How much effort does a profile lookup policy change take?
The settings themselves are a small edit to the Synapse configuration file followed by a restart. The effort sits in the review around that edit. You need to list which clients, bridges and bots search for users or fetch profiles, test each one, and agree the new behavior with the people who own them. Effort rises with the number of integrations, the number of federated servers your users talk to, and how many teams must sign off. Most of the cost is one-time, but re-testing recurs after Synapse upgrades and when new integrations arrive. When you ask a partner for a quote, ask for the list of settings to change, the clients and bridges included in testing, and the number of review rounds.
Can our own team restrict Matrix directory search without outside help?
Yes, if you have someone who can edit the Synapse configuration, restart the homeserver and read its logs. The options are documented in the Synapse configuration manual, and a team that already runs Synapse can make and reverse changes in a test environment first. Outside help adds the most value when the server has many federated peers, custom integrations, or compliance requirements that need written evidence. Check your own skills honestly: you need working knowledge of the YAML configuration, your reverse proxy, and how your clients perform user search. A single, well-understood change does not require a partner.
What access and sign-off do we need before we start?
You need four things before work begins:
- Admin access to the Synapse host and its configuration file, plus read access to the database if you want to verify user visibility directly.
- A test account set apart from production users, and ideally a staging homeserver with a copy of your configuration.
- Named owners for each client app, bridge and bot that searches for users, so each one can be tested by someone who knows it.
- Written sign-off from the people responsible for privacy and from the teams that run support or community functions, because discoverability changes affect how people find colleagues and partners.
Record the change in your normal change management process so you can roll it back to the previous configuration if validation fails.
How do bridges and bots behave when lookups are restricted?
Bridges and bots are the most common source of breakage, because they often search for or create users on behalf of other people. A bridge that looks up a Matrix user before sending an invitation can fail when that user is hidden from search or when profile requests require shared rooms. Bot accounts may need the same visibility as human accounts. Before changing anything, inventory every service account, read the documentation of each bridge project, and test a bridged room from end to end. The Matrix bridges directory lists the bridge projects that teams commonly connect, which is a useful starting point for that inventory.
How long does validation take for a small server versus a large federated one?
No fixed duration applies, because validation scales with user count and federation footprint. A small server with few federated peers mostly needs checks of user search, profile display and invitations from a handful of clients. A larger server, or one that federates with many domains, needs sampling across remote servers, a longer observation window for user complaints, and confirmation that federated users still see correct names and avatars. Ask for a validation plan that names the test scenarios, the remote servers involved and the observation period after the change. The Synapse federation documentation describes how remote servers interact with yours, which helps you choose those scenarios.
What breaks for users after we restrict profile lookups?
Users most often notice missing display names or avatars in rooms that include people from other servers, failed user searches when starting a direct chat, and invitations that do not resolve to the intended person. Support requests usually follow within the first days after a change. Ask your team to confirm in a test environment which of these behaviors occur on the Synapse version you run, because the effects depend on the exact settings and client versions. Prepare a short message for users that explains what changed and where they can report a problem, so the support queue does not absorb the change alone.
Which settings trade discoverability for privacy on Synapse?
Lookup behavior is governed by several Synapse options in the user directory and profile areas. Some decide whether user search covers all users or only people who share a room with the searcher or appear in public rooms. Others decide whether profile requests need authentication or whether they are limited to users who share rooms. The federation_domain_whitelist option is a separate, broader control because it restricts which servers can federate with yours at all. Confirm the exact key names and defaults for your Synapse version in the configuration manual before editing, since names and defaults can change between releases. Test each option on its own so you can attribute any change in behavior to a single setting.
Can DeployOpen carry out the change and validation for us?
Yes. DeployOpen implements, hardens and documents self-hosted open-source platforms in your own infrastructure, and most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. For this topic, a written scope would cover the settings to change, the clients, bridges and bots to test, the staging validation, and the handover documentation for your team. DeployOpen does not publish a price list, so a quote follows from that written scope. Ask for the scope to list which validation scenarios are included and whether ongoing retesting after upgrades is covered by a separate retainer.
What a hardening review of directory settings covers
A directory and profile review starts with a read-only audit of how the current homeserver answers lookups. DeployOpen collects the live configuration from the Synapse homeserver and, where the deployment uses it, from Matrix Authentication Service, then records which settings govern user directory search, profile visibility and federation reach. The audit also covers the surrounding controls that determine who can query the server: whether federation is open or limited by a domain allowlist, whether the federation listener is reachable from networks you did not intend, and how the reverse proxy routes client and federation traffic. Confirm with your own team which identity provider is the source of truth for display names and attributes, because profile data that is synced from directory services may need a different policy than data users edit themselves.
Before any change is made, the review produces a written policy that your compliance, privacy and IT leads approve. The policy states who may be found through search, which profile fields may be visible to other local users and to remote servers, and whether directory publication is limited to users who share a room. It also records which trade-offs you accept, such as reduced discoverability for new contacts or additional steps for users who expect to find colleagues by name. DeployOpen implements the agreed settings in your infrastructure, using your change process, configuration management and maintenance windows, and documents each change with its reason. Scope, deliverables and timelines are fixed in writing before work starts, and any settings your team has not approved stay unchanged.
Verification uses test accounts that you provide, placed on the server and on at least one remote server you control or have agreed to test with. The checks confirm what an unauthenticated stranger, an unrelated local user and a federated server can and cannot retrieve through search and profile requests, and they repeat after each change. Results are delivered as a findings report with the evidence for each setting. DeployOpen does not promise a specific reduction in exposure or a particular outcome from any review. Its role is to plan, implement and test the controls, and to leave your team with a record that they can rerun after upgrades, since Synapse defaults and option names can change between releases and should be checked against the release notes for the version you run.
How DeployOpen scopes and delivers Matrix hardening work
DeployOpen plans, implements, tests and documents Matrix homeserver settings inside infrastructure you control, including the profile and user directory controls covered on this page. Work starts from a written scope that names which settings change, which federation and client behaviors are tested, and what evidence you receive.
How we scope
- Inventory current profile, directory and federation settings on your Synapse and MAS deployment before choosing changes.
- Agree in writing which discoverability trade-offs you accept, such as user directory visibility for local users only.
- Define which federated servers, clients and bridges must keep working so directory changes do not break them.
How we build
- Apply the directory search and profile lookup settings in your test environment first, then promote them through your change process.
- Test whether unauthenticated and federated requests can read display names, avatars and room memberships under the new settings.
- Verify that federation_domain_whitelist and listener firewall rules match the directory policy you agreed in scope.
How we hand over
- Deliver the configuration files, change record and before-and-after test results for each profile and directory setting.
- Document the trade-offs, the users and integrations affected, and the steps to reverse each setting.
- Walk your administrators through the admin tools and the checks they should repeat after each Synapse upgrade.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Retesting after Synapse upgrades or policy changes can be added to the written scope or the retainer.

