-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix handling of multipart/form-data #8280
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I started digging into this one Unrelated but it looks there is blocking I/O in the event loop here: aiohttp/aiohttp/web_request.py Line 727 in 742a7d9
aiohttp/aiohttp/web_request.py Line 731 in 742a7d9
aiohttp/aiohttp/web_request.py Line 739 in 742a7d9
|
Its a bit unexpected that any formdata that is bytes is treated as a file Line 56 in 742a7d9
|
That was my initial thought too. It might be a convenience if you avoid bytes for typical use, but a little confusing otherwise. Should we switch v4 to only create files when |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8280 +/- ##
==========================================
+ Coverage 97.50% 97.54% +0.04%
==========================================
Files 107 107
Lines 33026 33024 -2
Branches 3862 3872 +10
==========================================
+ Hits 32201 32213 +12
+ Misses 605 591 -14
Partials 220 220
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
OK, I think this should be fine now. Will need a followup PR to do the actual removal in master. |
I'll be back home in an hour and can throw this on production to make sure there's no unexpected side effects |
The backport to 3.9 is messy because #3492 isn't in 3.9 |
I squashed this, cherry-picked fcedc66, than cherry-picked this on to my 3.9 integration branch. Testing that now |
Started up OK, and file uploads work. Watching the logs now. |
Nothing obvious showing up in the logs. Everything I could think to test still works |
Guess we just backport that first then? Clearly got missed from any backports. |
While I'm not a big fan of the complexity added by #3492, given that PR is already accepted and merged, and this fix is developed on top of it, that seems like the most reasonable path forward. |
Wait, is this multipart reader server-side or client-side? If it's server-side then the change will likely introduce another HTTP request smuggling vulnerability. If it's only server-side, then we'd probably be best reverting the commit. If it's both, then we probably want to backport it and add a followup PR to disable it when the parser is not in lax mode... |
I think this is server-side only, I think the best option right now is to revert that change as nobody seems to have missed the feature, given that it failed to make it into a release for 5 years. |
There are a couple of lines of coverage dropped in multipart.py: I'm unclear how to get that covered again, or whether the code should maybe be deleted now. If anyone figures it out by tomorrow, feel free to just edit the PR directly. |
Backport to 3.9: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 7d0be3f on top of patchback/backports/3.9/7d0be3fee540a3d4161ac7dc76422f1f5ea60104/pr-8280 Backporting merged PR #8280 into master
🤖 @patchback |
Backport to 3.10: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 7d0be3f on top of patchback/backports/3.10/7d0be3fee540a3d4161ac7dc76422f1f5ea60104/pr-8280 Backporting merged PR #8280 into master
🤖 @patchback |
https://datatracker.ietf.org/doc/html/rfc7578 (cherry picked from commit 7d0be3f)
https://datatracker.ietf.org/doc/html/rfc7578 (cherry picked from commit 7d0be3f)
https://datatracker.ietf.org/doc/html/rfc7578 (cherry picked from commit 7d0be3f)
https://datatracker.ietf.org/doc/html/rfc7578 (cherry picked from commit 7d0be3f)
https://datatracker.ietf.org/doc/html/rfc7578