Skip to content

Commit

Permalink
Add extra check before performing deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Aug 6, 2023
1 parent 7ce6545 commit 080ec1d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1558,10 +1558,15 @@ def applyDeletions(installPath, optionParser):
if opt.deletePath is not None:
# Do not allow paths with '..' to avoid deleting stuff outside the install path
if '..' in opt.deletePath.replace('\\', '/').split('/'):
raise Exception("Developer Error: You are not allowed to use '..' for deletePath")
raise Exception("applyDeletions() Developer Error: You are not allowed to use '..' for the 'deletePath' option")

fullDeletePath = os.path.join(installPath, opt.deletePath)

# Do not allow deleting any paths outside of the streamingassets folder for now
if 'streamingassets' not in os.path.abspath(fullDeletePath).lower():
raise Exception("applyDeletions() Developer Error: You are not allowed to delete outside of the StreamingAssets folder deletePath. "
"NOTE: This assert should be removed if deletePath needs to be used for Umineko (and possibly some other check added)")

try:
print("applyDeletions(): Attempting to delete path {} due to option {}...".format(fullDeletePath, opt.name))
if os.path.isdir(fullDeletePath):
Expand Down

0 comments on commit 080ec1d

Please sign in to comment.