Skip to content

Commit d3ea8eb

Browse files
committed
refac
1 parent 6be9d1e commit d3ea8eb

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

backend/open_webui/utils/middleware.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,7 +2743,7 @@ async def tool_function(**kwargs):
27432743
# Inject builtin tools for native function calling based on enabled features and model capability.
27442744
# Only inject when the request originates from the UI (identified by session_id).
27452745
# API callers don't expect hidden tools; they can explicitly request tools via tool_ids.
2746-
if ENABLE_PLUGINS and use_builtin_tools:
2746+
if use_builtin_tools:
27472747
# Add file context to user messages
27482748
chat_id = metadata.get('chat_id')
27492749
form_data['messages'] = await add_file_context(form_data.get('messages', []), chat_id, user)
@@ -3920,8 +3920,7 @@ def full_output():
39203920
model_capabilities = model.get('info', {}).get('meta', {}).get('capabilities') or {}
39213921
builtin_tools_meta = model.get('info', {}).get('meta', {}).get('builtinTools', {})
39223922
DETECT_CODE_INTERPRETER = (
3923-
ENABLE_PLUGINS
3924-
and bool(features.get('code_interpreter'))
3923+
bool(features.get('code_interpreter'))
39253924
and builtin_tools_meta.get('code_interpreter', True)
39263925
and await Config.get('code_interpreter.enable')
39273926
and model_capabilities.get('code_interpreter', True)

docs/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Your remediation guidance can include, for example:
130130
> Similar to rule "Default Configuration Testing": If you believe you have found a vulnerability that affects admins and is NOT caused by admin negligence or intentionally malicious actions,
131131
> **then we absolutely want to hear about it.** This policy is intended to filter social engineering attacks on admins, malicious plugins being deployed by admins and similar malicious actions, not to discourage legitimate security research.
132132
133-
10. **Tools & Functions Code Execution Is Intended Behavior:** Open WebUI's Tools and Functions feature is **designed** to execute user-provided Python code on the server. This is core, intentional functionality — not a vulnerability (see also 'Threat Model Understanding'). Function creation is **restricted to administrators only**. Tool creation is controlled by the `workspace.tools` permission, which is **disabled by default** for non-admin users and should only be granted to fully trusted users who are equivalent to system administrators in terms of trust. <ins>**Granting a user the ability to create Tools is equivalent to giving them shell access to the server**</ins>. If an administrator grants this permission to untrusted users, this constitutes intentional misconfiguration and is additionally covered by 'Admin Actions Are Out of Scope'. Deployments that do not need built-in Python Tools or Functions plugin execution can set `ENABLE_PLUGINS=false`. More generally, **reports describing ANY attack chain that involves Tools or Functions — including but not limited to code execution, file access, network requests, or environment variable access — will be closed as not a vulnerability / intended behavior.** This applies to both direct code execution and frontmatter-based package installation (`pip install`).
133+
10. **Tools & Functions Code Execution Is Intended Behavior:** Open WebUI's Tools and Functions feature is **designed** to execute user-provided Python code on the server. This is core, intentional functionality — not a vulnerability (see also 'Threat Model Understanding'). Function creation is **restricted to administrators only**. Tool creation is controlled by the `workspace.tools` permission, which is **disabled by default** for non-admin users and should only be granted to fully trusted users who are equivalent to system administrators in terms of trust. <ins>**Granting a user the ability to create Tools is equivalent to giving them shell access to the server**</ins>. If an administrator grants this permission to untrusted users, this constitutes intentional misconfiguration and is additionally covered by 'Admin Actions Are Out of Scope'. Deployments that do not need `workspace.tools` or Functions plugin execution can set `ENABLE_PLUGINS=false`. More generally, **reports describing ANY attack chain that involves Tools or Functions — including but not limited to code execution, file access, network requests, or environment variable access — will be closed as not a vulnerability / intended behavior.** This applies to both direct code execution and frontmatter-based package installation (`pip install`).
134134

135135
> [!IMPORTANT]
136136
> **For administrators:** Treat the `workspace.tools` permission as **root-equivalent access**. Only grant it to users you would trust with direct access to your server. If you enable this permission for untrusted users, you are accepting the risk of arbitrary code execution on your host. For more details, see our [Plugin Security documentation](https://docs.openwebui.com/features/extensibility/plugin/).

0 commit comments

Comments
 (0)