-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix multipart parsing for empty body parts #11857
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: master
Are you sure you want to change the base?
Fix multipart parsing for empty body parts #11857
Conversation
for more information, see https://pre-commit.ci
|
FWIW, a real world application of this: https://strawberry.rocks/docs/general/multipart-subscriptions Minimal implementation here: https://github.com/magicmark/gql-book-server/ Raw response: It's also possible the fix needs to be made in Strawberry? cc @patrick91 @erikwrede |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11857 +/- ##
==========================================
- Coverage 98.74% 98.74% -0.01%
==========================================
Files 127 127
Lines 44171 44187 +16
Branches 2342 2343 +1
==========================================
+ Hits 43618 43631 +13
- Misses 392 395 +3
Partials 161 161
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #11857 will not alter performanceComparing Summary
|
764cb47 to
0e70964
Compare
https://datatracker.ietf.org/doc/html/rfc2046#section-5.1.1 So, an empty body part looks like: So, the example provided appears to be invalid syntax to me (not to mention that it seems illogical to be wasting bandwidth sending nothing). If we allowed this, there's a possibility it could open up an HTTP request smuggling vulnerability. |
|
Thanks @Dreamsorcerer. Will make the fix in Strawberry then. |
|
Tests are still xfailing with correct syntax, so there may be a fix needed in both. |
|
OK, I have a fix. Going to make some tweaks to the this test and then will followup with the actual fix. |
|
Causes too many warnings. Will have to add the fix here. |
What do these changes do?
Adds a failing test case that demonstrates an edge-case when parsing empty parts before the final boundary marker. I believe this is a valid payload, but currently blows up.
Are there changes in behavior for the user?
No. This PR only adds a test marked with
@pytest.mark.xfailto add a failing test to demonstrate. I will follow up with a fix if we agree this is a bug.Is it a substantial burden for the maintainers to support this?
No.
Checklist
well writtenexcellentCONTRIBUTORS.txtCHANGES/folder