Skip to content

Commit 180ee40

Browse files
refactor: set MAXKB_SANDBOX_HOME env.
1 parent 22fb0b5 commit 180ee40

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

apps/common/utils/tool_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ToolExecutor:
1818
def __init__(self, sandbox=False):
1919
self.sandbox = sandbox
2020
if sandbox:
21-
self.sandbox_path = '/opt/maxkb-app/sandbox'
21+
self.sandbox_path = CONFIG.get("SANDBOX_HOME", '/opt/maxkb-app/sandbox')
2222
self.user = 'sandbox'
2323
else:
2424
self.sandbox_path = os.path.join(PROJECT_DIR, 'data', 'sandbox')

installer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get update && \
1313
apt-get clean all && \
1414
rm -rf /var/lib/apt/lists/*
1515
WORKDIR /opt/maxkb-app
16-
RUN gcc -shared -fPIC -o /opt/maxkb-app/sandbox/sandbox.so /opt/maxkb-app/installer/sandbox.c -ldl && \
16+
RUN gcc -shared -fPIC -o ${MAXKB_SANDBOX_HOME}/sandbox.so /opt/maxkb-app/installer/sandbox.c -ldl && \
1717
rm -rf /opt/maxkb-app/ui && \
1818
pip install uv --break-system-packages && \
1919
python -m uv pip install -r pyproject.toml && \

installer/Dockerfile-base

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ ENV PATH=/opt/py3/bin:$PATH \
4545
MAXKB_CONFIG_TYPE=ENV \
4646
MAXKB_LOG_LEVEL=INFO \
4747
MAXKB_SANDBOX=1 \
48+
MAXKB_SANDBOX_HOME=/opt/maxkb-app/sandbox
4849
MAXKB_SANDBOX_PYTHON_PACKAGE_PATHS="/opt/py3/lib/python3.11/site-packages,/opt/maxkb-app/sandbox/python-packages,/opt/maxkb/python-packages" \
4950
MAXKB_SANDBOX_PYTHON_BANNED_KEYWORDS="subprocess.,system(,exec(,execve(,pty.,eval(,compile(,shutil.,input(,__import__" \
5051
MAXKB_SANDBOX_PYTHON_BANNED_HOSTS="127.0.0.1,localhost,host.docker.internal,maxkb,pgsql,redis" \

0 commit comments

Comments
 (0)