Document a security risk in the send_file function
This commit is contained in:
@@ -444,6 +444,10 @@ class Response():
|
|||||||
:param content_type: The ``Content-Type`` header to use in the
|
:param content_type: The ``Content-Type`` header to use in the
|
||||||
response. If omitted, it is generated
|
response. If omitted, it is generated
|
||||||
automatically from the file extension.
|
automatically from the file extension.
|
||||||
|
|
||||||
|
Security note: The filename is assumed to be trusted. Never pass
|
||||||
|
filenames provided by the user before validating and sanitizing them
|
||||||
|
first.
|
||||||
"""
|
"""
|
||||||
if content_type is None:
|
if content_type is None:
|
||||||
ext = filename.split('.')[-1]
|
ext = filename.split('.')[-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user