fix: remove env from sandbox.
parent
b841d862a8
commit
d9b7810cc8
|
|
@ -53,10 +53,6 @@ try:
|
||||||
path_to_exclude = ['/opt/py3/lib/python3.11/site-packages', '/opt/maxkb-app/apps']
|
path_to_exclude = ['/opt/py3/lib/python3.11/site-packages', '/opt/maxkb-app/apps']
|
||||||
sys.path = [p for p in sys.path if p not in path_to_exclude]
|
sys.path = [p for p in sys.path if p not in path_to_exclude]
|
||||||
sys.path += {python_paths}
|
sys.path += {python_paths}
|
||||||
env = dict(os.environ)
|
|
||||||
for key in list(env.keys()):
|
|
||||||
if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG') or key.startswith('REDIS') or key == 'PATH'):
|
|
||||||
del os.environ[key]
|
|
||||||
locals_v={'{}'}
|
locals_v={'{}'}
|
||||||
keywords={keywords}
|
keywords={keywords}
|
||||||
globals_v=globals()
|
globals_v=globals()
|
||||||
|
|
@ -163,10 +159,6 @@ logging.getLogger("mcp.server").setLevel(logging.ERROR)
|
||||||
path_to_exclude = ['/opt/py3/lib/python3.11/site-packages', '/opt/maxkb-app/apps']
|
path_to_exclude = ['/opt/py3/lib/python3.11/site-packages', '/opt/maxkb-app/apps']
|
||||||
sys.path = [p for p in sys.path if p not in path_to_exclude]
|
sys.path = [p for p in sys.path if p not in path_to_exclude]
|
||||||
sys.path += {python_paths}
|
sys.path += {python_paths}
|
||||||
env = dict(os.environ)
|
|
||||||
for key in list(env.keys()):
|
|
||||||
if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG') or key.startswith('REDIS') or key == 'PATH'):
|
|
||||||
del os.environ[key]
|
|
||||||
exec({dedent(code)!a})
|
exec({dedent(code)!a})
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -204,6 +196,7 @@ exec({dedent(code)!a})
|
||||||
file.write(_code)
|
file.write(_code)
|
||||||
os.system(f"chown {self.user}:root {exec_python_file}")
|
os.system(f"chown {self.user}:root {exec_python_file}")
|
||||||
kwargs = {'cwd': BASE_DIR}
|
kwargs = {'cwd': BASE_DIR}
|
||||||
|
kwargs['env'] = {}
|
||||||
subprocess_result = subprocess.run(
|
subprocess_result = subprocess.run(
|
||||||
['su', '-s', python_directory, '-c', "exec(open('" + exec_python_file + "').read())", self.user],
|
['su', '-s', python_directory, '-c', "exec(open('" + exec_python_file + "').read())", self.user],
|
||||||
text=True,
|
text=True,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue