-
Notifications
You must be signed in to change notification settings - Fork 269
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
crypto: fix BackedUpRoomKey de/serialization #3246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left some small suggestions.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3246 +/- ##
==========================================
- Coverage 83.62% 83.62% -0.01%
==========================================
Files 236 236
Lines 24451 24451
==========================================
- Hits 20447 20446 -1
- Misses 4004 4005 +1 ☔ View full report in Codecov by Sentry. |
c8e737b
to
4b201a9
Compare
AFAICT this is a fix to deserialization, not serialization. I have updated the PR title accordingly. |
Hrm ok. Serialisation doesn't appear to be tested; and the bug it clams to fix (#3247), and the description of the PR, only mention deserialisation. Hence my confusion. Any idea what the effect of this issue would have been on serialization? Presumably the |
Yes, all of that is correct. It would not base64 encode the keys, it would instead create a 32 byte long array. I'm not completely sure, but I think it didn't matter as the SDK doesn't really use the forwarding chain, I would need to look at the codepaths where we receive room keys. |
For links: the fact that deserialization errors were swallowed was a separate problem, seemingly fixed in #3149. |
Fixes #3247
A source of #3197
When downloading keys if the
forwarding_curve25519_key_chain
contains items the deserialisation would fail witherror: Json(Error("invalid type: string \"EQCtWSJclhxEU9mGlF4erDHxIacpUQz70yjYVRPODTg\", expected an array of length 32", line: 1, column: 255))
As a consequence the key import fails silently with:
Successfully imported room keys total_count=0 imported_count=0 room_keys={}
That would cause unable to decrypt errors for history.
A serde attribute
deserialize_curve_key_vec
was missing.Signed-off-by: