Setup: mailcow-dockerized, updated on 2026-10-21 (current master), Rspamd 4.2.1, stock ClamAV integration.
Summary: A sender whitelist entry (domain or mailbox spam filter, whitelist_from) makes mailcow deliver mail with known malware. ClamAV still scans and detects it, but the detection no longer has any effect.
Why (current master):
The whitelist is applied via the settings map as a score, MAILCOW_WHITE = -999.0 (data/conf/rspamd/dynmaps/settings.php). So ClamAV still runs.
CLAM_VIRUS itself is registered with score 0 (Rspamd antivirus.lua).
The only thing that turns a detection into a rejection is mailcow’s composite in data/conf/rspamd/local.d/composites.conf:
VIRUS_FOUND {
expression = “CLAM_VIRUS & !MAILCOW_WHITE”;
score = 2000.0;
}
For whitelisted senders it explicitly does not fire. The same !MAILCOW_WHITE exclusion is on the Sanesecurity composites (CLAMD_*) and on OLETOOLS.
MAILCOW_WHITE_EXCLUDE only removes the whitelist when SPF or DMARC fails. A compromised but genuine account of a whitelisted partner passes both. That is the typical malware delivery path today.
Test on a live instance (offline via rspamc, nothing delivered). Sender passes SPF and DMARC, EICAR attached, domain whitelist entry *@<partner-domain> for the recipient domain:
Without whitelist:
Action: reject
Symbol: DMARC_POLICY_ALLOW (-0.50)
Symbol: R_SPF_ALLOW (-0.20)
Symbol: VIRUS_FOUND (2000.00)
With whitelist (after the settings map was reloaded):
Action: no action
Score: -1998.40 / 15.00
Symbol: CLAM_VIRUS (0.00)[Eicar-Test-Signature]
Symbol: DMARC_POLICY_ALLOW (-0.50)
Symbol: MAILCOW_WHITE (-1998.00)
Symbol: R_SPF_ALLOW (-0.20)
After removing the entry, it is reject with VIRUS_FOUND again.
Points worth discussing:
Intentional, not a bug: The exclusion has existed since commit 873222d5 (2017-12-09) and was already part of the earlier force_actions rule. So I’d call this a design question with a security impact, not a bug.
Not documented: The docs page on black/whitelists does not mention that a whitelist also disables virus rejection. Most admins would expect a whitelist to affect spam scoring only.
End users can do this themselves: Mailbox users with the spam_policy ACL can add their own whitelist entries. Wildcard patterns like *@*.com pass the input validation (functions.policy.inc.php); only a bare * is rejected. I verified this by reading the code, not by testing.
Suggestion: Reject CLAM_VIRUS regardless of the whitelist, i.e. drop & !MAILCOW_WHITE from VIRUS_FOUND. If the whitelist exception is meant for false positives, keep it only for the heuristic Sanesecurity composites, or make it an explicit option. At minimum, document the behaviour.