Skip to content

fix(core): keep remote paths independent of host symlinks - #1807

Merged
phernandez merged 1 commit into
mainfrom
fix-remote-path-symlinks
Oct 22, 2026
Merged

phernandez merged 1 commit into
mainfrom
fix-remote-path-symlinks

Conversation

@phernandez

Copy link
Copy Markdown
Member

Why

In Cloud, a project's path is a logical object-storage prefix, not a directory on the API host. Core still treated it as one: FileService.__init__ called base_path.resolve(), and validate_project_path resolved (project_path / path) against the host filesystem, following symlinks there. Project names and paths come from users, so a caller could steer those resolutions at host paths, and the difference between a rejected and an accepted request revealed which paths and symlinks exist on the server. Note content lives in object storage, so nothing could be read; the exposure is host filesystem probing.

What

  • FileService(..., local_filesystem=False) keeps a logical base path unresolved and sets local_project_path to None. Object-store subclasses pass this flag; local storage is unchanged (default True).
  • validate_project_path(path, None) applies only the lexical checks (.. segments, absolute paths, ~, drive letters, control characters) and never touches the filesystem.
  • MCP write_note, read_note, read_content and move_note use the project home only when routing selected the in-process local API (LocalASGIClient); hosted clients validate lexically.
  • The index_file recovery endpoint, which scans disk, returns 404 when storage is not local.
  • place_note and resource reads use file_service.local_project_path instead of resolving project.path.

How tested

  • New tests: tests/api/v2/test_remote_path_validation.py, tests/mcp/test_remote_path_validation.py, tests/utils/test_remote_project_paths.py.
  • Those plus the file service, knowledge router, resource router and the four MCP tool suites: 370 passed.
  • just lint passes. just typecheck reports the same 4 pymilvus unresolved-import diagnostics as main (optional extra not installed in a default sync).

The Cloud side (S3FileService passing local_filesystem=False) is basicmachines-co/basic-memory-cloud#2664, which will pin this commit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T19:31:13.305752Z 10dd0a7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@phernandez
phernandez merged commit 0276799 into main Oct 22, 2026
31 checks passed
@phernandez
phernandez deleted the fix-remote-path-symlinks branch October 22, 2026 19:30
phernandez added a commit that referenced this pull request Oct 23, 2026
Date the v0.24.0 entry 2026-10-22, add a Security section for
GHSA-4gfv-c2mm-mvj2 (DNS rebinding, #1697) and GHSA-pqm2-2wxw-p5hx
(host symlink probing, #1807), plus #1804 and #1805, and cover the
changes merged since the entry was last edited (#1761 through #1807).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018CoZ3jWnMJsyQsik4tPySk
Signed-off-by: phernandez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant