Skip to content
Myr

Added note on send_file security.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 5bb2b55 · Browse files · 1 file+7 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−0 removed

  • other:+7 added−0 removed

1 file+7 added−0 removed

modified:flask.py+7 added
247 unmodified lines
248 By default it will try to guess the mimetype for you, but you can249 also explicitly provide one. For extra security you probably want250 to sent certain files as attachment (HTML for instance).251252 Please never pass filenames to this function from user sources without253 checking them first. Something like this is usually sufficient to254 avoid security problems::255256 if '..' in filename or filename.startswith('/'):257 abort(404)258259 .. versionadded:: 0.2260261 :param filename_or_fp: the filename of the file to send. This is262 relative to the :attr:`~Flask.root_path` if a
670 unmodified lines