mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-28 14:50:14 +03:00
Merge pull request #2630 from UmmmAGoodName/3.0
Fixed the path traversal check
This commit is contained in:
commit
5755a48fa3
@ -46,8 +46,8 @@ async def web_ui(file_path: str):
|
|||||||
file_path = os.path.normpath(file_path).strip("/")
|
file_path = os.path.normpath(file_path).strip("/")
|
||||||
file_path = os.path.join("static", "web-ui", file_path)
|
file_path = os.path.join("static", "web-ui", file_path)
|
||||||
|
|
||||||
# Raise error if user try to escape
|
# Raise error if user tries to escape the web-ui directory
|
||||||
if file_path[0] == ".":
|
if not os.path.normpath(file_path).startswith(os.path.join("static", "web-ui")):
|
||||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||||
|
|
||||||
static = get_resource(file_path)
|
static = get_resource(file_path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user