Martin Panter added the comment:

I think encoding the user’s IP address into the boundary is a bad idea. 
Forest’s version uses the existing “email” package, which calls 
random.randrange(sys.maxsize) and searches through the data for conflicts.

I haven’t really researched this, but I suspect it would be even better to use 
a CSPRNG like the new “secrets” module, or uuid.uuid4(). Otherwise, perhaps 
there is the possibility of attacks by predicting the boundary and injecting 
HTTP headers, splitting up requests, etc via a file upload.

Both Forest and Senthil’s patches look like they load all the data into memory, 
so would not be useful for streaming, which was the original request. Hence I 
am putting this back to “needs patch”. Issue 3243 has been resolved, meaning 
that we can stream upload data as long as the Content-Length has been 
pre-calculated. The length could be calculated based from the length of each 
piece (e.g. file sizes).

Also, with Issue 12319 (chunked encoding) about to be resolved, if people only 
need to use HTTP 1.1, it may be easier to upload forms using chunked encoding, 
where you don’t have to worry about Content-Length.

----------
stage: patch review -> needs patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue3244>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to