Skip to content

Commit c08a465

Browse files
mendonkaimurphy
andauthored
docs: block custom components with env var (#12413)
* initial-changes * fix-broken-links * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
1 parent 8c08e1b commit c08a465

5 files changed

Lines changed: 39 additions & 5 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Block custom components
3+
slug: /deployment-block-custom-components
4+
---
5+
6+
Custom components and the component code editor allow Langflow users to create and execute Python code in the Langflow runtime.
7+
While this freedom is a feature of Langflow, in some deployments you might want to block the creation of custom Langflow components to prevent arbitrary code execution.
8+
9+
To block custom component creation on a Langflow server, set the following [environment variable](/environment-variables):
10+
11+
```bash
12+
LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false
13+
```
14+
15+
When set to `false`, Langflow blocks creating custom components and changing code in the visual editor.
16+
17+
When unset or `true`, Langflow allows custom code.
18+
Existing Langflow installations will keep the default `true` behavior until you opt in to this restriction.
19+
20+
This environment variable is a beta feature, and should not be your only safeguard in production environments.
21+
22+
In the event that Langflow could execute untrusted or LLM-generated code, run Langflow in an isolated and containerized execution environment.
23+
24+
For more information, see [Security](/security).

docs/docs/Deployment/security.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ title: Security
33
slug: /security
44
---
55

6-
The Langflow UI is an IDE and code execution platform, which means that Langflow is inherently capable of executing arbitrary,
7-
developer-provided code.
8-
By design, the Langflow UI includes a code editor allowing developers to author and execute arbitrary Python with full access to the host
9-
Langflow backend process, filesystem, and network.
6+
The Langflow UI is an IDE and code execution platform, which means that Langflow is inherently capable of executing arbitrary, developer-provided code.
7+
By design, the Langflow UI includes a code editor allowing developers to author and execute arbitrary Python with full access to the host Langflow backend process, filesystem, and network.
108
In addition, some components wrap and use code execution, including use of AI models to generate code to be executed based
119
on user input.
1210

@@ -25,7 +23,8 @@ You are responsible for the following:
2523
Langflow is a code execution platform with full access to your local system.
2624
You are responsible for ensuring the safety of flows you execute.
2725

28-
In the event that Langflow could execute untrusted or LLM-generated code, consider using isolated or containerized execution environments. For more information, see [Containerize a Langflow application](/develop-application).
26+
In the event that Langflow could execute untrusted or LLM-generated code, consider [blocking custom component execution](./deployment-block-custom-components.mdx) and running Langflow in an isolated and containerized execution environment.
27+
For more information, see [Containerize a Langflow application](/develop-application).
2928

3029
## Secure first-party deployments
3130

docs/docs/Develop/environment-variables.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ See [Telemetry](/contributing-telemetry).
433433
| `LANGFLOW_AUTO_SAVING_INTERVAL` | Integer | `1000` | Set the auto-save interval in milliseconds if `LANGFLOW_AUTO_SAVING=True`. |
434434
| `LANGFLOW_BUNDLE_URLS` | List[String] | `[]` | A list of URLs from which to load custom bundles. Supports GitHub URLs. If `LANGFLOW_AUTO_LOGIN=True`, flows from these bundles are loaded into the database. |
435435
| `LANGFLOW_COMPONENTS_PATH` | String | Not set | Path to a directory containing custom components. Typically used if you have local custom components or you are building a Docker image with custom components. |
436+
| `LANGFLOW_ALLOW_CUSTOM_COMPONENTS` | Boolean | `True` | If `false`, disables custom components and in-editor editing of component code. This feature is in beta. For more information, see [Block custom components](../Deployment/deployment-block-custom-components.mdx). |
436437
| `LANGFLOW_LOAD_FLOWS_PATH` | String | Not set | Path to a directory containing flow JSON files to be loaded on startup. Typically used when creating a Docker image with prepackaged flows. Requires `LANGFLOW_AUTO_LOGIN=True`. |
437438
| `LANGFLOW_CREATE_STARTER_PROJECTS` | Boolean | `True` | Whether to create templates during initialization. If `false`, Langflow doesn't create templates, and `LANGFLOW_UPDATE_STARTER_PROJECTS` is treated as `false`. |
438439
| `LANGFLOW_UPDATE_STARTER_PROJECTS` | Boolean | `True` | Whether to update templates with the latest component versions when initializing after an upgrade. |

docs/docs/Support/release-notes.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ For all changes, see the [Changelog](https://github.com/langflow-ai/langflow/rel
7777
Please do not report security vulnerabilities through public GitHub issues or GitHub security advisories.
7878
For the full policy and what to include in a report, see the [Langflow Security Policy](https://github.com/langflow-ai/langflow/blob/main/SECURITY.md).
7979

80+
- Disable custom components
81+
82+
Set `LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false` to disable custom components and in-editor editing of component code.
83+
For more information, see [Block custom components](../Deployment/deployment-block-custom-components.mdx).
84+
8085
## 1.8.x
8186

8287
Highlights of this release include the following changes.

docs/sidebars.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ module.exports = {
270270
},
271271
]
272272
},
273+
{
274+
type: "doc",
275+
id: "Deployment/deployment-block-custom-components",
276+
label: "Block custom components",
277+
},
273278
{
274279
type: "doc",
275280
id: "Deployment/security",

0 commit comments

Comments
 (0)