Skip to content

Keep project moves inside the authorized destination root #1896

Closed

Description

@phernandez

Problem

Follow-up from the reviewed CodeRabbit deep scan (K13). This ticket tracks one distinct fix; duplicate scan rows are consolidated here.

Reviewed evidence and scope

  • K13 (scan ID 63e1e6fe-e753-41af-a5c8-94d72228ccf2, review A, Medium): move_project accepts a replacement absolute path without preserving project_root. Local/API configuration boundary, not proof of a Cloud tenant escape.
    Source at current baseline: src/basic_memory/services/project_service.py:740.

Fix and validation

  • Keep project moves inside the authorized destination root.
  • Recheck current callers and supported behavior before choosing the smallest complete fix.
  • Add a bounded regression at the affected public or service boundary; demonstrate it fails without the fix.
  • Preserve legitimate inputs and tenant/project boundaries. Run focused tests plus repository static/type checks.

The scan/review establishes the code-level concern described above; it does not establish production exploitation. Conditional branches and local/tooling-only exposure must retain that scope.

Activity

  1. added
    security
    on Oct 28, 2026
  2. claude commented on Oct 28, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 17s —— View job


    Triage

    • Type: bug (security hardening). Labeled bug; the existing security label is kept.
    • Component: Services/API and MCP project management (ProjectService.move_project). This is not Cloud-specific, and the issue says it isn't a proven tenant escape.
    • Priority: Medium, in line with the scan's rating. It's a local/API configuration boundary and not proof of production exploitation.
    • Complexity: Simple to medium.

    Observations

    In src/basic_memory/services/project_service.py (move_project, around lines 725-760), new_path is expanded and absolutized, then saved to config and the DB. When config.project_root is set, the code skips directory creation but never checks that the resolved path is inside project_root. A caller can therefore move a project outside the authorized root.

    Suggested direction

    • Validate resolved_path against project_root when it is set, and fail fast with ValueError.
    • Check how project creation enforces the same constraint and reuse that helper, so add and move behave the same.
    • Resolve symlinks and .. before the containment check.
    • Check update_project in the same file. It also accepts an arbitrary path without any root check, though it's marked no cover.
    • Add a regression test at the service boundary, and at the API router if it's cheap. It should fail without the fix. Existing in-root moves and the no-project_root local mode must keep working.

    No duplicate issues were found. I did not implement anything, per triage scope.

  3. added
    bug
    on Oct 28, 2026
  4. added a commit that references this issue on Oct 29, 2026
    c5501a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions