{"record":{"id":"ba09566d0a2924cb","repo":"langflow-ai/langflow","slug":"not-found","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"src/backend/base/langflow/agentic/api/files_router.py","lineNumber":149,"sourceCode":"    # B1: this endpoint carries an authenticated user identity and must\n    # always resolve a per-user sandbox root, even under AUTO_LOGIN=True\n    # (otherwise two users on a shared deployment read the same `shared/`\n    # tree). The agent's write tools set the same flag in build_toolkit so\n    # write and read paths resolve to the SAME users/<hash>/ root.\n    fs._force_isolation = True  # noqa: SLF001 — security: see filesystem._validate_root\n    try:\n        resolved = fs._validate_path(path)  # noqa: SLF001 — public sandbox entry\n    except PermissionError as exc:\n        # _validate_root / _validate_path raise PermissionError on sandbox\n        # boundary violations (path escape, deny-list, etc.). Map to 404 so we\n        # never leak namespace existence to another tenant.\n        logger.warning(\n            \"agentic.files.read.refused user_id=%s path=%s reason=%s\",\n            current_user.id,\n            path,\n            exc,\n        )\n        raise HTTPException(status_code=404, detail=\"Not found\") from None\n\n    if not resolved.exists() or resolved.is_dir():\n        logger.warning(\n            \"agentic.files.read.missing user_id=%s path=%s resolved=%s exists=%s is_dir=%s\",\n            current_user.id,\n            path,\n            resolved,\n            resolved.exists(),\n            resolved.is_dir(),\n        )\n        raise HTTPException(status_code=404, detail=\"Not found\")\n\n    try:\n        size = resolved.stat().st_size\n    except OSError:\n        raise HTTPException(status_code=404, detail=\"Not found\") from None\n    if size > MAX_FILE_SIZE_BYTES:\n        raise HTTPException(status_code=413, detail=\"File too large\")","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/agentic/api/files_router.py#L131-L167","documentation":"During agentic file reads, fs._validate_path raises PermissionError when the path escapes the requesting user's sandbox, hits a deny-list, or otherwise violates sandbox boundaries. The router deliberately maps this to HTTP 404 (not 403) so a cross-tenant probe cannot learn whether a namespace exists. The refusal is logged (user id, path, reason) at warning level.","triggerScenarios":"Requesting a path with '..' segments that survive shape validation, symlinks pointing outside the sandbox, or deny-listed locations.","commonSituations":"Symlink inside the sandbox pointing at /etc or another user's tree; agent-generated paths attempting escape; shared-hosting style probing between tenants.","solutions":["Request only files that physically live inside your sandbox; remove symlinks that point outside it.","If you administer the deployment, check the warn log (agentic.files.read.refused ... reason=...) to see the boundary rule that fired.","Do not retry — 404 here is a policy refusal, not a transient miss."],"exampleFix":"# before\nGET /api/v1/agentic/files?path=data/../../other_user/secret.md  # 404 Not found (sandbox refusal)\n# after\nGET /api/v1/agentic/files?path=data/secret.md","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef inside_sandbox(root: Path, target: Path) -> bool:\n    try:\n        target.resolve().relative_to(root.resolve())\n        return not target.is_symlink() or inside_sandbox(root, target.resolve())\n    except ValueError:\n        return False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never place symlinks pointing outside your sandbox.","Canonicalize paths client-side before requesting reads.","Do not retry 404s caused by boundary refusals — check server warn logs (agentic.files.read.refused)."],"tags":["agentic","files","http-404","sandbox","security"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}