Skip to content

Commit a51d841

Browse files
authored
Merge pull request #403 from GaneshPatil7517/security/secure-fetch-filename
security: sanitize fetch parameter in /download endpoint using secure_filename (fixes #358)
2 parents 8c685c3 + 83666ad commit a51d841

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)