Skip to content
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: Log the received device keys on an encrypted olm message #3919

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Aug 30, 2024

MSC4147 adds a device_keys property to the plaintext content of encrypted to-device events, and support for picking this out was added in #3556/#3633.

Turns out it's quite handy to log this information.

The output of this is something like:

2024-08-30T14:40:27.061681Z DEBUG receive_sync_changes:receive_to_device_event{sender="@alice:example.org" event_type="m.room.encrypted" message_id="01J6HVNZXBPF860R0TBH3H75KZ"}:handle_decrypted_to_device_event{sender_key="curve25519:CpEg1cKt2OiASokDD23L9/buqT7LAkcUEVaFXaBSCFU" event_type="m.room_key"}: matrix_sdk_crypto::machine: Received a decrypted to-device event sender_device_keys=(Some("curve25519:CpEg1cKt2OiASokDD23L9/buqT7LAkcUEVaFXaBSCFU"), Some("ed25519:aEMaB1+jf3tzIRdyNzI514m1czCra9W23JwYXho27iw"))

@richvdh richvdh requested review from a team as code owners August 30, 2024 14:58
@richvdh richvdh requested review from bnjbvr and BillCarsonFr and removed request for a team August 30, 2024 14:58
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.16%. Comparing base (224292a) to head (536891a).
Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
...rates/matrix-sdk-crypto/src/types/events/olm_v1.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3919      +/-   ##
==========================================
+ Coverage   84.13%   84.16%   +0.02%     
==========================================
  Files         266      266              
  Lines       28008    28015       +7     
==========================================
+ Hits        23565    23578      +13     
+ Misses       4443     4437       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for the Rust side, still needs some crypto review to validate it's OK to include this info in rageshakes/logs.

crates/matrix-sdk-crypto/src/machine/mod.rs Show resolved Hide resolved
@andybalaam
Copy link
Member

These keys are safe to log because they are public keys: anyone who shares a room with the user can find them proactively by making /keys/query request.

This seems potentially dangerous because they are included in the encrypted content of the event, but the MSC mentions that they are public information and could just as easily have been included in the cleartext.

@andybalaam andybalaam self-requested a review September 2, 2024 14:14
@richvdh richvdh merged commit ca42657 into main Sep 2, 2024
39 checks passed
@richvdh richvdh deleted the rav/log_received_device_keys branch September 2, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants