Skip to content

Commit

Permalink
add uid check and drop privileges if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
phue committed Jun 17, 2024
1 parent 969613b commit 0af7900
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nextflowspawner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ def _default_schema(self):
except FileNotFoundError:
print(f"{self.workflow_url} does not seem to provide a nextflow_schema.json")

def make_preexec_fn(self, _):
pass
def make_preexec_fn(self, name):
if os.getuid():
# if we are already running as non-root user, do nothing
pass
else:
# otherwise drop privileges
return super().set_user_setuid(name, chdir=True)

def _get_params_from_schema(self, schema, key=None):
params = {}
Expand Down

0 comments on commit 0af7900

Please sign in to comment.