Skip to content

Commit

Permalink
Fixed file traversal via path filename vulnerability in swaggerui sta…
Browse files Browse the repository at this point in the history
…tic route. #2559
  • Loading branch information
morpheus65535 committed Jul 1, 2024
1 parent ad88ec3 commit 7b7e984
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bazarr/app/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def backup_download(filename):
def swaggerui_static(filename):
basepath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'libs', 'flask_restx',
'static')
fullpath = os.path.join(basepath, filename)
if not fullpath.startswith(basepath):
fullpath = os.path.realpath(os.path.join(basepath, filename))
if not basepath == os.path.commonpath((basepath, fullpath)):
return '', 404
else:
return send_file(fullpath)
Expand Down

0 comments on commit 7b7e984

Please sign in to comment.