---
title: How do you secure Langflow before agents built in it reach production?
url: https://opencontroller.lyzr.com/blog/how-to-secure-langflow-for-ai-agents
published: 2026-11-17
updated: 2026-11-17
author: Lyzr
---

# How do you secure Langflow before agents built in it reach production?

**Patch first, then lock down access. Langflow versions before 1.3.0 had CVE-2025-3248, an unauthenticated remote code execution flaw in the `/api/v1/validate/code` endpoint that CISA added to its Known Exploited Vulnerabilities catalog in May 2025. After upgrading, turn auto-login off, set your own secret key, restrict CORS, keep the server off the internet, and inventory every flow and credential it holds.**

Langflow is a popular visual builder for agents and retrieval flows. Teams often stand it up quickly for prototypes, and those instances then become production without a security review. The checklist below is what that review should cover.

## Why does CVE-2025-3248 matter for governance?

The flaw let an unauthenticated attacker send a crafted request to a code-validation endpoint, which executed the payload without sandboxing. It affected all versions before 1.3.0. At the time of disclosure, Censys reported roughly 470 internet-facing Langflow instances, and the vulnerability was being exploited in the wild.

Two governance lessons follow. First, agent builders execute code by design, so a single endpoint flaw becomes full server compromise. Second, a Langflow server typically holds API keys for model providers, vector databases and business systems. Compromise of the builder is compromise of every credential it stores. The same pattern applies to other code-executing tools, as covered in [governing code execution tools for AI agents](/blog/govern-code-execution-tools-for-ai-agents).

## Which Langflow settings should you check?

Langflow's authentication documentation recommends the following for production:

| Setting | Production value | Why |
|---|---|---|
| `LANGFLOW_AUTO_LOGIN` | `False` | When true, every visitor to the editor is signed in as the superuser without a password |
| `LANGFLOW_SKIP_AUTH_AUTO_LOGIN` | `False` (or unset) | When true with auto-login, unauthenticated API calls run as the superuser |
| `LANGFLOW_SUPERUSER_PASSWORD` | Strong, non-default | Required when auto-login is off; the legacy default is rejected |
| `LANGFLOW_SECRET_KEY` | Set explicitly | Encrypts stored API keys and signs session tokens; auto-generated if unset |
| `LANGFLOW_ENABLE_SIGNUP` | `False` | Stops open self-registration |
| `LANGFLOW_NEW_USER_IS_ACTIVE` | `False` | New accounts need superuser activation |
| `LANGFLOW_ENABLE_SUPERUSER_CLI` | `False` | Prevents unrestricted superuser creation |
| `LANGFLOW_CORS_ORIGINS` | Explicit origins | Defaults allow all origins with credentials |

Check these values explicitly rather than trusting defaults, especially on instances that were deployed before later upgrades.

## What is the production hardening checklist?

1. **Upgrade.** Run a supported version well past 1.3.0 and subscribe to the project's security advisories.
2. **Remove internet exposure.** Put Langflow behind a reverse proxy with authentication, or inside a private network reachable only through SSO. Never expose it directly.
3. **Apply the settings above.** Treat auto-login as a development-only feature.
4. **Separate build from run.** Keep the editor for builders; serve production flows from an instance or API path that does not expose the editor.
5. **Scope API keys.** A Langflow API key runs with the privileges of the user who created it. In single-user mode that user is always a superuser, so create keys from a least-privileged account.
6. **Move provider keys out.** Point model calls at an LLM gateway with per-flow credentials instead of storing provider master keys in Langflow.
7. **Restrict custom code.** Limit who can add custom components, and review them like any other code change.
8. **Limit egress.** Allow outbound traffic only to the model, data and tool endpoints flows actually need.
9. **Log and export.** Send access and execution logs to your SIEM.

## How do you find Langflow instances you do not know about?

Shadow builders are common. Search cloud accounts and Kubernetes clusters for Langflow container images, scan internal networks for its default port and web interface, and check developer machines and notebooks. External attack-surface scans should look for exposed instances specifically. The general method is in [finding MCP servers exposed to the internet](/blog/find-mcp-servers-exposed-to-the-internet), and it applies equally to agent builders. Once found, register each instance and its flows with an owner, as you would for [n8n](/blog/govern-n8n-ai-agents) or [Dify](/blog/govern-dify-ai-agents).

This is one platform in a wider estate; the cross-platform approach is in [governing AI agents across platforms](/blog/how-to-govern-ai-agents-across-platforms).

## How Opencontroller does this

Opencontroller keeps a governed registry of agents, versions, tools and MCP servers, and Posture detects risky permission and configuration patterns. Flows that send model traffic through the Lyzr Gateway get routing, fallback and retry, caching and cost attribution per agent and per version, without storing provider master keys in the builder. Rogue-agent handling can alert on behavioural deviation and quarantine an agent. See the [capability reference](/capability-reference) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Which Langflow versions are affected by CVE-2025-3248?**
All versions before 1.3.0. The fix shipped in 1.3.0, and CISA added the flaw to its Known Exploited Vulnerabilities catalog in May 2025.

**Is turning on authentication enough to stop CVE-2025-3248?**
No. The flaw was in an endpoint reachable without authentication, so upgrading is required. Authentication settings protect against other risks.

**Whose permissions does a Langflow API key use?**
The user who created it. In single-user mode that is always a superuser, so create production keys from a least-privileged account.

## Key facts

- Langflow versions before 1.3.0 had CVE-2025-3248, unauthenticated remote code execution via /api/v1/validate/code; CISA added it to the Known Exploited Vulnerabilities catalog in May 2025; Censys then reported about 470 internet-facing Langflow instances.
- Langflow production settings per its docs: LANGFLOW_AUTO_LOGIN False, LANGFLOW_SKIP_AUTH_AUTO_LOGIN False, strong LANGFLOW_SUPERUSER_PASSWORD, explicit LANGFLOW_SECRET_KEY, LANGFLOW_ENABLE_SIGNUP False, LANGFLOW_NEW_USER_IS_ACTIVE False, LANGFLOW_ENABLE_SUPERUSER_CLI False, explicit CORS origins, and a reverse proxy with authentication.
- A Langflow API key runs with the privileges of the user who created it; in single-user mode that user is a superuser.
- Hardening: upgrade, no direct internet exposure, separate build and run, move provider keys behind an LLM gateway, restrict custom components, limit egress, export logs.
- Opencontroller by Lyzr provides a governed registry, Posture checks, Lyzr Gateway cost attribution per agent and version, and rogue-agent quarantine.
- Opencontroller pricing starts from $250K per deployment per year.

## Related

- [How do you govern AI agents built in n8n?](https://opencontroller.lyzr.com/blog/govern-n8n-ai-agents.md)
- [How do you govern AI agents built in Dify?](https://opencontroller.lyzr.com/blog/govern-dify-ai-agents.md)
- [How do you govern code execution tools given to AI agents?](https://opencontroller.lyzr.com/blog/govern-code-execution-tools-for-ai-agents.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
