fix: verify_server_keys_response fails on non-standard json fields #2415
No reviewers
Labels
No labels
Abandoned
Blocked
Bug
Changelog
Added
Changelog
Missing
Changelog
None
Cherry-picking
Compliance
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Merge
Merge/Manual
Merge/Squash
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
bob the builder
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
continuwuation/continuwuity!2415
Loading…
Reference in a new issue
No description provided.
Delete branch "hexchen/continuwuity:push-wkvumosuykpx"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Previously
verify_server_keys_responsewould work with re-serializedServerSigningKeys, which drops any extra, non-standard fields from the
origin server response. The signature is made over the whole response
though, meaning that any response including extra fields will not pass
signature verification.
Fixes: #2407
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
1e4221389c97703741319770374131c52456063aThis is generally fine but I don't like how we still pass around both versions of the value, and also ultimately end up storing the deserialised value that may have been stripped of unknown keys. I'll push the changes I want to your branch, then i think it'll be fine to merge
c52456063a42b203acceEnded up carrying around the raw and deserialised value everywhere anyway, but this seems like a non-evil middleground solution that achieves the original goal of ensuring the original raw content isn't lost between receive time and storage time (and beyond)
@ -0,0 +1 @@Fix remote server key signature verification when extra fields exist. Contributed by @hexchenbugfix
@ -38,3 +38,4 @@continue;}let trusted = services.config.trusted_servers.iter().any(|notary| {// Re-verifying here rejects any key that passes extra,stale comment no ?
@ -58,2 +83,4 @@/// `notary` must either be empty or have ONE entry. Extraneous notaries/// will be ignored.////// `raw_server_keys` must be the response exactly as received. Signaturesstale comment ?
d6840a865aa2cfac976da2cfac976d09dd134310this kind of sucks but if it works I can't complain that much