Skip to content

Commit 62dba65

Browse files
committed
fix: do not send Secure-Join-Group in vg-request
Secure-Join-Group is only expected by old core in vg-request-with-auth. There is no reason to leak group ID in unencrypted vg-request. Besides that, Secure-Join-Group is deprecated as Alice knows Group ID corresponding to the auth code, so the header can be removed completely eventually.
1 parent 499f36c commit 62dba65

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub enum Param {
8787
/// `Secure-Join-Fingerprint` header for `{vc,vg}-request-with-auth` messages.
8888
Arg3 = b'G',
8989

90-
/// For Messages
90+
/// Deprecated `Secure-Join-Group` header for messages.
9191
Arg4 = b'H',
9292

9393
/// For Messages

src/securejoin.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,14 @@ mod tests {
11251125
assert_eq!(msg.get_header(HeaderDef::SecureJoin).unwrap(), "vg-request");
11261126
assert!(msg.get_header(HeaderDef::SecureJoinInvitenumber).is_some());
11271127

1128+
// Old Delta Chat core sent `Secure-Join-Group` header in `vg-request`,
1129+
// but it was only used by Alice in `vg-request-with-auth`.
1130+
// New Delta Chat versions do not use `Secure-Join-Group` header at all
1131+
// and it is deprecated.
1132+
// Now `Secure-Join-Group` header
1133+
// is only sent in `vg-request-with-auth` for compatibility.
1134+
assert!(msg.get_header(HeaderDef::SecureJoinGroup).is_none());
1135+
11281136
// Step 3: Alice receives vg-request, sends vg-auth-required
11291137
alice.recv_msg(&sent).await;
11301138

src/securejoin/bobstate.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,21 @@ async fn send_handshake_message(
378378
// Sends our own fingerprint in the Secure-Join-Fingerprint header.
379379
let bob_fp = load_self_public_key(context).await?.fingerprint();
380380
msg.param.set(Param::Arg3, bob_fp.hex());
381+
382+
// Sends the grpid in the Secure-Join-Group header.
383+
//
384+
// `Secure-Join-Group` header is deprecated,
385+
// but old Delta Chat core requires that Alice receives it.
386+
//
387+
// Previous Delta Chat core also sent `Secure-Join-Group` header
388+
// in `vg-request` messages,
389+
// but it was not used on the receiver.
390+
if let QrInvite::Group { ref grpid, .. } = invite {
391+
msg.param.set(Param::Arg4, grpid);
392+
}
381393
}
382394
};
383395

384-
// Sends the grpid in the Secure-Join-Group header.
385-
if let QrInvite::Group { ref grpid, .. } = invite {
386-
msg.param.set(Param::Arg4, grpid);
387-
}
388-
389396
chat::send_msg(context, chat_id, &mut msg).await?;
390397
Ok(())
391398
}

0 commit comments

Comments
 (0)