Skip to content

fix(matrix): route text-only send_message through adapter for E2EE support - #56106

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-a3c29715
Jul 1, 2026
Merged

teknium1 merged 1 commit into
mainfrom
hermes/hermes-a3c29715

Conversation

@teknium1

@teknium1 teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Text-only Matrix messages sent via the send_message engine (hermes send, cron deliver: matrix) now arrive encrypted in E2EE rooms instead of cleartext (red padlock).

Root cause: media sends already routed through the mautrix adapter (_send_matrix_via_adapter), which encrypts. Text-only sends took the raw-HTTP standalone_sender_fn path, which never encrypts — so text landed unencrypted in E2EE rooms.

Changes

The plugin's standalone_sender_fn stays registered for the registry contract; it is simply no longer reached for Matrix.

Validation

Before After
Text-only send in E2EE room raw HTTP m.text → cleartext (red padlock) mautrix adapter → encrypted
Media send in E2EE room adapter → encrypted adapter → encrypted (unchanged)
Targeted tests 169/169 pass
E2E routing check text → standalone raw-HTTP text → _send_matrix_via_adapter, raw-HTTP bypassed

Salvaged from #20259 (@DanAsBjorn, first submitter) onto current main. The original patched the pre-#41112 _send_matrix branch, which had since moved to the plugin's standalone path — same fix direction, re-applied to the current structure. Duplicate #23382 (@32r4) fixed the same routing layer with an encryption-flag gate; the unconditional route is simpler and correct since the adapter sends plaintext to unencrypted rooms fine.

Infographic

mission patch

…pport

Text-only Matrix messages sent via the send_message engine (hermes send,
cron deliver: matrix) arrived unencrypted (red padlock) in E2EE rooms.
Media sends already routed through the mautrix adapter and encrypted fine,
but text-only sends took the raw-HTTP standalone_sender_fn path, which
never encrypts.

Route ALL Matrix sends through _send_matrix_via_adapter so text is
encrypted too. The adapter reuses the live gateway's E2EE session when
available (#46310) and falls back to an encryption-aware ephemeral adapter
for standalone/cron contexts. The registry standalone_sender_fn stays
registered for the contract; it is simply no longer reached for Matrix.

Salvaged from PR #20259 onto current main (the original patched the
pre-#41112 _send_matrix branch, which had since moved to the plugin's
standalone path).

Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
@alt-glitch alt-glitch added type/bug Something isn't working platform/matrix Matrix adapter (E2EE) sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages P1 High — major feature broken, no workaround labels Jul 1, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Salvage of #20259 (@DanAsBjorn) re-applied to current main. Competes with the same-goal PRs #23382 (routes text through the adapter behind an encryption flag) and #45518 (adds an explicit E2EE encryption guard in send()/edit_message()) — same silent-cleartext-in-E2EE family, different mechanisms. Related, not duplicate; a maintainer should pick the canonical fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High — major feature broken, no workaround platform/matrix Matrix adapter (E2EE) sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants