Add Tenki sandboxes plugin for Open WebUI - #1
Conversation
|
Review Complete
Files Reviewed: 28 By Severity:
4 findings in a sandboxed code execution plugin for Open WebUI: 2 high-severity security issues (markdown injection in result rendering and an uncapped result_text channel bypassing sandbox output limits), 1 medium-severity resource exhaustion vector (large image files read into memory before aggregate cap check), and 1 low-severity maintenance issue (version not covered by version consistency checks). Files Reviewed (28 files) |
There was a problem hiding this comment.
Risk: 🟠 High (78/100) — 2 high findings, 1 medium, 1 low · 3731 LOC across 28 files
Overview
This PR introduces open-webui-tenki, a sandboxed code execution plugin for Open WebUI leveraging a remote microVM sandbox. The review identified 4 findings — 2 high, 1 medium, 1 low — across correctness, security, and resource-isolation dimensions.
High Severity
-
Markdown injection via unsanitized sandbox output (
src/open_webui_tenki/result.py:71):to_chat_markdown()wraps raw stdout/stderr/result in triple-backtick code fences without escaping backtick sequences in the output. Sandbox output containing ``` can prematurely close the fence, rendering subsequent text as live markdown in chat. A second vector exists through crafted code-fence info strings flowing throughextract_last_code_block→ `build_run_plan` ValueError → error rendering. This enables UI spoofing and potential phishing in the chat interface. -
Uncapped
result_textbypassesmax_output_byteslimit (src/open_webui_tenki/core.py:165): The Python runner writesrepr()of the last expression toRESULT_FILENAME. While stdout/stderr are properly capped via_decode_capped(),result_textis read withsandbox.fs.read_text()with no size limit. A sandbox program ending in an expression with a multi-hundred-MBrepr()bypasses the output-containment guarantee and can cause host memory exhaustion.
Medium Severity
- Large image files read entirely into memory before aggregate cap check (
src/open_webui_tenki/core.py:78):_collect_imagesreads each candidate file viasandbox.fs.read_bytes()before checking the 10 MB aggregate cap. A sandboxed user can write a 500 MB.pngfile; the entire file loads into host memory before the cap check breaks the loop, undermining resource-isolation guarantees.
Low Severity
__version__not covered by version consistency checks (src/open_webui_tenki/__init__.py:23):scripts/check_version.pyvalidates versions acrosspyproject.tomland the two distributable frontmatters but ignores__init__.py.__version__.CONTRIBUTING.mdversion-bump instructions also omit it. No code currently imports__version__, but it creates a future maintenance trap.
| Agent | Model |
|---|---|
v2-correctness |
deepseek-v4-pro |
v2-sweep |
claude-haiku-4-5 |
v2-domain-specialist |
deepseek-v4-pro |
v2-security |
deepseek-v4-pro |
v2-verifier |
deepseek-v4-pro |
v2-holistic |
deepseek-v4-pro |
v2-concurrency |
deepseek-v4-pro |
v2-triaged-orchestrator |
deepseek-v4-pro |
v2-triage |
deepseek-v4-flash |
What this is
open-webui-tenkiis a community plugin that lets Open WebUI run code inside isolated, ephemeral Tenki microVM sandboxes — keeping arbitrary, model- or user-written code off the Open WebUI host.It ships two entry points over one shared async execution core:
Tenki Sandbox) — the model writes code, runs it in a fresh sandbox, reads the output (stdout, stderr, tracebacks, charts), and iterates. Fully autonomous within the model's tool loop.Tenki Sandbox — Run Code) — a Run code button under a message that executes its code block and streams the output back inline.How it behaves
How it's built & distributed
The logic lives once in
src/open_webui_tenki/.scripts/build.pyinlines it into the two self-contained single files underopen-webui/, so operators can one-click import them from the community hub with no manual dependency install. CI verifies the committed distributables stay in sync with the source.Testing
tests/unit) — mocked SDK, no credentials: config, rendering, teardown, timeout, truncation, credential precedence, build integrity, and both entry points.tests/integration) — gated onTENKI_API_KEY; provisions real microVMs and exercises Python/shell, tracebacks, timeouts, inline image capture, guaranteed teardown (no leaks), and both the Tool and Action paths.Docs
README.md(install, configuration, security posture),TESTING.md(test layers), andCONTRIBUTING.md(dev loop, release, hub-publish steps).Publish in the Community portal
Create a new listing (a "post") on openwebui.com for each plugin: one for the Tool, one for the Function.
Screenshots
Setup
Tool usage
Function/Actions usage