Agent Zero AI framework
fix: prevent sender whitelist spoofing by matching only the parsed email address
linuztxc1119c9d93cb
diff --git a/plugins/_email_integration/helpers/imap_client.py b/plugins/_email_integration/helpers/imap_client.pyindex 0091bb2f4..75a1b37e2 100644--- a/plugins/_email_integration/helpers/imap_client.py+++ b/plugins/_email_integration/helpers/imap_client.py@@ -442,7 +442,12 @@ def _is_noreply(sender: str) -> bool:def _matches_whitelist(sender: str, whitelist: list[str]) -> bool:- sender_lower = sender.lower()+ addr = sender+ match = re.search(r"<([^>]+)>", sender)+ if match:+ addr = match.group(1).strip()++ sender_lower = addr.lower()for pattern in whitelist:if fnmatch(sender_lower, pattern.lower()):return True