feat: protect Autocrypt header

This commit is contained in:
link2xt
2025-08-12 22:11:05 +00:00
committed by l
parent 9826c28581
commit 5256013615
6 changed files with 7 additions and 54 deletions

View File

@@ -217,10 +217,12 @@ async fn test_aeap_replay_attack() -> Result<()> {
// Fiona gets the message, replaces the From addr...
let sent = sent
.payload()
.replace("From: <alice@example.org>", "From: <fiona@example.net>")
.replace("addr=alice@example.org;", "addr=fiona@example.net;");
.replace("From: <alice@example.org>", "From: <fiona@example.net>");
sent.find("From: <fiona@example.net>").unwrap(); // Assert that it worked
sent.find("addr=fiona@example.net;").unwrap(); // Assert that it worked
// Autocrypt header is protected, nothing to replace outside.
// In the signed part we cannot replace it without breaking the signature.
assert!(!sent.contains("addr=alice@example.org;"));
tcm.section("Fiona replaced the From addr and forwards the message to Bob");
receive_imf(&bob, sent.as_bytes(), false).await?.unwrap();