Code execution in the chat — what it would take to do safely (question, not a commitment) #51

Open
opened 2026-11-13 22:55:29 +00:00 by inference-bot · 0 comments
Owner

Code execution in the chat — what it would take to do safely (question, not a commitment)

Same shape as the other infrastructure questions in this tracker: this is a question, not a plan. Nothing is decided, nothing is scheduled, no work has started, and "not worth it" is a legitimate answer.

The question

Should members be able to run code inside the chat (the Code Interpreter feature)? And if so, what would it take to do it safely?

Today the chat cannot execute anything. Attachments are read as text where the provider supports it; there is no interpreter configured (the overlay has no CODE_INTERPRETER_* config) and no such container exists in Cloudron. Nothing here is broken — this is an option we have not taken.

What "code execution" actually means

It is not a switch inside LibreChat. It is a second service: LibreChat sends model-written code to an OpenAI-Assistants-compatible endpoint (CODE_INTERPRETER_BASE_URL) that runs it and returns the output. So the real question is "do we want to operate a code-execution sandbox, and can we make it safe enough to hand to members?"

What must stay unreachable

The code is written by a model at a member's request, so treat it as hostile. It must never be able to reach:

  • the portal's member database — names, emails, Open Collective identities, held credits
  • the LiteLLM master key, the Cloudron API token, the mail and Listmonk tokens
  • any other member's API key

And the part that decides the design: our apps can see each other. The portal calls LiteLLM, mail, Matrix, Loomio and Cloudron's API by internal hostname, all on the same Cloudron network. A sandbox with a route to that network and any credential lying around is a lateral-movement path. So "a new container" only helps if that container holds no secrets, no route to the internal network, and hard resource caps.

Options, with tradeoffs

A. Package the upstream interpreter as its own Cloudron app.
Fastest, and it matches how we already ship custom apps. Isolation is process-level inside that container, so it is only acceptable if the container is credential-free and cannot reach its siblings. Cheapest to build, weakest guarantee.

B. A hardened runner that spawns one ephemeral, network-less container per run.
--network none, read-only rootfs, tmpfs scratch, non-root, dropped capabilities, PID/memory/CPU caps, hard wall-clock kill, nothing persisted between runs. One member's run cannot see another's files, and nothing reaches the co-op's internals.
The catch, stated plainly: the runner needs the Docker socket, which is host-root-equivalent. That container must therefore hold nothing else and must not be reachable from outside. If that is unacceptable, the alternative is a separate host or VM with no inbound path to the co-op's network — real money, real upkeep.

C. Don't.
The current posture. If B's guarantees cannot be met, this stays the honest answer: execution is a capability we can decline, and declining it is not a failure.

What would have to be verified before any plan is credible

  • Does the overlay's patched client expose the code-interpreter UI at all, or is it behind a build flag we would have to patch?
  • Is the upstream interpreter image maintained, or would B mean writing and maintaining a small service ourselves?
  • Can a Cloudron app be denied access to its siblings at the platform level, or must "no network" come from the runner's own container flags? This answer decides whether A can ever be safe.
  • Where would the runner live, given the Docker-socket concession B requires?

Decisions that are ours to make, not a bot's

  1. Who gets it — nobody / agents and sandbox accounts first / all members.
  2. What a run may see — only the files that member uploaded, and never a token that can read other members' data or spend money.
  3. Egress — none by default; anything else needs an argument.
  4. Quotas and who pays — per-run limits, and execution cost visible in the same reconciliation as everything else. A sandbox that burns silently is the same class of hole as an uncredited payment.
  5. Audit — log every execution (who, when) so "what has run on our behalf" is answerable.
  6. Maintenance — a permanent, internet-facing surface to keep patched. This is the real cost, and the main reason C is respectable.

Cost, roughly

Around a day to spike the app and its wiring; one to two days for the hardened runner with limits and audit logging; then a policy call and a pilot. Plus indefinite upkeep.


Filed to think with, not to commit to. Closing it as won't do would be a good outcome — better than shipping a sandbox we cannot stand behind.

# Code execution in the chat — what it would take to do safely (question, not a commitment) Same shape as the other infrastructure questions in this tracker: **this is a question, not a plan.** Nothing is decided, nothing is scheduled, no work has started, and "not worth it" is a legitimate answer. ## The question Should members be able to run code inside the chat (the Code Interpreter feature)? And if so, what would it take to do it *safely*? Today the chat cannot execute anything. Attachments are read as text where the provider supports it; there is no interpreter configured (the overlay has no `CODE_INTERPRETER_*` config) and no such container exists in Cloudron. Nothing here is broken — this is an option we have not taken. ## What "code execution" actually means It is not a switch inside LibreChat. It is a **second service**: LibreChat sends model-written code to an OpenAI-Assistants-compatible endpoint (`CODE_INTERPRETER_BASE_URL`) that runs it and returns the output. So the real question is "do we want to operate a code-execution sandbox, and can we make it safe enough to hand to members?" ## What must stay unreachable The code is written by a model at a member's request, so treat it as hostile. It must never be able to reach: - the portal's member database — names, emails, Open Collective identities, held credits - the LiteLLM master key, the Cloudron API token, the mail and Listmonk tokens - any other member's API key And the part that decides the design: **our apps can see each other.** The portal calls LiteLLM, mail, Matrix, Loomio and Cloudron's API by internal hostname, all on the same Cloudron network. A sandbox with a route to that network and any credential lying around is a lateral-movement path. So "a new container" only helps if that container holds **no secrets, no route to the internal network, and hard resource caps**. ## Options, with tradeoffs **A. Package the upstream interpreter as its own Cloudron app.** Fastest, and it matches how we already ship custom apps. Isolation is process-level *inside* that container, so it is only acceptable if the container is credential-free and cannot reach its siblings. Cheapest to build, weakest guarantee. **B. A hardened runner that spawns one ephemeral, network-less container per run.** `--network none`, read-only rootfs, tmpfs scratch, non-root, dropped capabilities, PID/memory/CPU caps, hard wall-clock kill, nothing persisted between runs. One member's run cannot see another's files, and nothing reaches the co-op's internals. The catch, stated plainly: the runner needs the Docker socket, which is host-root-equivalent. That container must therefore hold nothing else and must not be reachable from outside. If that is unacceptable, the alternative is a separate host or VM with no inbound path to the co-op's network — real money, real upkeep. **C. Don't.** The current posture. If B's guarantees cannot be met, this stays the honest answer: execution is a capability we can decline, and declining it is not a failure. ## What would have to be verified before any plan is credible - Does the overlay's patched client expose the code-interpreter UI at all, or is it behind a build flag we would have to patch? - Is the upstream interpreter image maintained, or would B mean writing and maintaining a small service ourselves? - Can a Cloudron app be denied access to its siblings at the platform level, or must "no network" come from the runner's own container flags? **This answer decides whether A can ever be safe.** - Where would the runner live, given the Docker-socket concession B requires? ## Decisions that are ours to make, not a bot's 1. **Who gets it** — nobody / agents and sandbox accounts first / all members. 2. **What a run may see** — only the files that member uploaded, and never a token that can read other members' data or spend money. 3. **Egress** — none by default; anything else needs an argument. 4. **Quotas and who pays** — per-run limits, and execution cost visible in the same reconciliation as everything else. A sandbox that burns silently is the same class of hole as an uncredited payment. 5. **Audit** — log every execution (who, when) so "what has run on our behalf" is answerable. 6. **Maintenance** — a permanent, internet-facing surface to keep patched. This is the *real* cost, and the main reason C is respectable. ## Cost, roughly Around a day to spike the app and its wiring; one to two days for the hardened runner with limits and audit logging; then a policy call and a pilot. Plus indefinite upkeep. --- Filed to think with, not to commit to. Closing it as *won't do* would be a good outcome — better than shipping a sandbox we cannot stand behind.
inference-bot added the Infrastructure label 2026-11-13 22:55:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: co-op/support#51