#12077: Matrix: stabilize E2EE verification and modularize SDK
docs
channel: matrix
maintainer
Cluster:
Matrix Media Handling Fixes
## Summary
- migrate the Matrix extension from `@vector-im/matrix-bot-sdk` to the official `matrix-js-sdk` via a compatibility adapter
- preserve existing Matrix plugin behavior (DMs, rooms, threads, media, reactions, polls, location, E2EE) while removing deprecated `request`-based dependency paths
- replace mixin-based auto-join with explicit invite handling and add allowlist normalization
- update Matrix docs/onboarding/dependency checks to reference `matrix-js-sdk`
## Security hardening
- add redirect hardening in the Matrix HTTP helper to block cross-protocol redirects (`http` <-> `https`)
- drop `Authorization` headers on cross-origin redirects
- route Matrix password login through the hardened Matrix request helper (instead of direct `fetch`)
## Behavior and typing improvements
- fix encrypted event bridge behavior so inbound encrypted messages are delivered only after successful decrypt
- emit failed decryption events explicitly and avoid duplicate pre-decrypt message handling
- add typed event overloads for Matrix client event handlers
## Current improvements
- stabilize Matrix E2EE flows with matrix-js-sdk by hardening verification/cross-signing behavior and decrypt retry wiring
- modularize Matrix SDK internals so crypto, transport, logging, persistence, and verification logic are separated and easier to maintain
- add Matrix verification operations and configuration wiring, and document the updated Matrix encryption/verification flow
## What changed
- extracted SDK concerns into dedicated modules under `extensions/matrix/src/matrix/sdk/`:
- `verification-manager.ts`
- `decrypt-bridge.ts`
- `idb-persistence.ts`
- `transport.ts`
- `logger.ts`
- rewired `extensions/matrix/src/matrix/sdk.ts` to delegate verification lifecycle operations to `MatrixVerificationManager`
- improved Matrix client config/auth handling and storage paths for encrypted state/recovery key persistence
- expanded Matrix channel/tool actions for verification and encryption status operations
- updated Matrix docs with setup, E2EE behavior, verification operations, and troubleshooting notes
## Validation
- `pnpm check` (run by operator)
- focused Matrix test suite(s) including `extensions/matrix/src/matrix/sdk.test.ts` (run by operator)
Most Similar PRs
#2902: fix(matrix): check if requestOwnUserVerification exists before calling
by dokterdok · 2026-01-27
66.8%
#20278: Fix/matrix missing bot sdk dependency
by saurav470 · 2026-02-18
65.0%
#10313: fix(matrix): fallback to authenticated media download (Matrix v1.11+)
by iter-next · 2026-02-06
64.8%
#13832: feat(matrix): add sessionScope and thread-scoped inbound sessions
by yamoroc · 2026-02-11
64.1%
#13013: feat(matrix): multi account support
by ti · 2026-02-10
64.0%
#18718: matrix: add pending group history context for room messages
by pharasyte · 2026-02-17
63.5%
#13057: feat(matrix): add sessionScope=room to route sessions by roomId
by spengrah · 2026-02-10
63.5%
#20969: Add DeJoy channel extension (Matrix-compatible protocol)
by web3km · 2026-02-19
62.3%
#20286: Matrix: render LaTeX for Element Desktop by emitting data-mx-maths ...
by eloklam · 2026-02-18
61.9%
#21105: feat(matrix): multi-account support
by omnibot1985 · 2026-02-19
61.4%