Skip to content

Honor project constraints in JSON project-list tool output #1895

Closed

Description

@phernandez

Problem

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

Reviewed evidence and scope

  • K12 (scan ID 7b9dfa77-b7a7-4897-8593-c7692baaa8a4, review A, Low): JSON helper returns all merged projects and only labels constrained_project; text returns a constrained result. Metadata restriction is inconsistent. Do not describe this as cross-tenant data leakage without a hosted route proof.
    Source at current baseline: src/basic_memory/mcp/tools/project_management.py:460.

Fix and validation

  • Honor project constraints in JSON project-list tool output.
  • 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 20s —— View job


    Triage

    • Type: Bug (inconsistent enforcement of the BASIC_MEMORY_MCP_PROJECT constraint)
    • Component: MCP tools (src/basic_memory/mcp/tools/project_management.py, project-list tool). It isn't Cloud-specific.
    • Priority: Low. The issue's own scope applies: this is a code-level metadata inconsistency, not proven cross-tenant leakage.
    • Complexity: Simple. It needs a small change plus a regression test.

    Findings: In the list tool, the text output returns only the constrained project (_format_constrained_text, around lines 400 and 451). The JSON path (_format_project_list_json, around lines 399 and 449) passes the full merged project list and only adds a constrained_project field. With output_format="json" and a constraint set, the output therefore lists every project.

    Likely fix: Filter the merged list to the constrained project before JSON formatting, so both formats behave the same. Add a test at the tool boundary for a constrained environment with JSON output. It should fail on the current code. Confirm how case-mismatched names are handled; #1630 touched that area.

    Duplicates: I found none. #1630, #758 and #434 are related to the constraint but are closed and cover different behavior.

    Per triage-only scope, I haven't made any code changes.

  3. added
    bug
    on Oct 28, 2026
  4. added
    low-priority
    on Oct 28, 2026
  5. added this to the v1.0 milestone on Oct 29, 2026
  6. added 2 commits that reference this issue on Oct 29, 2026
    2f17ed3
    7ccfdbc
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

    buglow-prioritysecurity

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions