Commit Graph

1487 Commits (master)

Author SHA1 Message Date
Tulir Asokan 3bd42f5a82 Add option to disable tracking megolm session ratchet state
The tracking is meant for bridges/bots that want to delete old ratchet states
after they're not needed, but for normal clients it's just unnecessary overhead
2024-05-16 17:14:13 +03:00
Tulir Asokan 654b82ec73 Update dependencies 2024-05-16 16:04:51 +03:00
Sumner Evans 3651e46c1e
ShareGroupSession: return error in more cases
* If getting the devices from the database fails
* If FetchKeys fails
* If createOutboundSessions fails

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 22:39:58 -06:00
Sumner Evans de0347db00
crypto: fix usages of Store interface
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:47:45 -06:00
Sumner Evans a87716a358
crypto/store: don't rely on sender key for storing and lookups
* Fixes compatibility with the Store interface
* Increases the usage of "defer"s for "gs.lock.Unlock" and
  "gs.lock.RUnlock"
* Increases the usage of "golang.org/x/exp/maps"

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:47:35 -06:00
Sumner Evans d0de43f395
crypto/sql_store: don't take sender key on group session methods
Fixes compatibility with the Store interface.

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Sumner Evans b31dbb0bd0
store: update interface to not take sender key
According to
https://spec.matrix.org/latest/client-server-api/#mmegolmv1aes-sha2,
clients MUST NOT store or lookup sessions using the sender key.

This commit removes the sender key from most of the functions related to
putting and getting group sessions from the Store interface. Notably,
RedactGroupSessions still accepts a sender key because it's meant for
batch deletion of group sessions.

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Sumner Evans 34ef1b3705
crypto/sql_store: don't check sender_key in GetGroupSession
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Sumner Evans 5490cc6aee
crypto/sql_store: add logging on PutGroupSession
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 12:32:57 -06:00
Nick Mills-Barrett 78f5e4373b Pass error to `Client.ResponseHook` 2024-05-14 19:01:51 +01:00
Sumner Evans 0439180737
crypto/sql_store: fix a couple places where the error value is unused
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-14 10:32:11 -06:00
Sumner Evans d10103dcf5
crypto/encryptmegolm: return error if sharing outbound session fails
This allows us to catch and throw "database is locked" errors. This will
ensure that if saving the key fails, then we won't share the key out to
anyone.

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-13 21:47:45 -06:00
Sumner Evans 01fde7d9a8
verificationhelper/StartVerification: actually set devices after FetchKeys
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-13 15:42:51 -06:00
Sumner Evans c0e030fc85
crypto/olm: remove Signatures definition
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-05-12 18:10:48 -06:00
Sumner Evans 2810465ef2
verificationhelper: ensure that the keys are fetched before starting
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-04-25 09:40:57 -06:00
Malte E 6cc490d9ab
check ghost != nil in correct line (#208) 2024-04-21 15:22:26 +02:00
Sumner Evans ff9e2e0f1d
machine/ShareKeys: save keys before sending server request in case it fails
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-04-19 08:47:36 -06:00
Tulir Asokan a19dab1897 Bump version to v0.18.1 2024-04-16 13:57:50 +03:00
Tulir Asokan 423d32ddf6 Add real context to HTML parser context struct 2024-04-13 13:57:30 +03:00
Malte E 640086dbf9
Fix default prevContent in bridge membership event handler (#204) 2024-04-05 02:27:36 +03:00
Toni Spets 898b235a84 Allow overriding http.Client with FullRequest 2024-04-02 13:59:48 +03:00
Toni Spets 64cc843952 Invalidate memory cache when storing own cross-signing keys
When another device does cross-signing reset we would incorrectly
cache the old keys indefinitely.
2024-04-02 13:59:07 +03:00
Toni Spets 0095e1fb78 Assume the device list is up-to-date on key backup restore
Fetching devices in a loop can cause request storming if there's a lot
of unknown signatures for a key backup.

A client implementation should always ensure that the devices are
updated from device list changed updates from sync.
2024-03-28 10:42:29 +02:00
Tulir Asokan ade00e8603
Merge pull request #193 from maltee1/join_rule
Join Rule & (Un)ban handling & Knock handling
2024-03-22 20:04:08 +02:00
Toni Spets 9fe66581e5 Check that shared IGS has higher index than stored
Copies the logic from key import.
2024-03-18 13:17:54 +02:00
Adam Van Ymeren 4dd7adc7be
Merge pull request #200 from beeper/adam/hsorder
Fix Unsigned.IsEmpty() when all we have is HSOrder
2024-03-16 11:41:48 -07:00
Adam Van Ymeren 8ba307b28d Fix Unsigned.IsEmpty() when all we have is HSOrder 2024-03-16 11:36:58 -07:00
Tulir Asokan 5dedc9806a Bump version to v0.18.0 2024-03-16 12:55:53 +02:00
Malte E b556d65da9 add handler for accepting/rejecting/retracting invites 2024-03-15 22:29:33 +01:00
Toni Spets fad4448ab7 Use a callback to receive secret response
To properly receive and store a requested secret, we usually need to
validate it against something like a public key to ensure we got the
correct one.

This changes the API so that we instead use a callback to receive any
incoming secret matching our request but we'll fail when we hit the
specified timeout if we never receive anything that is accepted.
2024-03-15 15:12:56 +02:00
Tulir Asokan a7bf485893 Update changelog 2024-03-13 21:23:04 +02:00
Tulir Asokan 20fde3d163 Remove error in ParseCommonIdentifier 2024-03-13 17:01:07 +02:00
Tulir Asokan 5224780563 Split UserID.Parse into generic ParseCommonIdentifier 2024-03-13 16:57:16 +02:00
Toni Spets f0b728f502 Require OGS update to succeed during EncryptMegolmEvent
Otherwise we could end up reusing the same ratchet multiple times.
2024-03-13 11:19:49 +02:00
Tulir Asokan 8128b00e00
Add key server that passes the federation tester (#197) 2024-03-12 21:15:39 +02:00
Brad Murray 08397c8b9a
Fix responding to m.secret.request messages (#195) 2024-03-11 18:50:06 -04:00
Tulir Asokan 94246ffc85 Drop maulogger support 2024-03-11 20:36:06 +02:00
Sumner Evans 2728a8f8aa
olm/pk: add fuzz test for the Sign function
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-03-11 09:00:11 -06:00
Sumner Evans 3b65d98c0c
olm/pk: make an interface
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-03-11 09:00:11 -06:00
Tulir Asokan d18dcfc7eb Update dependencies 2024-03-11 15:37:57 +02:00
Toni Spets a36f60a4f3 Parse Beeper inbox preview event in sync 2024-03-11 12:35:55 +02:00
Tulir Asokan 311a20cea9 Update CHANGELOG.md 2024-03-10 20:34:59 +02:00
Tulir Asokan 1423650a29 Don't use UIA wrapper for appservice user registrations 2024-03-10 20:34:52 +02:00
Malte E db41583fdd add knock handling 2024-03-10 13:47:09 +01:00
Malte E 41dfb40064 add ban/unban handling 2024-03-09 21:17:27 +01:00
Malte E 6b1a039beb add join rule handler 2024-03-09 20:34:47 +01:00
Malte E b8e4202c0f
Add handler for power levels in bridges (#189) 2024-03-09 16:33:09 +02:00
Sumner Evans a6b4b3bf34
ci: run tests with goolm as well
Co-authored-by: Tulir Asokan <tulir@maunium.net>
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-03-08 15:40:43 -07:00
Sumner Evans 284ab0d62c
olm: remove SHA256 base64 utility
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-03-08 14:04:19 -07:00
Sumner Evans a10c114203
verification: remove (go)olm SAS code
Signed-off-by: Sumner Evans <sumner@beeper.com>
2024-03-08 13:24:16 -07:00