From 983ccdcb27b18cc4e5f85f49ed6fb167254f9ede Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 6 Nov 2025 11:10:37 +0800 Subject: [PATCH] fix: set environment variables for LD_PRELOAD and SANDBOX_ALLOW_HOSTS_REGEXES in sandbox execution --- apps/common/utils/tool_code.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/common/utils/tool_code.py b/apps/common/utils/tool_code.py index 279c4ef56..d6298805e 100644 --- a/apps/common/utils/tool_code.py +++ b/apps/common/utils/tool_code.py @@ -181,7 +181,10 @@ exec({dedent(code)!a}) self.user, ], 'cwd': self.sandbox_path, - 'env': {}, + 'env': { + 'LD_PRELOAD': '/opt/maxkb-app/sandbox/sandbox.so', + 'SANDBOX_ALLOW_HOSTS_REGEXES': self.allow_hosts_regexes, + }, 'transport': 'stdio', } else: