Skip to content

Commit

Permalink
Merge pull request #248 from parente/ignore-kg-envvars
Browse files Browse the repository at this point in the history
Only pass PATH from KG to new kernels
  • Loading branch information
rolweber committed May 29, 2017
2 parents b94f5bf + ff24ebc commit 1bb6cb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel_gateway/services/kernels/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ def post(self):
if model is not None and 'env' in model:
if not isinstance(model['env'], dict):
raise tornado.web.HTTPError(400)
# start with current env
env = dict(os.environ)
# Start with the PATH from the current env. Do not provide the entire environment
# which might contain server secrets that should not be passed to kernels.
env = {'PATH': os.getenv('PATH', '')}
# Whitelist KERNEL_* args and those allowed by configuration
env.update({key: value for key, value in model['env'].items()
if key.startswith('KERNEL_') or key in self.env_whitelist})
Expand Down

0 comments on commit 1bb6cb2

Please sign in to comment.