Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-87112: Ensure that only digits convertible to integers are accepted as section number in MIME header parameter#136877
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
base:main
Are you sure you want to change the base?
Conversation
matthieucan commented Jul 20, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Lib/email/_header_value_parser.py Outdated
| "found{}".format(value)) | ||
| digits='' | ||
| whilevalueandvalue[0].isdigit(): | ||
| whilevalueand'0'<=value[0]<='9': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| whilevalueand'0'<=value[0] <='9': | |
| whilevalueand('0'<=value[0] <='9'): |
It will a bit clearer. Or you can still use a separate function to make it even cleareer. The bottleneck won't be the function call IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that, but not the separate function. It was my understanding that @StanFromIreland was leaning towards not having an inner function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, I was against the function to check if it is in a dictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Just moved it to a separate function for extra-clarity
encukou commented Jul 22, 2025
Could you also test with, for example, |
matthieucan commented Jul 22, 2025
Thank you for looking into this. In my understanding, those are the possible scenarios:
|
encukou commented Jul 23, 2025
IMO, they should be accepted and raise a defect. |
matthieucan commented Jul 27, 2025
Thank you, I agree. This is now implemented. |
With those changes, the MIME parameter parser discards parameters with an invalid section number that uses a digit not convertible to integer such as super-script "²" or "𐩃" (Kharosthi number).
For backwards compatibility, keep accepting non-ASCII digits that can be converted to integers, such as NKO digits.
Before:
After: