-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve secure-join message detection (#473)
- Loading branch information
Showing
5 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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
21 changes: 21 additions & 0 deletions
21
chatmaild/src/chatmaild/tests/mail-data/securejoin-vc-fake.eml
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Subject: Message from {from_addr} | ||
From: <{from_addr}> | ||
To: <{to_addr}> | ||
Date: Sun, 15 Oct 2023 16:43:25 +0000 | ||
Message-ID: <[email protected]> | ||
Chat-Version: 1.0 | ||
Secure-Join: vc-request | ||
Secure-Join-Invitenumber: RANDOM-TOKEN | ||
MIME-Version: 1.0 | ||
Content-Type: multipart/mixed; boundary="Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi" | ||
|
||
|
||
--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi | ||
Content-Type: text/plain; charset=utf-8 | ||
Buy viagra! | ||
--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi-- | ||
|
||
|
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Subject: Message from {from_addr} | ||
From: <{from_addr}> | ||
To: <{to_addr}> | ||
Date: Sun, 15 Oct 2023 16:43:25 +0000 | ||
Message-ID: <[email protected]> | ||
Chat-Version: 1.0 | ||
Secure-Join: vc-request | ||
Secure-Join-Invitenumber: RANDOM-TOKEN | ||
MIME-Version: 1.0 | ||
Content-Type: multipart/mixed; boundary="Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi" | ||
|
||
|
||
--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi | ||
Content-Type: text/plain; charset=utf-8 | ||
Secure-Join: vc-request | ||
--Gl92xgZjOShJ5PGHntqYkoo2OK2Dvi-- | ||
|
||
|
This file contains 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
check_armored_payload, | ||
check_encrypted, | ||
common_encrypted_subjects, | ||
is_securejoin, | ||
) | ||
|
||
|
||
|
@@ -55,6 +56,20 @@ def test_filtermail_no_encryption_detection(maildata): | |
assert not check_encrypted(msg) | ||
|
||
|
||
def test_filtermail_securejoin_detection(maildata): | ||
msg = maildata( | ||
"securejoin-vc.eml", from_addr="[email protected]", to_addr="[email protected]" | ||
) | ||
assert is_securejoin(msg) | ||
|
||
msg = maildata( | ||
"securejoin-vc-fake.eml", | ||
from_addr="[email protected]", | ||
to_addr="[email protected]", | ||
) | ||
assert not is_securejoin(msg) | ||
|
||
|
||
def test_filtermail_encryption_detection(maildata): | ||
for subject in common_encrypted_subjects: | ||
msg = maildata( | ||
|