Skip to content

Commit 83666ad

Browse files
security: sanitize fetch parameter with secure_filename in /download endpoint (fixes #358)
1 parent 0467ce5 commit 83666ad

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fri/server/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ def download(dir):
433433
if not download_file:
434434
abort(400, description="Missing file parameter")
435435

436+
download_file = secure_filename(download_file)
437+
438+
if download_file == "":
439+
abort(400, description="Invalid filename")
440+
436441
# Normalize the requested file path
437442
safe_path = os.path.normpath(download_file)
438443

0 commit comments

Comments
 (0)