Author SHA1 Message Date
Rsclub2_2 89538ed67c Fallseite bei gescheitertem Scan und Schnappschuss bei untypischen Elementen 2026-11-15 03:23:22 +01:00
Rsclub2_2 95a23c0e45 Befunde der Abschlussprüfung behoben 2026-11-15 03:02:45 +01:00
Rsclub2_2 7bd3498501 Agent: Befunde aus der Nachprüfung behoben 2026-11-15 02:28:48 +01:00
Rsclub2_2 6556087cf2 Agent: Befunde aus dem Review der Browser-Schleife behoben 2026-11-15 02:06:41 +01:00
Rsclub2_2 7e50983d85 Agent: Sicherheitskern gehärtet (Adressfilter, Protokoll, Modellzugang) 2026-11-15 01:26:35 +01:00
Rsclub2_2 181eab40fb Agent: Browser-Schleife, HTTP-Dienst und Image 2026-11-15 01:15:50 +01:00
Rsclub2_2 6df39d6b93 Fall-Ansicht, Zeitlauf und Übergabe an den Agenten verdrahtet 2026-11-15 00:47:15 +01:00
Rsclub2_2 249293f382 Fallschlüssel auch bei Message-ID mit Sonderzeichen bilden 2026-11-15 00:46:12 +01:00
Rsclub2_2 57b93cefff Zeitlauf: Befunde aus dem Review behoben 2026-11-15 00:43:51 +01:00
Rsclub2_2 65c09d96e8 Zeitlauf: Fälle finden, an den Agenten geben, verschieben, aufräumen 2026-11-15 00:40:20 +01:00
Rsclub2_2 c7b054a3bb Weiterleiter-Adresse nur übernehmen, wenn sie wohlgeformt ist 2026-11-15 00:39:38 +01:00
Rsclub2_2 7f2b317dad Agent: Protokoll mit dem Modell und Modellzugang 2026-11-14 23:35:09 +01:00
Rsclub2_2 d546f82313 Agent: Adressfilter und Seitenprüfungen ohne Modell 2026-11-14 23:35:09 +01:00
Rsclub2_2 9b87962174 Empfängeradresse aus der weitergeleiteten Mail bestimmen 2026-11-14 23:31:57 +01:00
Rsclub2_2 f6a2f6c812 Fall-Tabelle für den Abmelde-Agenten 2026-11-14 23:31:20 +01:00
5 changed files with 4 additions and 40 deletions

No files matched your search

+1 -1
View File
@@ -6,4 +6,4 @@ EMAIL_SERVER=example.com
# DATA_DIR=/data # DATA_DIR=/data
# AGENT_URL=http://unsubscriber-agent:8080 # AGENT_URL=http://unsubscriber-agent:8080
# AGENT_ALLOWED_DOMAINS=example.org,gmail.com # AGENT_ALLOWED_DOMAINS=example.org,gmail.com
# AGENT_ALLOWED_SENDERS=example.org,jens@gmail.com # AGENT_ALLOWED_SENDERS=jens@example.org
+1 -3
View File
@@ -56,9 +56,7 @@ of entries: a bare domain (`wagnersnetz.de`) allows every address of that domain
as full addresses, never their domain: the recipient is read from the forwarded text, and a newsletter body with a as full addresses, never their domain: the recipient is read from the forwarded text, and a newsletter body with a
line like `To: stranger@gmail.com` would otherwise make the agent type a stranger's address. line like `To: stranger@gmail.com` would otherwise make the agent type a stranger's address.
`AGENT_ALLOWED_SENDERS` (comma separated) lists the forwarders whose mails become cases; mails from other `AGENT_ALLOWED_SENDERS` (comma separated) lists the forwarders whose mails become cases; mails from other
senders are ignored. Entries work as above: a bare domain allows every sender of that domain (not of its senders are ignored. With the agent on and an empty list nothing is processed.
subdomains), a full address exactly that sender. Use a domain only for domains whose mail you control, since the
From header decides. With the agent on and an empty list nothing is processed.
The agent container needs `LLM_BASE_URL` (Open WebUI, `/api/chat/completions` is appended), `LLM_MODEL`, The agent container needs `LLM_BASE_URL` (Open WebUI, `/api/chat/completions` is appended), `LLM_MODEL`,
`LLM_API_KEY` and `BLOCKED_NETS`, optionally `MAX_STEPS` (20) and `CASE_TIMEOUT` (300). `BLOCKED_NETS` is required: `LLM_API_KEY` and `BLOCKED_NETS`, optionally `MAX_STEPS` (20) and `CASE_TIMEOUT` (300). `BLOCKED_NETS` is required:
-8
View File
@@ -18,14 +18,6 @@ def _allowed(address: str, entries) -> bool:
return address in entries or address.rsplit("@", 1)[-1] in entries # a domain entry never contains "@" return address in entries or address.rsplit("@", 1)[-1] in entries # a domain entry never contains "@"
def sender_allowed(address: str, entries) -> bool:
"""Whether a forwarder (the address of the From header) is on the list; entries as in _allowed. Anything that
is not one plain address is refused, so that odd forms like "@allowed.example" or a quoted local part cannot
pass by their last part."""
address = address.lower()
return bool(_ADDRESS.fullmatch(address)) and _allowed(address, entries)
def original_recipient(text: str, forwarder: str, allowed_domains) -> str: def original_recipient(text: str, forwarder: str, allowed_domains) -> str:
"""First allowed address from the quoted 'To:'/'An:' lines, else the forwarder, else ''. """First allowed address from the quoted 'To:'/'An:' lines, else the forwarder, else ''.
-26
View File
@@ -296,32 +296,6 @@ def test_mail_from_unknown_sender_is_ignored(store):
assert store.get("<evil@x>") is None and b"2" in imap.folders["INBOX"] assert store.get("<evil@x>") is None and b"2" in imap.folders["INBOX"]
def test_sender_entry_without_at_allows_the_whole_domain(store):
imap = FakeIMAP({b"1": mail_bytes("<a@x>", sender="Jens <JENS@Wagnersnetz.de>"),
b"2": mail_bytes("<b@x>", sender="philipp@wagnersnetz.de"),
b"3": mail_bytes("<c@x>", sender="someone@gmx.de")})
agent = Agent(OK, OK, OK)
summary = worker(store, imap, agent, allowed_senders=("Wagnersnetz.de", "someone@gmx.de")).run_once()
assert len(agent.calls) == 3 and summary["ignored"] == 0
@pytest.mark.parametrize("sender", [
"mallory@evil.example",
"mallory@sub.wagnersnetz.de", # a domain entry does not cover its subdomains
"mallory@wagnersnetz.de.evil.example",
"mallory@evilwagnersnetz.de",
"other@gmx.de", # a full address allows exactly that one
"@wagnersnetz.de", # not a plain address: must not pass by its last part
"a b@wagnersnetz.de",
'<"mallory@evil.example"@wagnersnetz.de>',
])
def test_sender_outside_the_allowed_domain_is_ignored(store, sender):
imap = FakeIMAP({b"1": mail_bytes("<a@x>", sender=sender)})
agent = Agent(OK)
summary = worker(store, imap, agent, allowed_senders=("wagnersnetz.de", "someone@gmx.de")).run_once()
assert agent.calls == [] and summary["ignored"] == 1 and store.all() == []
def test_no_allowed_senders_with_agent_means_nobody(store): def test_no_allowed_senders_with_agent_means_nobody(store):
imap = FakeIMAP({b"1": mail_bytes("<a@x>")}) imap = FakeIMAP({b"1": mail_bytes("<a@x>")})
agent = Agent(OK) agent = Agent(OK)
+2 -2
View File
@@ -8,7 +8,7 @@ import time
from email.utils import parseaddr from email.utils import parseaddr
from cases import case_key from cases import case_key
from forwarded import original_recipient, sender_allowed from forwarded import original_recipient
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -73,7 +73,7 @@ class Worker:
without += 1 without += 1
continue continue
forwarder = parseaddr(message.get("From", ""))[1] forwarder = parseaddr(message.get("From", ""))[1]
if (self.allowed_senders and not sender_allowed(forwarder, self.allowed_senders)) or ( if (self.allowed_senders and forwarder.lower() not in self.allowed_senders) or (
not self.allowed_senders and self.agent is not None): # fail closed not self.allowed_senders and self.agent is not None): # fail closed
ignored += 1 ignored += 1
continue continue