Skip to content

Commit d29ed6a

Browse files
Document a security risk in the send_file function
1 parent 8e5fb92 commit d29ed6a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/microdot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ def send_file(cls, filename, status_code=200, content_type=None):
444444
:param content_type: The ``Content-Type`` header to use in the
445445
response. If omitted, it is generated
446446
automatically from the file extension.
447+
448+
Security note: The filename is assumed to be trusted. Never pass
449+
filenames provided by the user before validating and sanitizing them
450+
first.
447451
"""
448452
if content_type is None:
449453
ext = filename.split('.')[-1]

0 commit comments

Comments
 (0)