Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-127794: Validate header name according to rfc-5322 #127820

Open
wants to merge 75 commits into
base: main
Choose a base branch
from

Conversation

srinivasreddy
Copy link
Contributor

@srinivasreddy srinivasreddy commented Dec 11, 2024

@srinivasreddy srinivasreddy requested a review from a team as a code owner December 11, 2024 11:59
@srinivasreddy srinivasreddy changed the title gh-127794: Validate header name according rfc-5322 and allow only printable ascii characters gh-127794: Validate header name according to rfc-5322 and allow only printable ascii characters Dec 11, 2024
@ZeroIntensity ZeroIntensity added topic-email needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Dec 12, 2024
Lib/email/message.py Outdated Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Dec 12, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be put in the comfy chair!

Copy link
Member

@bitdancer bitdancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the prompt response. Hopefully I can be reasonably prompt in return, but unfortunately no guarantees :(

Lib/email/_policybase.py Outdated Show resolved Hide resolved
Lib/email/_policybase.py Outdated Show resolved Hide resolved
Lib/email/_policybase.py Outdated Show resolved Hide resolved
Lib/email/policy.py Outdated Show resolved Hide resolved
Lib/test/test_email/test_email.py Outdated Show resolved Hide resolved
Lib/test/test_email/test_email.py Show resolved Hide resolved
Lib/test/test_email/test_email.py Show resolved Hide resolved
Lib/test/test_email/test_email.py Outdated Show resolved Hide resolved
Lib/email/policy.py Outdated Show resolved Hide resolved
Lib/test/test_email/test_email.py Outdated Show resolved Hide resolved
Lib/test/test_email/test_message.py Outdated Show resolved Hide resolved
Lib/email/policy.py Outdated Show resolved Hide resolved
@picnixz picnixz dismissed their stale review December 24, 2024 17:00

Requested changes were addressed

srinivasreddy and others added 3 commits December 31, 2024 15:31
Lib/email/policy.py Outdated Show resolved Hide resolved
Lib/test/test_email/test_email.py Show resolved Hide resolved
@srinivasreddy srinivasreddy requested a review from picnixz January 2, 2025 07:12
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some final thoughts. Otherwise, it looks fine to me.

Lib/email/_policybase.py Show resolved Hide resolved
@srinivasreddy srinivasreddy requested a review from picnixz January 6, 2025 06:01
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to post my review 3 days ago..

…wmRsp.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz
Copy link
Member

picnixz commented Jan 6, 2025

Great. The suggestion I proposed was meant to be checked with the online docs but RTD is currently failing for all other PRs. Have you tried rendering :rfc:`5322#section-3.6.8`? If this renders better (and I think we use this elsewhere), then I would recommend it above the title + ref form that we currently have.

Can you check it locally & show me a screenshot comparing the two? Thanks in advance.

@picnixz
Copy link
Member

picnixz commented Jan 6, 2025

Nevermind, we use the long form anyway. No need to change:

$ git grep -P ':rfc:`.+ <\d{4}#section.+>' Doc/
Doc/howto/logging-cookbook.rst::rfc:`relevant section of the specification <5424#section-6>`.)
Doc/library/codecs.rst:based on the separator characters defined in :rfc:`section 3.1 of RFC 3490 <3490#section-3.1>`
Doc/library/http.client.rst:   an absolute path to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>`
Doc/library/http.client.rst:   with the request. A :rfc:`Host header <2616#section-14.23>`
Doc/library/http.client.rst:   must be provided to conform with :rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>`
Doc/library/uuid.rst:   :rfc:`RFC 9562, §5.8 <9562#section-5.8>`.
Doc/library/xmlrpc.client.rst:      :rfc:`RFC 2045 section 6.8 <2045#section-6.8

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once RTD is back online, we can merge this one I think.

@srinivasreddy
Copy link
Contributor Author

srinivasreddy commented Jan 8, 2025

@picnixz RTD passed as well. We can merge 🚀 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.