Skip to content

Commit

Permalink
Replace subject with [...] for outgoing mail
Browse files Browse the repository at this point in the history
`authclean` cleanup server is used by
reinjecting smtpd running on localhost:10025 by default.
It runs after filtermail
and currently removes `Received` header
to avoid leaking IP address.
Can as well be used to replace `Subject` lines
with `Subject: [...]`.
If there are multiple `Subject` lines,
all of them should be replaced.

This allows us to avoid dealing with
localized subjects, including SecureJoin
messages `vc-request` and `vg-request`
which can have Subject lines like
Subject: =?utf-8?q?Nachricht_von_nrn178fi4=40nine=2Etestrun=2Eorg?=
  • Loading branch information
link2xt committed Jan 29, 2025
1 parent 4d915f9 commit 7fe2f3a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 75 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- improve secure-join message detection
([#473](https://github.com/deltachat/chatmail/pull/473))

- replace `Subject` with `[...]` for all outgoing mails.

## 1.5.0 2024-12-20

- cmdeploy dns: always show recommended DNS records
Expand Down
59 changes: 0 additions & 59 deletions chatmaild/src/chatmaild/common_encrypted_subjects.py

This file was deleted.

3 changes: 0 additions & 3 deletions chatmaild/src/chatmaild/filtermail.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from aiosmtpd.controller import Controller

from .common_encrypted_subjects import common_encrypted_subjects
from .config import read_config


Expand Down Expand Up @@ -128,8 +127,6 @@ def check_encrypted(message):
"""
if not message.is_multipart():
return False
if message.get("subject") not in common_encrypted_subjects:
return False
if message.get_content_type() != "multipart/encrypted":
return False
parts_count = 0
Expand Down
20 changes: 7 additions & 13 deletions chatmaild/src/chatmaild/tests/test_filtermail.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
SendRateLimiter,
check_armored_payload,
check_encrypted,
common_encrypted_subjects,
is_securejoin,
)

Expand Down Expand Up @@ -71,18 +70,13 @@ def test_filtermail_securejoin_detection(maildata):


def test_filtermail_encryption_detection(maildata):
for subject in common_encrypted_subjects:
msg = maildata(
"encrypted.eml",
from_addr="[email protected]",
to_addr="[email protected]",
subject=subject,
)
assert check_encrypted(msg)

# if the subject is not a known encrypted subject value, it is not considered ac-encrypted
msg.replace_header("Subject", "Click this link")
assert not check_encrypted(msg)
msg = maildata(
"encrypted.eml",
from_addr="[email protected]",
to_addr="[email protected]",
subject="Subject does not matter, will be replaced anyway",
)
assert check_encrypted(msg)


def test_filtermail_no_literal_packets(maildata):
Expand Down
1 change: 1 addition & 0 deletions cmdeploy/src/cmdeploy/postfix/submission_header_cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/^X-Originating-IP:/ IGNORE
/^X-Mailer:/ IGNORE
/^User-Agent:/ IGNORE
/^Subject:/ REPLACE Subject: [...]

0 comments on commit 7fe2f3a

Please sign in to comment.