mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
refactor: set MAXKB_SANDBOX_HOME env.
This commit is contained in:
parent
22fb0b55bf
commit
180ee40cdc
|
|
@ -18,7 +18,7 @@ class ToolExecutor:
|
|||
def __init__(self, sandbox=False):
|
||||
self.sandbox = sandbox
|
||||
if sandbox:
|
||||
self.sandbox_path = '/opt/maxkb-app/sandbox'
|
||||
self.sandbox_path = CONFIG.get("SANDBOX_HOME", '/opt/maxkb-app/sandbox')
|
||||
self.user = 'sandbox'
|
||||
else:
|
||||
self.sandbox_path = os.path.join(PROJECT_DIR, 'data', 'sandbox')
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ RUN apt-get update && \
|
|||
apt-get clean all && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /opt/maxkb-app
|
||||
RUN gcc -shared -fPIC -o /opt/maxkb-app/sandbox/sandbox.so /opt/maxkb-app/installer/sandbox.c -ldl && \
|
||||
RUN gcc -shared -fPIC -o ${MAXKB_SANDBOX_HOME}/sandbox.so /opt/maxkb-app/installer/sandbox.c -ldl && \
|
||||
rm -rf /opt/maxkb-app/ui && \
|
||||
pip install uv --break-system-packages && \
|
||||
python -m uv pip install -r pyproject.toml && \
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ ENV PATH=/opt/py3/bin:$PATH \
|
|||
MAXKB_CONFIG_TYPE=ENV \
|
||||
MAXKB_LOG_LEVEL=INFO \
|
||||
MAXKB_SANDBOX=1 \
|
||||
MAXKB_SANDBOX_HOME=/opt/maxkb-app/sandbox
|
||||
MAXKB_SANDBOX_PYTHON_PACKAGE_PATHS="/opt/py3/lib/python3.11/site-packages,/opt/maxkb-app/sandbox/python-packages,/opt/maxkb/python-packages" \
|
||||
MAXKB_SANDBOX_PYTHON_BANNED_KEYWORDS="subprocess.,system(,exec(,execve(,pty.,eval(,compile(,shutil.,input(,__import__" \
|
||||
MAXKB_SANDBOX_PYTHON_BANNED_HOSTS="127.0.0.1,localhost,host.docker.internal,maxkb,pgsql,redis" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue