langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Langflow Assistant fails with LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false: built-in flow ships Keyword Search as inline custom code (1.13.1)

Open david-streamlio opened this issue 3 weeks ago • 4 comments

Bug description

LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false is one of the two lockdowns that Langflow's startup SECURITY warning recommends for multi-user installs. With it set, every Langflow Assistant request fails:

Flow build blocked: custom components are not allowed: Keyword Search (DataFrameKeywordSearch-b8MUN)

Cause (from the 1.13.1 source)

langflow/agentic/flows/LangflowAssistant.json contains node DataFrameKeywordSearch-b8MUN with "edited": true and inline code that matches no server template. The custom-component policy therefore treats a component Langflow ships itself as custom code. It is the only edited node in the Assistant's flows.

Workaround, and a second problem it exposes

We copy that node's code, byte for byte, from the image into a directory on LANGFLOW_COMPONENTS_PATH, which is trusted because allow_components_paths_override defaults to true. The legacy component loader then registers its hash, and the "custom components are not allowed" block goes away.

The component's code uses IntInput without importing it:

from langflow.io import DataFrameInput, MessageTextInput, DropdownInput, BoolInput, Output
...
        IntInput(
            name="number_candidates",

So the extension loader logs this at every start:

Extension load error: error[module-import-failed]: Failed to import bundle module .../DataFrameKeywordSearch_<hash>.py: NameError: name 'IntInput' is not defined

Suggested fix

Ship Keyword Search as a regular built-in component, so that its code hash is a known server template, and add IntInput to its imports.

Steps to reproduce

  1. Run langflowai/langflow:1.13.1 with LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false.
  2. Configure a model provider with a model that can call tools.
  3. Create a new flow, open the Assistant and ask it to build any flow.

Environment

  • Langflow 1.13.1, lfx 1.13.1, official image langflowai/langflow:1.13.1 (sha256:9f5220634256d243756d9a59a7210f3e71010eb2dfb20841ccbaae56a22a4267), Python 3.14.8
  • Kubernetes; multi-user with external auth (OIDC)

Related

With the workaround above in place, the Assistant then fails at its Directory step when Langflow uses S3 storage. That's filed separately: https://github.com/langflow-ai/langflow/issues/16364.

david-streamlio avatar Nov 12 '26 01:11 david-streamlio

I'll take this one. Plan: look at the Keyword Search node shipped in LangflowAssistant.json, move it to a regular built-in component so its code hash matches a known server template, and add the missing IntInput import. Then I'll verify the Assistant flow builds with LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false and run the related component/flow tests.

jimmyallinai avatar Nov 12 '26 01:11 jimmyallinai

I'd like to send a PR for this, but first I'd like to check which fix you'd prefer. Both options change something visible:

  1. Ship Keyword Search as a regular built-in component, for example under processing/, and have LangflowAssistant.json use it as an unedited built-in. Its code hash then becomes a known template, so LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false accepts it like any other built-in. The cost is a new public component in the sidebar and a component-index update.
  2. Trust the inline components of the Assistant flows that ship with the server, without making them public components. For example, register the code hashes of the edited nodes in agentic/flows/*.json as trusted when the component cache is built. The cost is a second trust path inside the custom-component policy.

Either way, the missing IntInput import gets fixed.

I lean towards option 1: it reuses the existing mechanism and keeps the policy simple. I'm happy to send the PR for whichever you prefer.

(The related S3 bug, #16364, doesn't depend on this; a PR for it is on the way.)

david-streamlio avatar Nov 12 '26 01:11 david-streamlio

LE-3449

andifilhohub avatar Nov 13 '26 15:11 andifilhohub

The fix has been merged

andifilhohub avatar Nov 19 '26 12:11 andifilhohub