Skip to content

Commit

Permalink
check that the upload path of a file resolves inside the files folder
Browse files Browse the repository at this point in the history
  • Loading branch information
afourmy committed Jan 11, 2024
1 parent b3ec2e6 commit 42aac5d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eNMS/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,8 @@ def update_device_rbac(self):

def upload_files(self, **kwargs):
path = f"{vs.file_path}/{kwargs['folder']}/{kwargs['file'].filename}"
if not str(Path(path).resolve()).startswith(str(vs.file_path)):
return {"error": "The path resolves outside of the files folder."}
kwargs["file"].save(path)

def update_pool(self, pool_id):
Expand Down

0 comments on commit 42aac5d

Please sign in to comment.