]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-127794: Validate email header names according to RFC 5322 (#127820)
authorSrinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com>
Sun, 30 Mar 2025 12:29:29 +0000 (17:59 +0530)
committerGitHub <noreply@github.com>
Sun, 30 Mar 2025 12:29:29 +0000 (12:29 +0000)
commitc432d0147bdf1a66604e7a3d6a71660ae79b5f45
tree6ea2c74ba2ad5eb95074fe4accc91d014c27c7bd
parent55150a79cacbce44f50cea128c511782df0ab277
gh-127794: Validate email header names according to RFC 5322 (#127820)

`email.message.Message` objects now validate header names specified via `__setitem__`
or `add_header` according to RFC 5322, §2.2 [1].

In particular, callers should expect a ValueError to be raised for invalid header names.

[1]: https://datatracker.ietf.org/doc/html/rfc5322#section-2.2

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
Lib/email/_policybase.py
Lib/email/policy.py
Lib/test/test_email/test_email.py
Lib/test/test_email/test_message.py
Misc/NEWS.d/next/Library/2024-12-11-17-44-36.gh-issue-127794.VwmRsp.rst [new file with mode: 0644]