You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(mime-node): keep control chars out of header values and msg-id headers
A header field carries VCHAR and WSP only, but every C0 control character and
DEL went out raw in Subject, in any header set through the headers option, in
Message-ID, In-Reply-To, Content-Id and References, and in a List-* url. CR
and LF were already stripped, so nothing crossed a header boundary, but the
emitted header was not one an rfc5322 parser accepts.
The treatment differs by grammar. An unstructured value is forced into the
mime encoded word that a non-ascii value would get anyway, which is what the
new _encodeHeaderText does. A msg-id and a url are structured, an encoded word
inside the angle brackets would be read back as literal text, so there the
characters are dropped instead.
HT is left alone throughout. It is valid folding whitespace in a header value,
and it separates the ids of an unfolded References header, so stripping it
merged them into one unusable token.
Stripping can make a scheme match that did not before, eg ht<NUL>tps://host
now resolves to https://host. The allowlist in _formatListUrl is unchanged and
still prefixes anything outside https, http, mailto and ftp, so a caller can
not reach a scheme this way that a plain url could not already reach.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bYRfSN3MWR2St9WLuPeXA
0 commit comments