Restricting code execution in Open WebUI

Learn when to keep chat code execution and the code interpreter on in Open WebUI, what the Pyodide default can and cannot reach, and how to turn off plugins with ENABLE_PLUGINS.

On this page

Should code execution in Open WebUI stay on for your users?

Code execution and the code interpreter are two separate decisions in Open WebUI, and each carries a different risk, so each should be set on purpose rather than left at whatever the installed version does. In a shared deployment, a user may ask the model to write and run code, and the model's output may be executed in an environment that touches files, network access or data the user can reach. Before you enable anything, decide which of these two capabilities your users actually need, who may use them, and where the code is allowed to run.

In general terms, code execution lets a model or a user run generated code and return the result into the chat, which is useful for calculations, data transformations, charts and quick checks of logic. Teams usually keep it on for analysts and engineers working on bounded data, and in deployments where the execution environment is isolated from the company network and from other users' files. Teams usually disable it, or restrict it to a small group, when the instance serves broad staff, handles sensitive records, or runs on a host that also holds credentials or internal services. Plugins are a related but separate surface: ENABLE_PLUGINS turns plugin functionality off entirely, which is the simplest control if you do not need plugins at all. Confirm the current names, defaults and permission settings for code execution in the Open WebUI features documentation for your installed version before you write them into a configuration baseline.

Configuration options for code execution and plugins

This table compares four postures for chat code execution and the code interpreter in Open WebUI, from the default Pyodide path to turning plugins off entirely. For each option it shows where code runs, what it can reach, who should hold the capability and the main trade-off. Confirm exact setting names and defaults in the Open WebUI features documentation and the release notes for your version before you change anything.

OptionWhere code runs and what it can reachWho should have it and main trade-off
Enabled with the Pyodide defaultCode runs in a WebAssembly Python runtime in the user's browser, so it has no direct access to the Open WebUI server filesystem or host network. Confirm this behavior for your version.Suits general users doing light calculations and data exploration. Trade-off: browser-side execution is limited in libraries and compute, and users may expect server-side capabilities.
Enabled with a sandboxed alternativeCode runs in a separate execution service or container that you operate, outside the Open WebUI process. Reach depends on how the sandbox is networked and mounted, so verify it.Suits teams that need server-side libraries or files with isolation. Trade-off: you own the sandbox's patching, resource limits, network egress and logging, which adds operating work.
Enabled only for a trusted groupExecution is available to a named group through role-based access control, on whichever runtime you chose. Access is controlled by Open WebUI permissions, not by code isolation alone.Suits analysts or developers with a documented need. Trade-off: group membership drifts over time, so review it on a schedule and confirm the permission applies to every path that runs code.
Disabled entirely with ENABLE_PLUGINS turned offNo user-supplied plugin or tool code is loaded or executed by the server. Confirm which code paths ENABLE_PLUGINS covers in your release, since code interpreter behavior may be governed by separate settings.Suits shared or regulated deployments without a current need for code. Trade-off: users lose analysis features, and you must verify that every code path is off, not only the one you changed.

How to decide which code execution setting fits

The decision starts with whether users need code run for analysis at all. If they do not, code execution and plugins should be disabled. If they do, the path checks data sensitivity, whether a sandboxed runtime is available and approved, whether tools or plugins are in use, and whether the instance is shared across teams. Each hand-off narrows the setting, so confirm the answers in your own environment before choosing a branch.

Decision path from code need to the code execution setting.

Which setting fits each deployment situation

A small group of trusted testers can usually keep code execution on, provided the instance is disposable and holds no production data. The aim is to learn how the feature behaves, not to run it against live business records. Keep the environment separate from internal systems so that a mistake in testing has nowhere sensitive to reach.

  • Start with the default runtime: Use the Pyodide default and confirm which execution path your version uses before testers begin.
  • Use a disposable instance: Run the evaluation on a separate instance with test accounts, no production files and no connections to internal databases or directories.
  • Grant access by name: Give code access to named testers through role settings and leave it off for everyone else.
  • Decide on plugins up front: Set ENABLE_PLUGINS on purpose, and turn it off if the test does not need plugins.
  • Confirm network reach: Check which hosts the test instance can contact, including internal addresses and cloud metadata endpoints.

Before you finish, record the exact settings tested, the version tested, the named testers, the network checks and any open questions in the change ticket, so the same choices carry into any later rollout.

How to restrict code execution in Open WebUI step by step

This sequence turns a code execution decision into tested settings. It records what runs today, sets a stance for each user group, and confirms in staging that restricted users cannot run code or reach internal hosts before the change reaches production.

  1. Inventory users and models that need code execution

    Ask each group owner which teams run code blocks, data analysis or the code interpreter, and which models they use for that work. Record each group name, the models involved and the business reason in a shared register with a named owner. The step is done when every group has a stated yes or no, and the owners have confirmed the list. Confirm group names against the admin panel so the register matches what the platform enforces.

  2. Record current settings in the admin panel and environment

    Capture the code execution, code interpreter and plugin settings for each group from the admin panel of the running instance. Then check the container or Helm configuration for the ENABLE_PLUGINS value and any related variables, so you know whether a setting is controlled in the interface or in deployment files. Save screenshots or exports with the date and version. The step is done when the baseline document matches what the running instance reports.

  3. Decide the target stance for each group

    For each group, choose one of three stances: code execution off, on with the default Pyodide engine, or on through a separately hosted sandboxed service. Base the choice on who the users are, how sensitive the data is and what network paths the execution environment can reach. The security owner and the business owner should both approve each decision in writing. The step is done when every group has an approved stance in the register.

  4. Apply the change in a staging instance first

    Build or refresh a staging instance from the same deployment files and version as production, then copy the group and permission structure into it. Apply the target stance for each group in staging only. Compare the Open WebUI version with the release notes for any changes to code execution defaults. The step is done when staging shows the same settings as the approved decision record, and the version is recorded.

  5. Disable plugins with ENABLE_PLUGINS where unused

    If no team needs plugins, set ENABLE_PLUGINS to off in staging and restart the service. Treat plugins as a separate decision from code blocks, because they extend what the platform can run. Sign in and confirm that plugin entries are absent from the interface and that the admin pages no longer offer plugin management. The step is done when the plugin entries are absent for every account type tested in the next steps.

  6. Test with a standard user account

    Sign in as a standard user in a restricted group and confirm that no code execution option appears in the chat. Then sign in as a user in a group where execution stays on, and ask the model for code that attempts to reach an internal host address and a cloud metadata address. Confirm the connection is refused by the platform or the container egress rules. The step is done when results for each group are written in the test log with the expected outcome.

  7. Test with an admin account and document results

    Repeat the same checks as an administrator, since admin pages expose more settings and can change the behavior of a group. Confirm that an admin cannot switch on a feature for a restricted group without a recorded change. Note any setting that an admin can change from the interface, and decide whether that is acceptable or should be locked by deployment configuration. The step is done when the test log is signed by the security owner.

  8. Promote the change and recheck production

    Apply the same settings in production during an approved change window, then repeat the standard user and admin checks against production. Keep the baseline and test log with the deployment files so that the next upgrade can be compared against them. Upgrades can change defaults, so schedule the same checks after each version change. The step is done when production matches the approved register and the post-change checks are recorded.

Security and operational risks to control

Turning chat code execution on exposes the browser, the server, the network and the host to code that a model or user writes. Each risk below has a control, and each control has an owner who must agree to it before the feature is enabled for anyone.

Browser-side runtime access

The default Pyodide runtime runs Python inside the user's browser, so it cannot read server files directly. The risk is what the browser session can reach: the signed-in user's chats, API keys and any data the page loads. Check that the browser sandbox is the only runtime enabled, that users cannot paste secrets into code cells, and that session lifetime matches your policy. Owner: the security team with the application administrator.

Server-side execution exposure

A server-side interpreter runs code with the privileges of the Open WebUI process and its container, which can include the data directory and any mounted secrets. Decide whether server execution is needed at all. If it is, confine it to an isolated sandbox with no access to the database, the secret key or the host filesystem. Owner: the platform team, who owns the container and host configuration.

Plugin and tool code privileges

Plugins and tools are Python code that runs with server privileges, separate from the sandbox that runs generated code. Setting ENABLE_PLUGINS to false disables this path entirely, which is the simpler control when no plugin is approved. Confirm the flag's current behavior in the release you run, and review who can create or import functions. Owner: the application administrator, with sign-off from security.

Network egress from executed code

Code that runs on the server or in a sandbox can open outbound connections to internal services, cloud metadata endpoints or external hosts, and can exfiltrate data that it reads. Limit egress at the container or network layer and decide which destinations code may reach. The outbound request topic covers private address blocking and egress rules in detail. Owner: the network team.

Resource exhaustion from long-running code

A loop or memory-heavy script can hold a worker process, consume CPU and memory, and slow chat for every other user on the same replica. Set execution timeouts and resource limits on any server-side runtime, and watch for runaway processes in container metrics. Test with a deliberately slow script before rollout. Owner: the platform or operations team.

Logging of code and outputs

Executed code and its output can contain personal data, credentials or proprietary logic, and may be stored in chat history. Decide what is logged, where, and who can read it, and make sure execution records do not leak into general container logs. The audit logging topic covers log levels and SIEM shipping. Owner: the compliance team with the operations team.

What the Pyodide default changes about the risk

The Pyodide default changes where the risk sits. Pyodide is a Python runtime compiled to WebAssembly, so code generated for a chat can run inside the user's browser tab instead of in a Python process on the Open WebUI server. For the operator, the main concern moves from the server host, including its filesystem, environment variables and mounted volumes, to the browser session. Code running in the tab does not get the server's container or host file system by default, so a generated script should not be able to read WEBUI_SECRET_KEY from the server environment. Confirm that boundary in the Open WebUI and Pyodide documentation for your version before you rely on it.

Pyodide does not limit what the browser session can already see. Code in the tab can reach the conversation, the files and outputs the user has loaded into that session, and anything the page's JavaScript context exposes. A prompt injection carried in an uploaded document or a web page can still steer the code the model writes, and that code runs with the user's view of the data. Browser-side code also does not pass through the server's egress rules, so the outbound controls covered elsewhere in this group do not govern it. Ask the vendor which network requests, storage APIs and browser permissions the runtime can use in your version, since these details change between releases.

Treat the default as lower server-side exposure, not as a sandbox guarantee. Record which data users can paste or upload into chats where code execution is on, and decide whether browser-side execution is acceptable for each data class. Then test it: send a prompt asking generated code to list environment variables, read a mounted path and make an outbound request, and observe what happens from both the server and the browser. Repeat the test after each upgrade, because a change to the runtime or to the execution mode can move the boundary.

Questions buyers ask about restricting code execution

Do we need an outside team to restrict code execution in Open WebUI?

No, an outside team is not required, but many organizations bring one in when the change touches identity, network egress and several user groups at once. Your own platform team can change the settings in ENABLE_CODE_EXECUTION, ENABLE_CODE_INTERPRETER and ENABLE_PLUGINS on a test instance. An outside partner adds value when you need a documented decision for each group, a tested sandbox choice and evidence for a security or compliance review. Ask any partner to state in writing which of those outputs they will deliver.

How long does a code execution restriction review take?

The duration depends on how many user groups, environments and sandbox options are in scope, and on how quickly your team can provide access and decisions. A single instance with one admin group and a clear policy is a much smaller job than a multi-environment deployment where different departments need different permissions. No duration is set here because none has been supplied for this topic. Ask for a timeline in the written scope that lists the environments, the review steps and the dependencies on your staff.

What do we need to provide before a restriction review starts?

Plan to provide admin access to the staging instance, a copy of your current configuration and a list of user groups with their intended use cases. Include the people who approve security exceptions, since they decide whether code execution stays on for any group. It also helps to share the network controls around the container so the review can check which outbound paths exist. Confirm these items with your partner before work begins so the schedule does not depend on access requests.

Can our own team restrict code execution without a partner?

Yes, a capable platform team can make these changes alone, because the controls are configuration settings and the process is documented in the Open WebUI project. The main risk is not the setting itself but the decisions around it: which groups keep code execution, which sandbox to use and how to prove the result. Your team should test each change on a staging instance, record the expected behavior and repeat the checks after every upgrade. Your team also needs someone to own the policy long term.

What drives the cost of a restriction project up or down?

The main cost drivers are the number of environments, the sandbox option you choose and the depth of testing you require. Each additional environment, such as a separate instance for a sensitive group, adds configuration and verification work. A managed or externally hosted sandbox usually adds integration and network review compared with the default Pyodide option. Deeper testing, including attempts to escape a sandbox or misuse plugins, adds time but produces stronger evidence. Costs for setup are one-time, while retesting after upgrades and policy changes recurs.

What should a quote for this work include?

A quote should list the environments in scope, the decisions it covers (code execution, code interpreter, plugins and sandbox choice), the testing steps and the deliverables. Ask for the configuration changes to be documented, for a verification report showing each control was tested and for a recommended retest schedule after upgrades. The quote should also name what the client must provide, who approves exceptions and how changes are handed over. Fixed-scope agreements put these items in writing before work starts, so compare quotes on those lists rather than on headline totals.

Does disabling code execution remove all security risk from Open WebUI?

No, turning off code execution removes one path to running code on the server, but it does not address every risk in the deployment. Tools, outbound web requests, file uploads and admin access can still expose data or allow misuse, so they need their own controls. Treat code execution restriction as one part of a wider hardening plan, and confirm with your security team which other controls apply to your environment.

Limits to confirm in your environment

The settings, defaults and license terms that govern code execution vary by release and by how you deploy. Each card below names one thing to confirm in your own environment before you commit to a configuration, so the decision rests on your version and your network rather than on memory of the docs.

Exact setting names and defaults

Confirm the variable names, their defaults and where they can be set (environment variable, admin panel or both) for the exact release you run. Code execution and plugin controls have moved between releases, so a setting copied from an older guide may not exist or may behave differently. Check the release notes for your version before you write the configuration into your deployment templates, and record the version alongside the configuration in your change record.

Open WebUI releases

Sandboxed alternative support

Confirm whether your release supports the sandboxed execution option you are considering, and what it needs from your platform, such as a separate service, a container runtime or additional permissions. Do not assume a sandbox is available because a docs page mentions one. Ask whether the default in-browser Pyodide runtime is the only option in your version, and what isolation it does and does not provide for your users.

Outbound requests from executed code

Find out whether code that runs in your deployment can reach the internet, internal subnets, cloud metadata endpoints or other services. Execution that happens in the browser follows different network paths than execution on the server, so the answer depends on where the code runs. Test with a harmless script that attempts an outbound connection, and confirm the result with your network team and your container egress rules.

Plugin and tool permission interaction

Confirm how the code execution setting interacts with the permission that lets users or groups add tools, functions and plugins. A tool can run code even when the code interpreter is off, so disabling one control may not disable the other. Map which roles can create, import or enable each capability, and test that a non-admin account cannot reach them through the interface or the API.

Upgrade behavior for these settings

Confirm whether an upgrade keeps your current values, resets them to defaults, or adds new settings that default to a permissive state. Review the release notes for each version between your current and target release, and rerun your verification tests after every upgrade. Keep the settings in version-controlled configuration so that a change is visible in review rather than discovered later.

License terms at your deployment size

The Open WebUI License applies a branding clause to deployments above a user threshold in a rolling 30-day period, and the terms differ for older releases under BSD-3-Clause. Confirm which license applies to the release you run and whether your expected user count crosses the threshold, because that determines whether you may change branding and which support path is open to you. Ask your legal team to review the Open WebUI License terms against your planned seat count.

Branding clause threshold
50 users
Open WebUI License docs

How DeployOpen scopes and delivers code execution controls

DeployOpen starts by deciding with your team whether chat code execution and the code interpreter should stay on for each user group. We then implement the chosen setting, test it against your actual permissions, and hand over the configuration and the evidence your security and compliance teams need to review it.

How we scope

  • Inventory which user groups need code execution, which only need chat, and who can change these settings
  • Decide whether the Pyodide default, a sandboxed alternative or ENABLE_PLUGINS=false fits each group's risk
  • Agree the written scope, deliverables and timeline in writing before any configuration changes begin
  • Confirm with your team which Open WebUI version and deployment method the controls must cover

How we build

  • Apply the agreed code execution and interpreter settings in your own infrastructure, not a DeployOpen environment
  • Configure admin and group permissions so only approved roles can enable or use code execution features
  • Test that blocked features stay blocked for regular users, including attempts through API keys and tools
  • Confirm the sandbox or Pyodide setting behaves as documented in your deployed version before sign-off

How we hand over

  • Document each code execution setting, its owner, its default and the reason it was chosen
  • Provide test cases and results so your team can rerun the checks after upgrades or configuration changes
  • Walk through the controls with your security, platform and compliance staff and record their questions
  • Hand over the configuration in a form your team can maintain without DeployOpen involvement

How we support

  • Review code execution settings again when Open WebUI releases change how the interpreter or plugins behave
  • Retest the controls after upgrades, using the same cases from handover, and report any regressions
  • Offer ongoing support, upgrades and continuous testing as a retainer if your team wants that coverage
  • Agree in the quote which support hours, reviews and retests are included and which are billed separately

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.