-
-
Notifications
You must be signed in to change notification settings - Fork 120
feat: Securejoin v3, encrypt all securejoin messages #7754
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
Open
Hocuri
wants to merge
38
commits into
main
Choose a base branch
from
hoc/securejoin-v3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c0b86f5
Send v=3 in QR codes
Hocuri ad584d2
[wip, not compiling] Add render_symm_encrypted_securejoin_message()
Hocuri 3b66611
[wip, not compiling] extract function group_headers_by_confidentiality()
Hocuri 2025e9b
[wip, doesn't compile] refactor: exctract add_headers_to_encrypted_pa…
Hocuri 2eba552
[wip, doesn't compile] fix: Set subject for securejoin message
Hocuri 2566c5b
[wip, doesn't compile] Extract render_outer_message() functions
Hocuri 1014bf1
It compiles
Hocuri c91b349
feat: Decrypt and answer on Alice's side (sending the message seems n…
Hocuri 4c00bc1
Fix some bugs when sending vc-pubkey, decrypt vc-pubkey on Bob's side
Hocuri d979938
Handle vc-pubkey on Bob's side
Hocuri c9bd5d0
Adapt some tests
Hocuri c3d4c43
fix: Don't leak cryptographic identity by signing vc-request-pubkey
Hocuri 7ff5cd6
fix: Don't limit number of auth tokens to 1
Hocuri 297c6d8
modify test
Hocuri 2358c9d
Update golden tests
Hocuri 90b0f94
Make the remaining Rust tests pass
Hocuri aceb75b
Update src/mimeparser.rs
Hocuri 8ee3c2a
Add failing test test_auth_token_is_synchronized()
Hocuri 6b658a0
fix: Synchronize all AUTH tokens
Hocuri db7e667
Merge remote-tracking branch 'origin/main' into hoc/securejoin-v3
Hocuri 20ef54b
bench: Also add auth tokens into benchmark
Hocuri 50eb923
bench: Add black_box
Hocuri 1b25853
bench: Remove benchmarks that only decrypt without parsing
Hocuri 61ae743
perf: Only load shared secrets if the message actually is symm-encrypted
Hocuri 7a81411
perf: Load BobState shared secrets first; refactor: extract fn load_s…
Hocuri a442077
Add explanatory performance comment
Hocuri cca6bd4
Remove TODO
Hocuri 642ba1d
feat: Make it possible to omit the invitenumber and v=3 for Securejoi…
Hocuri b5ae93c
test: Test that securejoin v3 runs even without `v=3` when there is n…
Hocuri 80db501
test: Test that Securejoin without v=3 and without INVITENUMBER also …
Hocuri 81d9fa7
fix: For future-compatibility, don't rely on Invite for checking whet…
Hocuri e773468
fix: Don't save empty tokens
Hocuri 0e359e9
Improve comment
Hocuri 46c9fc3
feat: Remove Auto-Submitted: auto-replied header from securejoin mess…
Hocuri 10933cc
test: Improve test
Hocuri fd61423
Some more comments improvements
Hocuri 0d47a52
More comments and renamings
Hocuri 3b0f798
Merge remote-tracking branch 'origin/main' into hoc/securejoin-v3
Hocuri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2731,27 +2731,24 @@ async fn test_broadcast_members_cant_see_each_other() -> Result<()> { | |
| join_securejoin(charlie, &qr).await.unwrap(); | ||
|
|
||
| let request = charlie.pop_sent_msg().await; | ||
| assert_eq!(request.recipients, "alice@example.org charlie@example.net"); | ||
| assert_eq!(request.recipients, "alice@example.org"); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first two messages of the protocol aren't sent to self anymore, because in many cases, one's own other devices wouldn't be able to decrypt them, anyways. |
||
|
|
||
| alice.recv_msg_trash(&request).await; | ||
| } | ||
|
|
||
| tcm.section("Alice sends auth-required"); | ||
| tcm.section("Alice sends vc-pubkey"); | ||
| { | ||
| let auth_required = alice.pop_sent_msg().await; | ||
| assert_eq!( | ||
| auth_required.recipients, | ||
| "charlie@example.net alice@example.org" | ||
| ); | ||
| let parsed = charlie.parse_msg(&auth_required).await; | ||
| assert!(parsed.get_header(HeaderDef::AutocryptGossip).is_some()); | ||
| assert!(parsed.decoded_data_contains("charlie@example.net")); | ||
| let vc_pubkey = alice.pop_sent_msg().await; | ||
| assert_eq!(vc_pubkey.recipients, "charlie@example.net"); | ||
| let parsed = charlie.parse_msg(&vc_pubkey).await; | ||
| assert!(parsed.get_header(HeaderDef::AutocryptGossip).is_none()); | ||
| assert_eq!(parsed.decoded_data_contains("charlie@example.net"), false); | ||
| assert_eq!(parsed.decoded_data_contains("bob@example.net"), false); | ||
|
|
||
| let parsed_by_bob = bob.parse_msg(&auth_required).await; | ||
| let parsed_by_bob = bob.parse_msg(&vc_pubkey).await; | ||
| assert!(parsed_by_bob.decrypting_failed); | ||
|
|
||
| charlie.recv_msg_trash(&auth_required).await; | ||
| charlie.recv_msg_trash(&vc_pubkey).await; | ||
| } | ||
|
|
||
| tcm.section("Charlie sends request-with-auth"); | ||
|
|
@@ -2992,9 +2989,8 @@ async fn test_broadcast_recipients_sync1() -> Result<()> { | |
| alice1.recv_msg_trash(&request).await; | ||
| alice2.recv_msg_trash(&request).await; | ||
|
|
||
| let auth_required = alice1.pop_sent_msg().await; | ||
| charlie.recv_msg_trash(&auth_required).await; | ||
| alice2.recv_msg_trash(&auth_required).await; | ||
| let vc_pubkey = alice1.pop_sent_msg().await; | ||
| charlie.recv_msg_trash(&vc_pubkey).await; | ||
|
|
||
| let request_with_auth = charlie.pop_sent_msg().await; | ||
| alice1.recv_msg_trash(&request_with_auth).await; | ||
|
|
@@ -3299,14 +3295,17 @@ async fn test_broadcast_joining_golden() -> Result<()> { | |
| .await; | ||
|
|
||
| let alice_bob_contact = alice.add_or_lookup_contact_no_key(bob).await; | ||
| let private_chat = ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact.id) | ||
| .await? | ||
| .unwrap(); | ||
| // The 1:1 chat with Bob should not be visible to the user: | ||
| assert_eq!(private_chat.blocked, Blocked::Yes); | ||
| assert!( | ||
| ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact.id) | ||
| .await? | ||
| .is_none() | ||
| ); | ||
| let private_chat_id = | ||
| ChatId::create_for_contact_with_blocked(alice, alice_bob_contact.id, Blocked::Not).await?; | ||
| alice | ||
| .golden_test_chat( | ||
| private_chat.id, | ||
| private_chat_id, | ||
| "test_broadcast_joining_golden_private_chat", | ||
| ) | ||
| .await; | ||
|
|
@@ -3583,16 +3582,13 @@ async fn test_leave_broadcast_multidevice() -> Result<()> { | |
| join_securejoin(bob0, &qr).await.unwrap(); | ||
|
|
||
| let request = bob0.pop_sent_msg().await; | ||
| assert_eq!(request.recipients, "alice@example.org bob@example.net"); | ||
| assert_eq!(request.recipients, "alice@example.org"); | ||
|
|
||
| alice.recv_msg_trash(&request).await; | ||
| let auth_required = alice.pop_sent_msg().await; | ||
| assert_eq!( | ||
| auth_required.recipients, | ||
| "bob@example.net alice@example.org" | ||
| ); | ||
| let vc_pubkey = alice.pop_sent_msg().await; | ||
| assert_eq!(vc_pubkey.recipients, "bob@example.net"); | ||
|
|
||
| bob0.recv_msg_trash(&auth_required).await; | ||
| bob0.recv_msg_trash(&vc_pubkey).await; | ||
| let request_with_auth = bob0.pop_sent_msg().await; | ||
| assert_eq!( | ||
| request_with_auth.recipients, | ||
|
|
@@ -3608,7 +3604,7 @@ async fn test_leave_broadcast_multidevice() -> Result<()> { | |
| assert_eq!(rcvd.param.get_cmd(), SystemMessage::MemberAddedToGroup); | ||
|
|
||
| tcm.section("Bob's second device also receives these messages"); | ||
| bob1.recv_msg_trash(&auth_required).await; | ||
| bob1.recv_msg_trash(&vc_pubkey).await; | ||
| bob1.recv_msg_trash(&request_with_auth).await; | ||
| bob1.recv_msg(&member_added).await; | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
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.
I removed the "Decrypt a symmetrically/public-key encrypted message" benchmarks, because I don't need them anymore, it seems unlikely they will be needed soon, and they made it hard to implement the performance improvement in 61ae743