-
-
Notifications
You must be signed in to change notification settings - Fork 90
bridgev2/provisioning: allow passing mxids to /resolve_identifier and /create_dm #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jcardenas3
added a commit
to iKonoTelecomunicaciones/go
that referenced
this pull request
Oct 31, 2025
* bridgev2/bridgeconfig: add missing copy for session transfer config * client,bridgev2: use time.After instead of sleep * bridgev2/crypto: fix ghost ID format in db queries * id/matrixuri: fix parsing url-encoded matrix URIs * id: validate server names in UserID.ParseAndValidate * client: add support for stable version of room summary endpoint * bridgev2/portal: log start time when event handling takes long * bridgev2/status: add RESTART UserAction (mautrix#384) * bridgev2: Configurable disconnect timeout (mautrix#383) Let the caller decide if they want to have a timeout or not. For standalone bridges using the Bridge struct the behavior is kept the same by waiting for five seconds when UserLogin DisconnectWithTimeout() is called. * crypto/verificationhelper: add method to verification done callback (mautrix#385) * bridgev2/provisioning: ensure that Start returns a non-nil first step * event/relations: use unstable prefix for reply room ID field * bridgev2/portal: include room id in cross-room replies * event: add custom soft fail fields * event: add membership field to unsigned * bridgev2/portal: allow specifying extra fields for portal members (mautrix#386) * appservice/intent: ensure registered when sending own member state event * bridgev2/matrixinvite: save portal after setting mxid * bridgev2/userlogin: never set client to nil * bridgev2/portal: check only for me flag in delete chat events * bridgev2: fix more background contexts * bridgev2/provisioning: check for nil steps in submit and wait calls * event,requests: add MSC4293 redact events field to member events * dependencies: update * bridgev2/matrixinvite: allow redirecting DM creations to another user * bridgev2/matrix: check stream upload size after writing file * bridgev2/matrixinvite: clean up old portal room if user is not a member * event: implement fallbacks for per-message profiles * Bump version to v0.24.1 * bridgev2/portal: return result of handling remote events (mautrix#389) * mediaproxy: validate media IDs * mediaproxy: fix closing data response readers * id: fix ServerNameRegex not matching port correctly (mautrix#392) fixes mautrix#391 * federation: fix base64 in generated signatures * event: fix removing per-message profile fallback in edits * bridgev2/portal: add support for per-message profiles in relay mode * bridgev2,appservice: move appservice ping loop to appservice package * appservice: remove unnecessary parameter in ping * bridgev2/portal: fix disappearing message notice for implicitly turning off timer * bridgev2/portal: don't assume unknown reply events are cross-room * bridgev2/networkinterface: add extra fields to reply metadata to allow unknown cross-room replies * bridgev2: add logger to background context * bridgev2/portal: track event handler panics * bridgev2/queue: add event handling result for matrix events * bridgev2/portal: merge MSS errors with handling result * bridgev2/portal: adjust handleMatrixMessage return value for pending messages * commands: add safety to type check * bridgev2: hardcode room v11 for new rooms Upcoming breaking changes in room v12 prevent safely using the default room version and security embargoes prevent fixing them ahead of time. * bridgev2/portal: block in queueEvent if buffer is full * bridgev2: add option to auto-reconnect after unknown error (mautrix#394) * bridgev2/portal: add missing return * dependencies: update * Bump version to v0.24.2 * bridgev2/disappear: add limit to getting messages from the db * bridgev2/disappear: reduce disappear loop interval when there are lots of messages * bridgev2/disappear: always delete synchronously if limit is reached * bridgev2/disappear: make next check field atomic * bridgev2/portal: ignore delete for me in multi-user portals * bridgev2/portal: add support for following tombstones * bridgev2,appservice: add via to EnsureJoined and use it for tombstone handling * client: remove redundant state store update in room create * all: add support for creator power * event: use full event type for stripped state for MSC4311 * client: add custom room create ts field * client: allow using custom http client for .well-known resolution * bridgev2/queue: run command handlers in background * bridgev2/database: add method to mark backfill task as not done * event: replace soft failed field in unsigned * bridgev2/commands: allow canceling qr login * bridgev2/portal: fix adding rooms to personal space on create * bridgev2: add interface for getting arbitrary state event * bridgev2/portal: add bots to functional members in DMs * bridgev2: run PostStart in background * all: replace gorilla/mux with standard library * bridgev2/status: take context and http client in checkpoint SendHTTP * appservice/websocket: switch from gorilla to coder * bridgev2/portal: add todo * appservice/websocket: close writer after sending * all: fix trailing slash in subrouters * bridgev2/provisioning: move login step checks into handler * bridgev2/portal: return event ignored result for type unknown * bridgev2,federation,mediaproxy: enable http access logging * format/htmlparser: don't add link suffix if plaintext is only missing protocol Auto-linkification will add a protocol in the `href`, but usually won't touch the text part. We want to undo the linkification here since it doesn't carry any additional information. * client: log method/url when retrying requests * appservice/intent: don't download avatar before setting on hungry * bridgev2/matrix: don't send connecting bridge states to cloud * bridgev2/portal: include error in event handling results * bridgev2/cryptostore: add missing escape clause to not like * client: fix updating state store in CreateRoom * bridgev2/matrix: always clear mx_user_profile when deleting room * bridgev2/matrix: add hack for resyncing encryption state cache * event: add join_authorised_via_users_server to MemberEventContent (mautrix#395) Adds `JoinAuthorisedViaUsersServer` (`join_authorised_via_users_server`) to `MemberEventContent`, introduced in room version 8 * bridgev2/matrix: don't ensure joined for state resync * sqlstatestore: ensure empty room/user ids aren't stored in db * crypto/backup: allow encrypting session without private key * crypto: replace t.Fatal and t.Error with require and assert Signed-off-by: Sumner Evans <[email protected]> * id: move room version from event package and add flags * event: fix json tag in power levels * federation: extract VerifyJSON into subpackage * bridgev2: check that avatar mxc is set before ignoring update * dependencies: update go-util and use new UnsafeString helper * requests: add json un/marshaler for Direction rune * crypto: remove group session already shared error * event: add policy server spammy flag to unsigned * format/htmlparser: collapse spaces when parsing html * crypto/attachments: fix hash check when decrypting * crypto/attachments: hash correct data while decrypting * changelog: update * verificationhelper: use static format strings (mautrix#390) * dependencies: update * client: don't set user-agent header on wasm * Bump version to v0.25.0 * changelog: fix date * federation/pdu: add utilities for PDU generation and validation * ci: test goolm and jsonv2 * ci: disable gotestfmt in goolm It explodes with `panic: BUG: Empty package name encountered.` * federation/pdu: gate signing key validity check by room version * federation/pdu: fail on any signature check error * ci: fix more things * ci: move tags to correct place * ci: disable tests on goolm again * client,event: remove deprecated MSC2716 structs * federation/pdu: add method to convert to client event * federation/pdu: reorganize code and add methods to v1 struct * federation/pdu: add docs for GetKeyFunc * client: add method to download media thumbnail * federation/pdu: add more tests for signature checks * crypto/encryptmegolm: add fallback for copying `m.relates_to` * federation/pdu: refactor redaction to allow reuse of RedactContent * event,pushrules: replace assert.Nil with assert.NoError * event: implement disappearing timer types (mautrix#399) Co-authored-by: Tulir Asokan <[email protected]> * federation/pdu: add redacted member event * federation/pdu: add auth event selection * event: add json struct tag to third party signed object * federation/pdu: add server name parameter to GetKeyFunc * federation/pdu: use jsontext.Value instead of any for deprecated fields * format: add MarkdownMentionWithName helper * format: add MarkdownMentionRoomID helper * crypto/sqlstore: add index to make finding megolm sessions to backup faster (mautrix#402) ``` 2025-08-24T22:23:19Z debug [MatrixBridgeV2] {"level":"warn","component":"matrix","component":"client_loop","subcomponent":"sync_key_backup_loop","rows":0,"duration_seconds":1.046191042,"method":"EndRows","query":"SELECT room_id, sender_key, signing_key, session, forwarding_chains, ratchet_safety, received_at, max_age, max_messages, is_scheduled, key_backup_version FROM crypto_megolm_inbound_session WHERE account_id=?1 AND session IS NOT NULL AND key_backup_version != ?2","time":"2025-08-24T22:23:19.22077Z","message":"Query took long"} ``` before: ``` sqlite> EXPLAIN SELECT room_id, sender_key, signing_key, session, forwarding_chains, ratchet_safety, received_at, max_age, max_messages, is_scheduled, key_backup_version FROM crypto_megolm_inbound_session WHERE account_id='@brad:beeper.com/CHNWOJWEUC' AND sessi addr opcode p1 p2 p3 p4 p5 comment ---- ------------- ---- ---- ---- ------------- -- ------------- 0 Init 0 25 0 0 Start at 25 1 OpenRead 0 48 0 15 0 root=48 iDb=0; crypto_megolm_inbound_session 2 OpenRead 1 49 0 k(3,,,) 2 root=49 iDb=0; sqlite_autoindex_crypto_megolm_inbound_session_1 3 String8 0 1 0 @brad:beeper.com/CHNWOJWEUC 0 r[1]='@brad:beeper.com/CHNWOJWEUC' 4 SeekGE 1 24 1 1 0 key=r[1] 5 IdxGT 1 24 1 1 0 key=r[1] 6 DeferredSeek 1 0 0 0 Move 0 to 1.rowid if needed 7 Column 0 5 2 128 r[2]= cursor 0 column 5 8 IsNull 2 23 0 0 if r[2]==NULL goto 23 9 Column 0 14 2 0 r[2]=crypto_megolm_inbound_session.key_backup_version 10 Eq 3 23 2 BINARY-8 82 if r[2]==r[3] goto 23 11 Column 0 4 4 0 r[4]= cursor 0 column 4 12 Column 0 2 5 0 r[5]= cursor 0 column 2 13 Column 0 3 6 0 r[6]= cursor 0 column 3 14 Column 0 5 7 0 r[7]= cursor 0 column 5 15 Column 0 6 8 0 r[8]= cursor 0 column 6 16 Column 0 9 9 0 r[9]= cursor 0 column 9 17 Column 0 10 10 0 r[10]= cursor 0 column 10 18 Column 0 11 11 0 r[11]= cursor 0 column 11 19 Column 0 12 12 0 r[12]= cursor 0 column 12 20 Column 0 13 13 0 0 r[13]=crypto_megolm_inbound_session.is_scheduled 21 Column 0 14 14 0 r[14]=crypto_megolm_inbound_session.key_backup_version 22 ResultRow 4 11 0 0 output=r[4..14] 23 Next 1 5 0 0 24 Halt 0 0 0 0 25 Transaction 0 0 55 0 1 usesStmtJournal=0 26 Integer 1 3 0 0 r[3]=1 27 Goto 0 1 0 0 sqlite> SELECT COUNT(*) FROM crypto_megolm_inbound_session ; +----------+ | COUNT(*) | +----------+ | 168792 | +----------+ sqlite> SELECT COUNT(*) FROM crypto_megolm_inbound_session WHERE session IS NULL; +----------+ | COUNT(*) | +----------+ | 39 | +----------+ sqlite> SELECT COUNT(*) FROM crypto_megolm_inbound_session WHERE key_backup_version != 1; +----------+ | COUNT(*) | +----------+ | 39 | +----------+ ``` after: ``` sqlite> CREATE INDEX idx_megolm_filtered ...> ON crypto_megolm_inbound_session(account_id, key_backup_version, session); sqlite> EXPLAIN SELECT room_id, sender_key, signing_key, session, forwarding_chains, ratchet_safety, received_at, max_age, max_messages, is_scheduled, key_backup_version FROM crypto_megolm_inbound_session WHERE account_id='@brad:beeper.com/CHNWOJWEUC' AND session IS NOT NULL AND key_backup_version != 1; addr opcode p1 p2 p3 p4 p5 comment ---- ------------- ---- ---- ---- ------------- -- ------------- 0 Init 0 25 0 0 Start at 25 1 OpenRead 0 48 0 15 0 root=48 iDb=0; crypto_megolm_inbound_session 2 OpenRead 1 91264 0 k(4,,,,) 2 root=91264 iDb=0; idx_megolm_filtered 3 String8 0 1 0 @brad:beeper.com/CHNWOJWEUC 0 r[1]='@brad:beeper.com/CHNWOJWEUC' 4 SeekGE 1 24 1 1 0 key=r[1] 5 IdxGT 1 24 1 1 0 key=r[1] 6 DeferredSeek 1 0 0 0 Move 0 to 1.rowid if needed 7 Column 1 2 2 128 r[2]= cursor 1 column 2 8 IsNull 2 23 0 0 if r[2]==NULL goto 23 9 Column 1 1 2 0 r[2]=crypto_megolm_inbound_session.key_backup_version 10 Eq 3 23 2 BINARY-8 82 if r[2]==r[3] goto 23 11 Column 0 4 4 0 r[4]= cursor 0 column 4 12 Column 0 2 5 0 r[5]= cursor 0 column 2 13 Column 0 3 6 0 r[6]= cursor 0 column 3 14 Column 1 2 7 0 r[7]= cursor 1 column 2 15 Column 0 6 8 0 r[8]= cursor 0 column 6 16 Column 0 9 9 0 r[9]= cursor 0 column 9 17 Column 0 10 10 0 r[10]= cursor 0 column 10 18 Column 0 11 11 0 r[11]= cursor 0 column 11 19 Column 0 12 12 0 r[12]= cursor 0 column 12 20 Column 0 13 13 0 0 r[13]=crypto_megolm_inbound_session.is_scheduled 21 Column 1 1 14 0 r[14]=crypto_megolm_inbound_session.key_backup_version 22 ResultRow 4 11 0 0 output=r[4..14] 23 Next 1 5 0 0 24 Halt 0 0 0 0 25 Transaction 0 0 56 0 1 usesStmtJournal=0 26 Integer 1 3 0 0 r[3]=1 27 Goto 0 1 0 0 sqlite> ``` * bridgev2: merge mentions and url previews when merging caption * event: add third party invite state event content * bridgev2/portal: make UpdateDisappearingSetting more versatile * bridgev2/portal: always set timestamp for disappearing message timer update * bridgev2/portal: fix send notice option when updating disappearing message timer * bridgev2/networkinterface: add interface for handling disappearing timer changes from Matrix * bridgev2/matrix: fix encryption error notice not being redacted after retry success * sqlstatestore: fix GetPowerLevels returning non-nil even if power levels weren't found * bridgev2/portal: validate capabilities when updating disappearing timer * event: marshal zero disappearing timers as empty object * bridgev2/status: add avatar_keys to remote profile * event: allow omitting timers from disappearing timer capability * bridgev2/database: don't set disappearing timer content to nil * federation/eventauth: add v3-v12 event auth rules (mautrix#401) * federation/pdu: add cached event ID to internal metadata * federation/pdu: add extra field to internal metadata * bridgev2/status: use _file pattern for avatar instead of splitting url and keys * bridgev2/matrix: remove provisioning API prefix option Reverse proxy configuration should be used instead when adding prefixes to the path. Changing the path entirely is not recommended even with reverse proxies. Fixes mautrix#403 * bridgev2/provisioning: add minimum length for shared secret * pre-commit: ban `log.Str(x.String())` * bridgev2/matrixinterface: add GetEvent interface for linkedin reply (mautrix#406) Co-authored-by: Tulir Asokan <[email protected]> * bridgev2: move shared SNC code to provisionutil * bridgev2/provisionutil: allow passing mxids to ResolveIdentifier Closes mautrix#398 * bridgev2/status: change RemoteID to a UserLoginID * client: fix v3/delete_devices method (mautrix#393) * event: add types for MSC4332 * event: use RawMessage instead of map for bot command arguments * client: implement MSC4323 (mautrix#407) * bridgev2: add support for creating groups (mautrix#405) * appservice/websocket: override read limit * event: add is_animated flag from MSC4230 * bridgev2/provisioning: remove unused structs * appservice: maybe fix url template raw path for unix sockets * bridgev2/portal: add action message metadata to disappearing notices * client: stabilize arbitrary profile field support * crypto/decryptolm: add debug logs for failing to decrypt with new session * crypto/machine: log when loading olm account * crypto/libolm: clean up pointer management * crypto: log active driver * crypto/machine: allow canceling background context * crypto/register: don't use init in *olm packages * crypto/decryptolm: retry prekey decryption with goolm * crypto/machine: don't clear account on Destroy() * event: add org.matrix.msc3381.poll.end type (mautrix#412) * crypto/sqlstore: ignore unused sessions in olm unwedging * bridgev2/database: normalize disappearing settings before insert * client: stabilize support for state_after * Bump version to v0.25.1 --------- Signed-off-by: Sumner Evans <[email protected]> Co-authored-by: Nick Mills-Barrett <[email protected]> Co-authored-by: Tulir Asokan <[email protected]> Co-authored-by: Brad Murray <[email protected]> Co-authored-by: Toni Spets <[email protected]> Co-authored-by: Matthias Kesler <[email protected]> Co-authored-by: timedout (aka nexy7574) <[email protected]> Co-authored-by: Sumner Evans <[email protected]> Co-authored-by: V02460 <[email protected]> Co-authored-by: Kishan Bagaria <[email protected]> Co-authored-by: Ping Chen <[email protected]> Co-authored-by: fmseals <[email protected]> Co-authored-by: Tiago Loureiro <[email protected]>
jcardenas3
added a commit
to iKonoTelecomunicaciones/go
that referenced
this pull request
Nov 5, 2025
* bridgev2/provisioning: ensure that Start returns a non-nil first step * event/relations: use unstable prefix for reply room ID field * bridgev2/portal: include room id in cross-room replies * event: add custom soft fail fields * event: add membership field to unsigned * bridgev2/portal: allow specifying extra fields for portal members (mautrix#386) * appservice/intent: ensure registered when sending own member state event * bridgev2/matrixinvite: save portal after setting mxid * bridgev2/userlogin: never set client to nil * bridgev2/portal: check only for me flag in delete chat events * bridgev2: fix more background contexts * bridgev2/provisioning: check for nil steps in submit and wait calls * event,requests: add MSC4293 redact events field to member events * dependencies: update * bridgev2/matrixinvite: allow redirecting DM creations to another user * bridgev2/matrix: check stream upload size after writing file * bridgev2/matrixinvite: clean up old portal room if user is not a member * event: implement fallbacks for per-message profiles * Bump version to v0.24.1 * bridgev2/portal: return result of handling remote events (mautrix#389) * mediaproxy: validate media IDs * mediaproxy: fix closing data response readers * id: fix ServerNameRegex not matching port correctly (mautrix#392) fixes mautrix#391 * federation: fix base64 in generated signatures * event: fix removing per-message profile fallback in edits * bridgev2/portal: add support for per-message profiles in relay mode * bridgev2,appservice: move appservice ping loop to appservice package * appservice: remove unnecessary parameter in ping * bridgev2/portal: fix disappearing message notice for implicitly turning off timer * bridgev2/portal: don't assume unknown reply events are cross-room * bridgev2/networkinterface: add extra fields to reply metadata to allow unknown cross-room replies * bridgev2: add logger to background context * bridgev2/portal: track event handler panics * bridgev2/queue: add event handling result for matrix events * bridgev2/portal: merge MSS errors with handling result * bridgev2/portal: adjust handleMatrixMessage return value for pending messages * commands: add safety to type check * bridgev2: hardcode room v11 for new rooms Upcoming breaking changes in room v12 prevent safely using the default room version and security embargoes prevent fixing them ahead of time. * bridgev2/portal: block in queueEvent if buffer is full * bridgev2: add option to auto-reconnect after unknown error (mautrix#394) * bridgev2/portal: add missing return * dependencies: update * Bump version to v0.24.2 * bridgev2/disappear: add limit to getting messages from the db * bridgev2/disappear: reduce disappear loop interval when there are lots of messages * bridgev2/disappear: always delete synchronously if limit is reached * bridgev2/disappear: make next check field atomic * bridgev2/portal: ignore delete for me in multi-user portals * bridgev2/portal: add support for following tombstones * bridgev2,appservice: add via to EnsureJoined and use it for tombstone handling * client: remove redundant state store update in room create * all: add support for creator power * event: use full event type for stripped state for MSC4311 * client: add custom room create ts field * client: allow using custom http client for .well-known resolution * bridgev2/queue: run command handlers in background * bridgev2/database: add method to mark backfill task as not done * event: replace soft failed field in unsigned * bridgev2/commands: allow canceling qr login * bridgev2/portal: fix adding rooms to personal space on create * bridgev2: add interface for getting arbitrary state event * bridgev2/portal: add bots to functional members in DMs * bridgev2: run PostStart in background * all: replace gorilla/mux with standard library * bridgev2/status: take context and http client in checkpoint SendHTTP * appservice/websocket: switch from gorilla to coder * bridgev2/portal: add todo * appservice/websocket: close writer after sending * all: fix trailing slash in subrouters * bridgev2/provisioning: move login step checks into handler * bridgev2/portal: return event ignored result for type unknown * bridgev2,federation,mediaproxy: enable http access logging * format/htmlparser: don't add link suffix if plaintext is only missing protocol Auto-linkification will add a protocol in the `href`, but usually won't touch the text part. We want to undo the linkification here since it doesn't carry any additional information. * client: log method/url when retrying requests * appservice/intent: don't download avatar before setting on hungry * bridgev2/matrix: don't send connecting bridge states to cloud * bridgev2/portal: include error in event handling results * bridgev2/cryptostore: add missing escape clause to not like * client: fix updating state store in CreateRoom * bridgev2/matrix: always clear mx_user_profile when deleting room * bridgev2/matrix: add hack for resyncing encryption state cache * event: add join_authorised_via_users_server to MemberEventContent (mautrix#395) Adds `JoinAuthorisedViaUsersServer` (`join_authorised_via_users_server`) to `MemberEventContent`, introduced in room version 8 * bridgev2/matrix: don't ensure joined for state resync * sqlstatestore: ensure empty room/user ids aren't stored in db * crypto/backup: allow encrypting session without private key * crypto: replace t.Fatal and t.Error with require and assert Signed-off-by: Sumner Evans <[email protected]> * id: move room version from event package and add flags * event: fix json tag in power levels * federation: extract VerifyJSON into subpackage * bridgev2: check that avatar mxc is set before ignoring update * dependencies: update go-util and use new UnsafeString helper * requests: add json un/marshaler for Direction rune * crypto: remove group session already shared error * event: add policy server spammy flag to unsigned * format/htmlparser: collapse spaces when parsing html * crypto/attachments: fix hash check when decrypting * crypto/attachments: hash correct data while decrypting * changelog: update * verificationhelper: use static format strings (mautrix#390) * dependencies: update * client: don't set user-agent header on wasm * Bump version to v0.25.0 * changelog: fix date * federation/pdu: add utilities for PDU generation and validation * ci: test goolm and jsonv2 * ci: disable gotestfmt in goolm It explodes with `panic: BUG: Empty package name encountered.` * federation/pdu: gate signing key validity check by room version * federation/pdu: fail on any signature check error * ci: fix more things * ci: move tags to correct place * ci: disable tests on goolm again * client,event: remove deprecated MSC2716 structs * federation/pdu: add method to convert to client event * federation/pdu: reorganize code and add methods to v1 struct * federation/pdu: add docs for GetKeyFunc * client: add method to download media thumbnail * federation/pdu: add more tests for signature checks * crypto/encryptmegolm: add fallback for copying `m.relates_to` * federation/pdu: refactor redaction to allow reuse of RedactContent * event,pushrules: replace assert.Nil with assert.NoError * event: implement disappearing timer types (mautrix#399) Co-authored-by: Tulir Asokan <[email protected]> * federation/pdu: add redacted member event * federation/pdu: add auth event selection * event: add json struct tag to third party signed object * federation/pdu: add server name parameter to GetKeyFunc * federation/pdu: use jsontext.Value instead of any for deprecated fields * format: add MarkdownMentionWithName helper * format: add MarkdownMentionRoomID helper * crypto/sqlstore: add index to make finding megolm sessions to backup faster (mautrix#402) ``` 2025-08-24T22:23:19Z debug [MatrixBridgeV2] {"level":"warn","component":"matrix","component":"client_loop","subcomponent":"sync_key_backup_loop","rows":0,"duration_seconds":1.046191042,"method":"EndRows","query":"SELECT room_id, sender_key, signing_key, session, forwarding_chains, ratchet_safety, received_at, max_age, max_messages, is_scheduled, key_backup_version FROM crypto_megolm_inbound_session WHERE account_id=?1 AND session IS NOT NULL AND key_backup_version != ?2","time":"2025-08-24T22:23:19.22077Z","message":"Query took long"} ``` before: ``` sqlite> EXPLAIN SELECT room_id, sender_key, signing_key, session, forwarding_chains, ratchet_safety, received_at, max_age, max_messages, is_scheduled, key_backup_version FROM crypto_megolm_inbound_session WHERE account_id='@brad:beeper.com/CHNWOJWEUC' AND sessi addr opcode p1 p2 p3 p4 p5 comment ---- ------------- ---- ---- ---- ------------- -- ------------- 0 Init 0 25 0 0 Start at 25 1 OpenRead 0 48 0 15 0 root=48 iDb=0; crypto_megolm_inbound_session 2 OpenRead 1 49 0 k(3,,,) 2 root=49 iDb=0; sqlite_autoindex_crypto_megolm_inbound_session_1 3 String8 0 1 0 @brad:beeper.com/CHNWOJWEUC 0 r[1]='@brad:beeper.com/CHNWOJWEUC' 4 SeekGE 1 24 1 1 0 key=r[1] 5 IdxGT 1 24 1 1 0 key=r[1] 6 DeferredSeek 1 0 0 0 Move 0 to 1.rowid if needed 7 Column 0 5 2 128 r[2]= cursor 0 column 5 8 IsNull 2 23 0 0 if r[2]==NULL goto 23 9 Column 0 14 2 0 r[2]=crypto_megolm_inbound_session.key_backup_version 10 Eq 3 23 2 BINARY-8 82 if r[2]==r[3] goto 23 11 Column 0 4 4 0 r[4]= cursor 0 column 4 12 Column 0 2 5 0 r[5]= cursor 0 column 2 13 Column 0 3 6 0 r[6]= cursor 0 column 3 14 Column 0 5 7 0 r[7]= cursor 0 column 5 15 Column 0 6 8 0 r[8]= cursor 0 column 6 16 Column 0 9 9 0 r[9]= cursor 0 column 9 17 Column 0 10 10 0 r[10]= cursor 0 column 10 18 Column 0 11 11 0 r[11]= cursor 0 column 11 19 Column 0 12 12 0 r[12]= cursor 0 column 12 20 Column 0 13 13 0 0 r[13]=crypto_megolm_inbound_session.is_scheduled 21 Column 0 14 14 0 r[14]=crypto_megolm_inbound_session.key_backup_version 22 ResultRow 4 11 0 0 output=r[4..14] 23 Next 1 5 0 0 24 Halt 0 0 0 0 25 Transaction 0 0 55 0 1 usesStmtJournal=0 26 Integer 1 3 0 0 r[3]=1 27 Goto 0 1 0 0 sqlite> SELECT COUNT(*) FROM crypto_megolm_inbound_session ; +----------+ | COUNT(*) | +----------+ | 168792 | +----------+ sqlite> SELECT COUNT(*) FROM crypto_megolm_inbound_session WHERE session IS NULL; +----------+ | COUNT(*) | +----------+ | 39 | +----------+ sqlite> SELECT COUNT(*) FROM crypto_megolm_inbound_session WHERE key_backup_version != 1; +----------+ | COUNT(*) | +----------+ | 39 | +----------+ ``` after: ``` sqlite> CREATE INDEX idx_megolm_filtered ...> ON crypto_megolm_inbound_session(account_id, key_backup_version, session); sqlite> EXPLAIN SELECT room_id, sender_key, signing_key, session, forwarding_chains, ratchet_safety, received_at, max_age, max_messages, is_scheduled, key_backup_version FROM crypto_megolm_inbound_session WHERE account_id='@brad:beeper.com/CHNWOJWEUC' AND session IS NOT NULL AND key_backup_version != 1; addr opcode p1 p2 p3 p4 p5 comment ---- ------------- ---- ---- ---- ------------- -- ------------- 0 Init 0 25 0 0 Start at 25 1 OpenRead 0 48 0 15 0 root=48 iDb=0; crypto_megolm_inbound_session 2 OpenRead 1 91264 0 k(4,,,,) 2 root=91264 iDb=0; idx_megolm_filtered 3 String8 0 1 0 @brad:beeper.com/CHNWOJWEUC 0 r[1]='@brad:beeper.com/CHNWOJWEUC' 4 SeekGE 1 24 1 1 0 key=r[1] 5 IdxGT 1 24 1 1 0 key=r[1] 6 DeferredSeek 1 0 0 0 Move 0 to 1.rowid if needed 7 Column 1 2 2 128 r[2]= cursor 1 column 2 8 IsNull 2 23 0 0 if r[2]==NULL goto 23 9 Column 1 1 2 0 r[2]=crypto_megolm_inbound_session.key_backup_version 10 Eq 3 23 2 BINARY-8 82 if r[2]==r[3] goto 23 11 Column 0 4 4 0 r[4]= cursor 0 column 4 12 Column 0 2 5 0 r[5]= cursor 0 column 2 13 Column 0 3 6 0 r[6]= cursor 0 column 3 14 Column 1 2 7 0 r[7]= cursor 1 column 2 15 Column 0 6 8 0 r[8]= cursor 0 column 6 16 Column 0 9 9 0 r[9]= cursor 0 column 9 17 Column 0 10 10 0 r[10]= cursor 0 column 10 18 Column 0 11 11 0 r[11]= cursor 0 column 11 19 Column 0 12 12 0 r[12]= cursor 0 column 12 20 Column 0 13 13 0 0 r[13]=crypto_megolm_inbound_session.is_scheduled 21 Column 1 1 14 0 r[14]=crypto_megolm_inbound_session.key_backup_version 22 ResultRow 4 11 0 0 output=r[4..14] 23 Next 1 5 0 0 24 Halt 0 0 0 0 25 Transaction 0 0 56 0 1 usesStmtJournal=0 26 Integer 1 3 0 0 r[3]=1 27 Goto 0 1 0 0 sqlite> ``` * bridgev2: merge mentions and url previews when merging caption * event: add third party invite state event content * bridgev2/portal: make UpdateDisappearingSetting more versatile * bridgev2/portal: always set timestamp for disappearing message timer update * bridgev2/portal: fix send notice option when updating disappearing message timer * bridgev2/networkinterface: add interface for handling disappearing timer changes from Matrix * bridgev2/matrix: fix encryption error notice not being redacted after retry success * sqlstatestore: fix GetPowerLevels returning non-nil even if power levels weren't found * bridgev2/portal: validate capabilities when updating disappearing timer * event: marshal zero disappearing timers as empty object * bridgev2/status: add avatar_keys to remote profile * event: allow omitting timers from disappearing timer capability * bridgev2/database: don't set disappearing timer content to nil * federation/eventauth: add v3-v12 event auth rules (mautrix#401) * federation/pdu: add cached event ID to internal metadata * federation/pdu: add extra field to internal metadata * bridgev2/status: use _file pattern for avatar instead of splitting url and keys * bridgev2/matrix: remove provisioning API prefix option Reverse proxy configuration should be used instead when adding prefixes to the path. Changing the path entirely is not recommended even with reverse proxies. Fixes mautrix#403 * bridgev2/provisioning: add minimum length for shared secret * pre-commit: ban `log.Str(x.String())` * bridgev2/matrixinterface: add GetEvent interface for linkedin reply (mautrix#406) Co-authored-by: Tulir Asokan <[email protected]> * bridgev2: move shared SNC code to provisionutil * bridgev2/provisionutil: allow passing mxids to ResolveIdentifier Closes mautrix#398 * bridgev2/status: change RemoteID to a UserLoginID * client: fix v3/delete_devices method (mautrix#393) * event: add types for MSC4332 * event: use RawMessage instead of map for bot command arguments * client: implement MSC4323 (mautrix#407) * bridgev2: add support for creating groups (mautrix#405) * appservice/websocket: override read limit * event: add is_animated flag from MSC4230 * bridgev2/provisioning: remove unused structs * appservice: maybe fix url template raw path for unix sockets * bridgev2/portal: add action message metadata to disappearing notices * client: stabilize arbitrary profile field support * crypto/decryptolm: add debug logs for failing to decrypt with new session * crypto/machine: log when loading olm account * crypto/libolm: clean up pointer management * crypto: log active driver * crypto/machine: allow canceling background context * crypto/register: don't use init in *olm packages * crypto/decryptolm: retry prekey decryption with goolm * crypto/machine: don't clear account on Destroy() * event: add org.matrix.msc3381.poll.end type (mautrix#412) * crypto/sqlstore: ignore unused sessions in olm unwedging * bridgev2/database: normalize disappearing settings before insert * client: stabilize support for state_after * Bump version to v0.25.1 * event/poll: add missing omitempty * bridgev2/portal: ensure state key is set when handling state events * bridgev2/provisioning: sync ghost info when searching (mautrix#413) * bridgev2/matrix: don't encrypt reactions in batch sends * responses: fix marshaling RespUserProfile * crypto/ssss: use constant time comparison when decrypting account data * event: add EventUnstablePollEnd to GuessClass() (mautrix#414) * bridgev2/portal: set exclude from timeline flag for creation state * bridgev2/portal: add support for implicit read receipts to network * federation/pdu: use option to trust internal metadata for GetEventID * bridgev2/portal: log if room create event is taking long * bridgev2/portal: also log long events when using async events * bridgev2: make split portal migration errors fatal * bridgev2: improve split portal migration * bridgev2: only delete rooms in split portal migration after starting connectors * bridgev2/portal: remove portal from cache if loading parent/relay fails * bridgev2: also fix portal parent receivers in split portal migration * bridgev2/portal: don't allow queuing events into uninitialized portals * crypto: add utilities for cross-signing * bridgev2/matrix: add config option to self-sign bot device * bridgev2/matrix: share device keys as part of e2ee init * changelog: update * error: Add RespError WithExtraData convenience function (mautrix#416) To dynamically build errors with extra keys like returning `max_delay` for `M_MAX_DELAY_EXCEEDED`. * client: add user directory search method * responses: fix RespSearchUserDirectory type * bridgev2/provisioning: fix login_id query param name * event: add beeper chat delete event * bridgev2: add interface for deleting chats from Matrix Closes mautrix#408 * bridgev2/portal: don't process any more events if portal is deleted * client: fix some footguns in compileRequest * add warning log if RequestBody is used without length instead of silently discarding the body * fix wrapping RequestBody in nopcloser * always set content length * bridgev2/portal: add temporary flag to slack bridge info To let clients detect that mautrix/slack@952806e is done * crypto/sqlstore: fix query used for olm unwedging * appservice/websocket: use io.ReadAll instead of json decoder * client: re-add support for unstable profile fields * crypto/verificationhelper: extract mockserver to new package * crypto/helper: always share keys when creating new device * crypto: don't check otk count if sharing new keys * crypto: add basic group session sharing benchmark * federation/eventauth: fix default power levels in pre-v12 rooms * federation/eventauth: fix checking user power level changes * federation/eventauth: fix gjson path construction in new power level check * federation/eventauth: change error message for users-specific power level check * bridgev2/mxmain: add option to mix calendar and semantic versioning * bridgev2/mxmain: move version calculation to go-util * version: find from build info if unset * version: initialize go.mod version regex lazily * bridgev2/database: fix split portal parent migration query * bridgev2,error: use NonNilClone instead of creating map manually * bridgev2/portal: add option to exclude member changes from timeline by default * bridgev2/portal: add option to exclude metadata changes from timeline * event: add helper to get remaining mute duration * bridgev2/portal: add exclude from timeline flag for not in chat leaves * bridgev2/mxmain: fix --version flag output * appservice/intent: add room ID to fake join response * bridgev2/simplevent: add simpler form of message event * bridgev2/simplevent: allow upserts with PreConvertedMessage * federation/eventauth: require that join authorizer is in the room * crypto/helper: don't block on decryption * changelog: update * event: add Clone method for file features * event: add Clone for other capability types too * bridgev2: add omitempty for group create params struct * id/userid: split validation into 2 functions * bridgev2/errors: add reason for unsupported errors * bridgev2/portal: enforce media duration and size limits * bridgev2/portal: don't send implicit read receipts for account data * changelog: update * bridgev2/provisionutil: validate user IDs in CreateGroup if network supports it * bridgev2/provisionutil: don't allow self in create group participants * crypto: Allow decrypting message content without event id or ts Replay attack prevention shouldn't store empty event id or ts to database if we're decrypting without them. This may happen if we are looking into a future delayed event for example as it doesn't yet have those. We still prevent doing that if we already know them meaning we have gotten the actual event through sync as that's also when a delayed event would move from scheduled to finalised and then it also contains those fields. * client,event: MSC4140: Delayed events Includes transparent migration from deprecated MSC fields still used in Synapse to later revision. * Bump version to v0.25.2 --------- Signed-off-by: Sumner Evans <[email protected]> Co-authored-by: Tulir Asokan <[email protected]> Co-authored-by: Matthias Kesler <[email protected]> Co-authored-by: timedout (aka nexy7574) <[email protected]> Co-authored-by: Sumner Evans <[email protected]> Co-authored-by: V02460 <[email protected]> Co-authored-by: Kishan Bagaria <[email protected]> Co-authored-by: Brad Murray <[email protected]> Co-authored-by: Ping Chen <[email protected]> Co-authored-by: fmseals <[email protected]> Co-authored-by: Tiago Loureiro <[email protected]> Co-authored-by: Toni Spets <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.