Matrix bridge and bot encryption: who needs it and why it matters
A bridge or bot can only take part in an encrypted Matrix room if it holds the room's keys and decrypts the messages, so the design choice is where that decryption happens. Teams usually reach this question in one of two situations: they want Slack, WhatsApp, Telegram, Signal or email conversations to appear in Matrix rooms that are encrypted by default, or they want a moderation or workflow bot to read and act on messages inside those rooms. Either way, the bridge or bot becomes a trusted endpoint, so its keys, storage and host belong in your security review rather than being treated as an afterthought.
You need to plan for this when rooms are encrypted by default, when a bridged third-party network carries sensitive conversations into those rooms, or when a bot must react to message content such as keywords, approvals or ticket commands. Ask each bridge and bot vendor which component decrypts messages, where the keys and session data are stored, and whether that storage is encrypted at rest. Confirm these answers against the current documentation of each project, because support for encrypted rooms and the required login method changes between releases.
You can avoid this work when rooms are unencrypted and that choice is a deliberate policy, or when a bot only posts notices such as alerts, deployment messages or reminders and never reads user content. In those cases, the bridge or bot does not need to decrypt anything, and the design is simpler. Document the decision per room type, because a room that starts unencrypted and later becomes encrypted can silently break a bridge or bot that was never built to handle it.
Which bridge and bot encryption setup fits each case
This table compares four situations: unencrypted bridged rooms, encrypted rooms bridged to a third-party network, encrypted rooms with a bot that only posts, and encrypted rooms with a bot that reads and acts. Read each row to see what the bridge or bot must decrypt, where keys sit, what the outside network sees, and what to confirm with the project before you commit.
| Situation | What must be decrypted and where keys sit | What the third-party network sees | What to confirm with the bridge or bot project |
|---|---|---|---|
| Unencrypted bridged rooms | Nothing is decrypted because the room carries plain events. The bridge reads and forwards each message as ordinary room content. | Full message content, plus sender and room mapping, as the bridged network normally receives it. | Confirm the bridge handles plain rooms as expected and that no encryption setting on the homeserver changes the room type. |
| Encrypted room bridged to a third-party network | The bridge must hold the room keys and decrypt each message before relaying it. Keys sit on the bridge host, so that host becomes a point where plaintext exists. | Plaintext content in the external network's own format, subject to that network's retention and its own encryption. | Check whether the bridge supports end-to-bridge encryption, how it stores and backs up keys, and which of its features are disabled in encrypted rooms. |
| Encrypted room with a bot that only posts | The bot does not need to read room history. It sends messages into the room, which it encrypts with the room key it already has, so decryption of incoming content is usually not required. | Only what the bot publishes, such as alerts or notices. Room members and any users the bot targets are unaffected. | Confirm the bot can send to encrypted rooms, how it manages its own device keys, and whether it needs to be verified or trusted by members. |
| Encrypted room with a bot that reads and acts | The bot must decrypt incoming events and hold keys for the rooms it reads. Those keys and the bot's device store are a sensitive secret, and their scope should match the bot's purpose. | Whatever the bot sends to an external service or API, which can include full message text if the bot forwards it. | Confirm which events the bot can decrypt, how keys are persisted and rotated, which external services receive content, and how the bot's access is revoked. |
How a message travels from an encrypted Matrix room to a third-party network
The walk starts in a Matrix client, which encrypts the message before it leaves the user's device. The homeserver stores and relays only ciphertext. The bridge or bot receives the events, holds the keys needed to decrypt them, and is the point where plaintext first exists outside the user's device. It then forwards the content to the third-party network. Replies take the reverse path and are encrypted again before they enter the Matrix room. Check which host runs the bridge, who can reach its key store, and what it logs.
Plaintext exists only inside the bridge or bot host, between decryption and forwarding.
Where messages are decrypted in mautrix bridges and Hookshot
End-to-bridge encryption means the bridge is itself a participant in the encrypted Matrix room. To relay a message to the third-party network, the bridge process must decrypt the Matrix event first, so plaintext exists on the bridge host in process memory and, depending on the build and configuration, in storage. Matrix encryption protects the message in transit between Matrix clients and the homeserver, but it does not protect it from the bridge that holds the room keys. The bridge host therefore becomes part of your message-handling boundary and needs the same access control, patching, logging and backup scrutiny as the homeserver itself.
The mautrix bridge family and Hookshot handle this by giving the bridge its own Matrix device identity and by receiving room keys it is entitled to use. Each bridge keeps device and key state so it can decrypt events and, in the outbound direction, encrypt messages it sends into rooms. Before you commit to a version, confirm with the project documentation exactly where that key material lives (database tables, key files or a local store), whether message caches or media are written to disk, how long they are kept, and what happens to them when the bridge is removed. Do not assume these details are identical across mautrix bridges or across Hookshot releases, because the storage layout has changed over time.
The third-party network sees plaintext regardless of how Matrix encryption is configured. Slack, WhatsApp, Telegram, Signal or email receive the relayed content in their own protocols, under their own retention and access rules, and the bridge operator cannot control what those services store. Tell business owners that an encrypted Matrix room bridged to an external network is encrypted only up to the bridge. Record this in the data flow documentation and in the decision to bridge a room at all, and confirm the bridged network's own terms before approving the connection.
How to set up an encrypted bridge or bot step by step
This sequence takes a bridge or bot from a planning decision to a tested, restart-safe integration that can read and send messages in encrypted rooms, with a documented recovery path for its keys and device.
Decide which rooms must be bridged and encrypted
The platform owner and the compliance lead list the rooms the bridge must serve and mark which of them are end-to-end encrypted. For each encrypted room, record whether the bridge needs to read messages, send messages, or both, and who is accountable for the bridge's access. The output is a short written room inventory that every later step refers back to. Confirm with the business owner whether any encrypted room should stay out of bridge scope, because that choice determines whether the bridge needs a device at all.
Choose the bridge or bot and confirm encryption support
The engineering team selects a bridge or bot from the Matrix bridge list and reads its documentation for end-to-bridge encryption support, including how it stores keys, which device it uses, and how it handles verification. Mautrix bridges and Hookshot are common candidates, but the team should confirm the current behavior of the exact version in its own documentation rather than assume it. The check is a written note stating whether encrypted rooms are supported, which component decrypts the messages, and which storage options the project documents.
Register the bridge as an application service
The Synapse administrator adds the bridge's registration file to the homeserver configuration so Synapse knows which user IDs and room aliases the bridge controls. The registration file holds the tokens that the bridge and the homeserver use to authenticate each other, so it is stored with restricted file permissions on the host. Restart Synapse, then confirm in the logs that the application service loaded without errors and that the bridge's bot user appears in the expected namespace.
Provision device and key storage on a host you control
The platform engineer runs the bridge on a host in the organization's infrastructure and creates a dedicated bot account with its own device. The bridge's crypto store, which holds the Olm and Megolm session keys, is placed on encrypted storage with a backup in the same controlled environment. Check that the bot account's device list in the homeserver shows the bridge device after its first login, and record the device ID in the operations runbook. Without a persistent key store, the bridge cannot decrypt history after a restart.
Set up the bridge database
The platform engineer provisions a database for the bridge, using the database type its documentation supports, and sets the connection string in the bridge configuration. Access is limited to the bridge's service account, and the database is included in the backup schedule with the homeserver database. The check is a successful bridge startup that writes its initial schema, followed by a confirmed backup restore test in a non-production copy. Confirm the bridge's documented database requirements before choosing the engine.
Test a bridged message in both directions
The test team creates an encrypted test room with one account on the external platform and one Matrix user, then sends a message from each side. For each direction, confirm the recipient sees readable plaintext in the Matrix client and that the external platform receives the correct content. Check that the bot account's device list shows the bridge device as verified or trusted according to the chosen policy. Repeat the test with a message containing a file or formatted text to confirm that attachments and formatting also decrypt correctly.
Confirm the bridge rejoins encrypted rooms after restart
The operator stops the bridge process, restarts it, and sends another message in each encrypted test room. Confirm that the bridge reuses its stored keys, decrypts the new message, and does not create a new device, which would mean the crypto store was not persisted. Review the bridge logs for startup errors and check that they contain room and event identifiers without message bodies. Repeat the restart test after a host reboot if the bridge runs under a process supervisor.
Document the key and device recovery process
The operations lead writes a runbook that covers where the crypto store and database backups live, who can restore them, how to recreate the bot device if the store is lost, and how users are told that history may be unreadable after a restore. The runbook names the approver for re-verification and the steps to rotate the bot's access tokens. The output is a reviewed document, plus a restore drill that shows the bridge can decrypt new messages after recovery.
What the MSC4190 requirement means under MAS
Under the Matrix Authentication Service (MAS), the homeserver no longer handles login itself. MAS is an OAuth 2.0 and OpenID provider that implements the OIDC-based authentication described in MSC3861, and it delegates sign-in to an upstream provider such as Keycloak, Microsoft Entra ID, Google or Authentik. That shift matters for bridges and bots, because a bridge that once logged in with a password or application service token now has to authenticate through the same OIDC flow as a human user. It also has to be able to manage its own devices, since bridges and bots hold Megolm session keys and need a device identity to decrypt and send in encrypted rooms. MSC4190 is the proposal this topic identifies as required for that device handling under MAS, so a bridge or bot that lacks it cannot be expected to work in encrypted rooms on a MAS-backed server.
Before you plan a rollout, confirm three things with the bridge maintainers and your MAS version notes. First, which MAS release and which bridge release implement MSC4190, since the supplied facts do not give those version numbers and they change over time. Second, how the bridge registration file changes once the bridge authenticates under MAS, including whether the bridge needs its own OIDC client and what credentials it stores. Third, what happens to existing bridge accounts and their devices during migration: whether the current device IDs and stored key material carry over, whether the bridge must log in again, and whether some encrypted history becomes unreadable if keys are not moved. Test this on a staging homeserver with a copy of your database before touching production, and write the migration and rollback steps into the change plan.
Security risks of decrypting on the bridge host
A bridge that joins an encrypted room holds decrypted messages and the keys to read them, so the bridge host becomes a sensitive system in its own right. The cards below cover the places plaintext and credentials can leak, and the controls to plan for each before the bridge goes live.
Bridge host compromise
The bridge process holds the device keys and decrypted message content for every bridged encrypted room it joins. An attacker with access to the host can read that history and impersonate the bridge device. Plan isolation for the host, with a dedicated network segment, restricted administrative access and host hardening that matches the sensitivity of the data. Ask the bridge project and your platform team which directories hold crypto state so you can restrict them from other workloads.
Over-broad bridge database access
Bridge databases store the crypto store, room mappings and message mapping data needed to relay events. Any service account, admin or backup job that can read this database can read the keys and content that the bridge depends on. Plan a dedicated database user with least privilege, confirm which roles can connect, and review who holds read access to the database host and its replicas.
Logs and crash dumps with content
Debug logging, verbose request traces and crash dumps can capture decrypted message bodies or key material. These copies often reach a central log platform with wider access and longer retention than the bridge itself. Before go-live, set the bridge log level deliberately, confirm what the bridge writes on failure, and decide who can read and how long logs are kept. Test a forced crash in staging and inspect what was written.
Bot account credentials and tokens
Bridges and bots authenticate to the homeserver with access tokens or application service registrations. A leaked token lets someone act as the bot in every room it has joined, including encrypted ones. Plan where tokens are stored, how they are injected into containers, and who can view configuration files. Define a rotation procedure and confirm how the bot or bridge is revoked and re-registered if a secret is exposed.
Third-party network retention
When a bridge relays a message from an encrypted Matrix room to a third-party network such as Slack, Telegram or WhatsApp, the message leaves end-to-end protection and is held under that network's own terms. The bridge operator cannot control retention or deletion on the far side. Plan an inventory of which rooms are bridged to which networks, and confirm the third party's retention and data handling terms with the vendor before connecting a room that carries regulated data.
Stale bridge devices after rebuilds
Rebuilding a bridge host or restoring an old backup can create new device sessions while old ones remain registered to the user's rooms. Stale devices can keep receiving room keys and decrypt future messages long after the bridge was retired. Plan a device cleanup step in every rebuild and retirement runbook, list the bridge devices per account, and remove sessions that no longer correspond to a running bridge.
Questions to ask before bridging encrypted Matrix rooms
What drives the cost and effort of an encrypted bridge project?
The main drivers are the number of third-party networks being bridged, the number of rooms and users in scope, whether the homeserver already runs Matrix Authentication Service (MAS), any custom bots you need, and how much testing and documentation the project requires. Each network adds its own bridge configuration, login flow and failure modes, so a project covering several networks costs more to build and verify than one covering a single network. Ask any provider to price each of these items separately in the written scope, and to state which items are one-time work and which recur with bridge upgrades. A quote should also name who holds the bridge accounts and who maintains the bridges afterward.
Can our own team build an encrypted bridge without outside help?
Yes, if you have engineers who can run Synapse, configure appservices, manage a database and operate containers or services on a host you control. The work involves setting up each bridge with its registration file, connecting it to the homeserver, deciding where encryption keys are stored, and testing that bridged users can read and send messages in encrypted rooms. Teams with no prior Matrix operations experience usually need time to learn the Synapse and bridge configuration model before their first deployment is reliable. An outside partner is most useful when the scope is wide, the timeline is fixed, or the team needs a documented, reviewed setup for compliance purposes.
What does the work need from our side?
Expect to provide a host or cluster in your own infrastructure, DNS records and TLS certificates for the homeserver and any public endpoints, and admin access to Synapse and, where used, MAS. You will also need a named owner for each bridge account and for encryption key recovery, because a bridge that loses its key store can leave history unreadable. A test plan should be agreed in advance, covering test rooms, test users on each bridged network and the expected results. Your security team should confirm where bridge logs are stored and who can read them, since decrypted content may appear there depending on configuration.
How long does an encrypted bridge project take?
No duration has been established for this work, so ask any provider for a timeline based on your written scope. The schedule depends on the number of networks, whether MAS and its SSO integration are already in place, the state of your Synapse version and database, how many rooms need encryption tested, and how quickly your team can review test results and approve changes. Delays often come from waiting on upstream identity provider setup, decisions about key ownership, or change approvals in your own environment. Ask for a plan that lists each milestone, the dependency it waits on and the test evidence delivered at each stage.
What happens when we upgrade a bridge or Synapse?
Each bridge is a separate software project with its own release cycle, and upgrades can change configuration keys, database schema, encryption handling or the minimum Synapse version it supports. Synapse upgrades also carry their own risks, including database schema changes that make rollback difficult, so read the upgrade notes for every release between your current version and the target before starting. Plan a staging environment where you test the bridge against the new Synapse version, confirm that encrypted messages still decrypt and send, and keep a backup of bridge storage before each change. Ask your provider whether upgrade testing is included in the initial scope or sold as a retainer.
Can we verify that encryption works end to end?
You can verify it with a defined test: create an encrypted room, join a bridged user and a Matrix-native user, send messages in both directions, and confirm from the Matrix side that the bridge is a verified participant with the expected devices. Check that the bridge's device list is current, that new members receive keys for prior messages where expected, and that message content is not stored unencrypted in logs or databases you did not intend to keep it in. Be clear with the team that bridging encrypted rooms means the bridge decrypts messages to forward them, so the bridge host is a trusted point in the chain. Ask your provider to document this trust boundary and deliver the test results as evidence for your security review.
Limits to confirm in your environment
Bridge and bot encryption depends on the versions you run, the protocol extensions they support, and the rules of the network on the other side. Confirm each item below with the project documentation and a test in your own environment before you approve a rollout.
Bridge and bot support for encrypted rooms
Not every bridge or bot handles encrypted rooms in every release, and support can differ by bridge, by bot framework and by version. Check the release notes of the exact version you plan to run, then confirm that the bridge can join an encrypted room, send and receive messages there, and decrypt inbound events. Test with a room that has encryption enabled from the start, because a bridge that works in unencrypted rooms may fail silently in encrypted ones.
Matrix bridge listMSC4190 support in MAS and bridges
Under Matrix Authentication Service, bridges and bots that register as application services need MSC4190 support in both MAS and the bridge build. Confirm that your MAS version and your bridge version both implement it, because a mismatch can block device and login handling for the bridge's own user. Record the versions you tested so that an upgrade of either component triggers a retest.
MAS upstream setupKey storage and backup behavior
The bridge holds its own device keys and the Megolm session keys it uses to decrypt room traffic. Find out where those keys are stored, whether they sit in a database you back up, and whether the bridge supports server-side key backup. Confirm what happens after a restart, a database restore or a move to a new host, since losing these keys can leave the bridge unable to read history it previously handled.
Network terms for relaying messages
Relaying messages from a third-party network into Matrix is governed by that network's terms of service, API rules and, for some platforms, licensing for automated or third-party clients. Ask your legal or compliance team to review the terms of each network you plan to bridge, and confirm whether the account type you use is permitted to relay messages for a group of users. Do not assume that a bridge project's documentation settles this question.
Bridged history and media in encrypted rooms
Test how older messages, edits, reactions, files and images behave once a room is encrypted. Some bridges can only forward content received after the bridge joined, and encrypted media may need separate handling before it reaches the other network. Run a test that sends text, a file and an edited message in both directions, then check what a new member sees and what appears in the third-party client.
Active maintenance of the bridge project
Encryption support in bridges changes often because the Matrix protocol and the third-party APIs both move. Check the project's recent commits, open security issues, release cadence and maintainer activity before you commit. A bridge that has not shipped updates in a long period may not keep pace with Synapse, MAS or the network it connects to, and you should plan a fallback or a replacement path.
How DeployOpen scopes and delivers encrypted bridge work
DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including the bridge and bot services that join your encrypted Matrix rooms. Engagements are fixed-scope, so the decisions about where messages are decrypted and who holds the keys are written down before any build starts.
How we scope
- We list each bridge, bot and room type that needs to read encrypted messages, with the owner of each service.
- The written scope states which MAS and Synapse settings, MSC4190 support and client-side verification steps are included.
- We record where decryption happens and which data stores hold keys, so your security team can review the design first.
How we build
- We deploy the bridge or bot in your infrastructure, with its device identity, key storage and session handling configured.
- We test joining an encrypted room, sending and receiving messages, and recovering after a restart or key rotation.
- We check the decryption boundary and logging settings against the approved design before we call the build complete.
How we hand over
- You receive configuration records, a data flow description of the decryption path and the verification test results.
- We write an operations runbook covering device key rotation, bridge restarts, revoking a bot and what to do after a failed login.
- Handover sessions walk your platform and security teams through the runbook and the open items agreed in the scope.
How we support
- Support after handover is available as a retainer, covering upgrades of bridges, bots and the homeserver components they depend on.
- Retests can be scheduled after material changes to the bridge, the identity provider or the room encryption defaults.
- Your quote should name who owns upgrades, key material and on-call response, so the retainer scope matches your operating model.

