Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Quick fix log leak (#6545)

Engel Nystd0276d1925db
diff --git a/openhands/runtime/base.py b/openhands/runtime/base.py
index 8362336a16..4128c4cae6 100644
--- a/openhands/runtime/base.py
+++ b/openhands/runtime/base.py
@@ -164,8 +164,9 @@ class Runtime(FileEditRuntimeMixin):
# Note: json.dumps gives us nice escaping for free
code += f'os.environ["{key}"] = {json.dumps(value)}\n'
code += '\n'
- obs = self.run_ipython(IPythonRunCellAction(code))
- self.log('debug', f'Added env vars to IPython: code={code}, obs={obs}')
+ self.run_ipython(IPythonRunCellAction(code))
+ # Note: we don't log the vars values, they're leaking info
+ logger.debug('Added env vars to IPython')
# Add env vars to the Bash shell
cmd = ''
@@ -175,7 +176,10 @@ class Runtime(FileEditRuntimeMixin):
if not cmd:
return
cmd = cmd.strip()
- logger.debug(f'Adding env var: {cmd}')
+ logger.debug(
+ 'Adding env vars to bash'
+ ) # don't log the vars values, they're leaking info
+
obs = self.run(CmdRunAction(cmd))
if not isinstance(obs, CmdOutputObservation) or obs.exit_code != 0:
raise RuntimeError(