Skip to content

Commit

Permalink
added check for /tmp or /var/tmp (#885)
Browse files Browse the repository at this point in the history
Add check to make sure workdir isn't /var or /var/tmp
  • Loading branch information
Leahh02 authored Aug 13, 2024
1 parent 08af680 commit 56fe02e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions beeflow/client/bee_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ def is_parent(parent, path):
if not os.path.exists(workdir):
error_exit(f"Workflow working directory \"{workdir}\" doesn't exist")

# Make sure the workdir is not in /var or /var/tmp
if os.path.commonpath([os.path.realpath('/tmp'), workdir]) == os.path.realpath('/tmp'):
error_exit("Workflow working directory cannot be in \"/tmp\"")
if os.path.commonpath([os.path.realpath('/var/tmp'), workdir]) == os.path.realpath('/var/tmp'):
error_exit("Workflow working directory cannot be in \"/var/tmp\"")

# TODO: Can all of this information be sent as a file?
data = {
'wf_name': wf_name.encode(),
Expand Down

0 comments on commit 56fe02e

Please sign in to comment.