Skip to content

Commit 088b118

Browse files
committed
Release version 0.4.0
1 parent 187b040 commit 088b118

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

docs/setup.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ You can do this the **easy way** (good for single-user setups) by running Open W
2424
* On **Docker**: Add `--privileged=true` to `docker run`.
2525
* On **Kubernetes**: Set `spec.securityContext.privileged` to `true`.
2626

27-
**This will remove all security measures** from the Open WebUI container. From a security perspective, this is roughly equivalent to running the Open WebUI server as root outside of a container on the host machine.
28-
29-
However, **code running as part of this code execution function/tool will still run in a secure gVisor sandbox** and cannot impact the host.
27+
**This will remove all security measures** from the Open WebUI container. From a security perspective, this is roughly equivalent to running the Open WebUI server as root outside of a container on the host machine. However, **code running as part of this code execution function/tool will still run in a secure gVisor sandbox** and cannot impact the host or the Open WebUI container.
3028

3129
This is adequate for single-user setups not exposed to the outside Internet, while still providing strong security against LLMs generating malicious code. However, if you are running a multi-user setup, or if you do not fully trust Open WebUI's code, or the Open WebUI server's HTTP port is exposed to the outside Internet, you may want to harden it further. If so, **don't** set the `privileged` setting, and read on to the hard way instead.
3230

@@ -53,7 +51,7 @@ The below is the minimal subset of changes that `--privileged=true` does that is
5351
* **Mount `cgroupfs` as writable**:
5452
* On **Docker**: Add `--mount=type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup,readonly=false` to `docker run`.
5553
* On **Kubernetes**: Add a [`hostPath` volume](https://kubernetes.io/docs/concepts/storage/volumes/#hostpath) with `path` set to `/sys/fs/cgroup`, then mount it in your container's `volumeMounts` with options `mountPath` set to `/sys/fs/cgroup` and `readOnly` set to `false`.
56-
* **Why**: This is needed so that gVisor can create child [cgroups](https://en.wikipedia.org/wiki/Cgroups), necessary to enforce per-sandbox memory usage limits.
54+
* **Why**: This is needed so that gVisor can create child [cgroups](https://en.wikipedia.org/wiki/Cgroups), necessary to enforce per-sandbox resource usage limits.
5755
* **Set the `container_engine_t` SELinux label**:
5856
* On **Docker**: Add `--security-opt=label=type:container_engine_t` to `docker run`.
5957
* On **Kubernetes**: Set [`spec.securityContext.seLinuxOptions.type`](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#assign-selinux-labels-to-a-container) to `container_engine_t`.

open-webui/functions/run_code.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
author: EtiennePerot
66
author_url: https://github.com/EtiennePerot/open-webui-code-execution
77
funding_url: https://github.com/EtiennePerot/open-webui-code-execution
8-
version: 0.3.0
8+
version: 0.4.0
99
license: Apache-2.0
1010
"""
1111

1212
# This is an OpenWebUI *function*. It can run code within LLM-generated code blocks.
1313
# If you are looking for an OpenWebUI *tool* to allow the LLM to run its own code,
1414
# see here instead: https://openwebui.com/t/etienneperot/run_code/
1515
# See https://github.com/EtiennePerot/open-webui-code-execution for more info.
16-
16+
# NOTE: If running Open WebUI in a container, you *need* to set up this container to allow sandboxed code execution.
17+
# Please read the docs here:
18+
#
19+
# https://github.com/EtiennePerot/open-webui-code-execution/blob/master/README.md
20+
#
1721
# Protip: You can test this tool manually outside of OpenWebUI by running it like this:
1822
#
1923
# echo 'print("Hello world!")' | python3 run_code.py

open-webui/tools/run_code.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414
# of code in the LLM output, see here instead:
1515
# https://openwebui.com/f/etienneperot/run_code/
1616
# See https://github.com/EtiennePerot/open-webui-code-execution for more info.
17-
18-
# Protip: You can test this tool manually outside of OpenWebUI by running it like this:
17+
# NOTE: If running Open WebUI in a container, you *need* to set up this container to allow sandboxed code execution.
18+
# Please read the docs here:
1919
#
20-
# echo 'print("Hello world!")' | python3 run_code.py
20+
# https://github.com/EtiennePerot/open-webui-code-execution/blob/master/README.md
21+
#
22+
# Protip: You can test this tool manually by running it as a Python script, like so:
23+
# (Run this inside the Open WebUI container)
24+
#
25+
# python3 run_code.py --self_test
2126
#
2227
# This will simulate that OpenWebUI would do if it asked this tool to evaluate the Python code `print("Hello world!")`.
2328
# This can be useful when setting up this tool to verify that it works in your environment.
29+
# You can also use it for one-off code execution like this:
30+
#
31+
# echo 'print("Hello world!")' | python3 run_code.py
32+
#
2433

2534
import asyncio
2635
import argparse

0 commit comments

Comments
 (0)