On Fri, Oct 02, 2026 at 10:35:50AM -0700, Mark Fletcher wrote:

> Starting around 2026-09-30, some mail from iCloud (outbound.pv.icloud.com,
> d=me.com / icloud.com) arrives with its X-JNJ header folded using CR CR LF
> instead of CRLF, so every continuation line ends in a bare CR:
> 
> X-JNJ: 
> AAAAAAABP/3KSje4IZVa07c2z+UdxkhM9/vkiTEFbtICtmdQNDbg+DrLdQ0Ft9q0EVFmsf\r\r\n
>  ZsqJKIQheNL00NIO5g3xDCPrPfJlm7dxlD87Eo/cBz7v93Mql2/2PgDogHunr59cSLoX67\r\r\n
>  ...
> 
> Nothing else in the message has bare CRs. Our numbers: of iCloud messages
> carrying X-JNJ, 0 of ~350–400/day had this from 09-27 through 09-29, then
> 123 of 392 (31%) on 09-30, which looks like a rollout still in progress.

My server has received just one icloud message with an "X-JNJ:" header
during this time, it did not have the excess CR.

> Many parsers tolerate it on the way in (Go's net/mail, for one), and
> iCloud's own DKIM signature doesn't cover X-JNJ, so it passes. The problem
> shows up downstream: a common line-reading approach strips the CRLF but
> leaves the bare CR in the header value, and writing the header back out
> produces \r\r\n. Gmail treats the bare CR as a line break, sees an empty
> line inside X-JNJ, and ends the header block there.

The Postfix cleanup(8) service (in sufficiently recent versions)
replaces bare CR with SPACE while writing the incoming message's queue
file.

    http://www.postfix.org/postconf.5.html#cleanup_replace_stray_cr_lf
    
https://github.com/vdukhovni/postfix/blob/8e965decf941bba12afdd9ca7938957071ec2ac0/postfix/src/cleanup/cleanup_message.c?ts=8#L998-L1013

So if one were to arrive, it would end up having trailing spaces in the
"X-JNJ:" header line.

When bare LF (and CR) normalisation is disabled, or in sufficiently
older versions Postfix truncates any trailing CR preceding the CRLF on
all lines read from the SMTP client:

    
https://github.com/vdukhovni/postfix/blob/postfix-3.4/postfix/src/global/smtp_stream.c?ts=8#L399-L409

So, FWIW, bare CR preceding CRLF never makes it into the received queue
file.

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
mailop mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to