Skip to content

Commit 25c5fd1

Browse files
authored
Merge branch 'release-1.10.0' into docs-build-docker-from-source
2 parents d4f35bb + 104d941 commit 25c5fd1

71 files changed

Lines changed: 4404 additions & 2012 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/docs_development.mdc

Lines changed: 71 additions & 264 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/api/v1/chat.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4+
import re
45
import time
56
import traceback
67
import uuid
@@ -637,6 +638,36 @@ async def build_flow_and_stream(flow_id, inputs, background_tasks, current_user)
637638
)
638639

639640

641+
# Public flow file paths must be `{source_flow_id}/{safe_basename}` — uploads
642+
# under that namespace are the only legitimate inputs for an unauthenticated
643+
# build. Anything else (absolute paths, traversal, foreign flow_ids) is a
644+
# probe at the arbitrary-file-read class of bug.
645+
_PUBLIC_FILE_PATH_RE = re.compile(
646+
r"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})/([^/\\]+)$"
647+
)
648+
_PUBLIC_FILE_REJECTED_SUBSTRINGS = ("\x00", "..", "\\")
649+
650+
651+
def _validate_public_files(files: list[str] | None, source_flow_id: uuid.UUID) -> None:
652+
"""Reject file references that aren't `{source_flow_id}/{basename}`."""
653+
if not files:
654+
return
655+
expected_flow_id = str(source_flow_id).lower()
656+
for entry in files:
657+
if not isinstance(entry, str) or not entry:
658+
raise HTTPException(status_code=400, detail="Invalid file entry")
659+
if any(token in entry for token in _PUBLIC_FILE_REJECTED_SUBSTRINGS):
660+
raise HTTPException(status_code=400, detail="Invalid file path")
661+
match = _PUBLIC_FILE_PATH_RE.match(entry)
662+
if not match:
663+
raise HTTPException(status_code=400, detail="Invalid file path format")
664+
flow_id_segment, basename = match.group(1), match.group(2)
665+
if flow_id_segment.lower() != expected_flow_id:
666+
raise HTTPException(status_code=400, detail="File not in this flow's namespace")
667+
if basename in (".", ".."):
668+
raise HTTPException(status_code=400, detail="Invalid filename")
669+
670+
640671
@router.post("/build_public_tmp/{flow_id}/flow")
641672
async def build_public_tmp(
642673
*,
@@ -694,6 +725,11 @@ async def build_public_tmp(
694725
Dict with job_id that can be used to poll for build status
695726
"""
696727
try:
728+
# Reject caller-supplied file references that aren't scoped to this
729+
# public flow's own storage namespace. Done before any flow lookup so
730+
# malformed requests fail fast and don't touch the DB.
731+
_validate_public_files(files, flow_id)
732+
697733
# Verify this is a public flow and get the associated user
698734
client_id = request.cookies.get("client_id")
699735
# Only use authenticated user_id when auto-login is disabled.

src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Invoice Summarizer.json

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Market Research.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/News Aggregator.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Nvidia Remix.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Pokédex Agent.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Price Deal Finder.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)