{"record":{"id":"83e3e03caa403c5c","repo":"langflow-ai/langflow","slug":"access-denied-for-knowledge-base-kb-name","errorCode":null,"errorMessage":"Access denied for knowledge base '{kb_name}'.","messagePattern":"Access denied for knowledge base '(.+?)'\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"src/backend/base/langflow/api/v1/knowledge_bases.py","lineNumber":206,"sourceCode":"def _validate_kb_path_containment(kb_user_path: Path, kb_path: Path, kb_name: str, username: str) -> None:\n    \"\"\"Raise 403 if kb_path is not contained within kb_user_path.\n\n    Delegates the actual containment check to\n    :func:`langflow.services.memory_base.kb_path_helpers.validate_kb_path`\n    (introduced in #12417) so the traversal guard is defined in one\n    place — but translates its ``ValueError`` into the 403 HTTPException\n    expected by the KB routes and keeps the high-signal log line.\n    \"\"\"\n    try:\n        validate_kb_path(kb_user_path, kb_path)\n    except ValueError as exc:\n        logger.warning(\n            \"Path traversal attempt blocked: user=%s kb_name=%r resolved_path=%s\",\n            username,\n            kb_name,\n            kb_path,\n        )\n        raise HTTPException(\n            status_code=403,\n            detail=f\"Access denied for knowledge base '{kb_name}'.\",\n        ) from exc\n\n\ndef _resolve_kb_path(kb_name: str, owner_user) -> Path:\n    \"\"\"Resolve and validate KB path against the KB *owner's* namespace.\n\n    ``owner_user`` is the User whose ``username`` roots the KB directory —\n    for owner-only requests this is ``current_user``; for cross-user share\n    grants ``_guard_kb_action`` returns the resolved KB owner so the route\n    reads the KB from the right user directory.\n\n    Raises 500 if root path not configured.\n    Raises 403 if path traversal is detected (kb_name escapes the user directory).\n    Raises 404 if the KB directory does not exist.\n    \"\"\"\n    kb_root_path = KBStorageHelper.get_root_path()","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/knowledge_bases.py#L188-L224","documentation":"Error \"Access denied for knowledge base '{kb_name}'.\" thrown in langflow-ai/langflow.","triggerScenarios":"Occurs when a user without access rights attempts to read or modify the named knowledge base.","commonSituations":"See trigger scenarios.","solutions":["Access the knowledge base with the owning user, or have the owner share it with you."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}