search_code (and detect_changes): rejects projects indexed by index_repository when root_path contains '$'
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start with validate_search_path_arg and validate_search_args at the cited locations in src/mcp/mcp.c, then inspect the detect_changes validation around lines 20275–20287. Trace how root_path reaches these checks and how paths are passed to search. Reproduce using a repository path containing $; done means search_code finds the match and detect_changes accepts the indexed path, or indexing clearly rejects it upfront.
由索引模型根據 Issue 內容生成。
描述
Version
codebase-memory-mcp 0.12.1 (built from source at 9a4da7a3; also verified unchanged on main d5e39e5a, src/mcp/mcp.c:17466-17514, 18244, 20275-20287)
Platform
Linux (x64)
Install channel
Built from source
Binary variant
standard
What happened, and what did you expect?
index_repository succeeds on a valid repository path containing $ (e.g., /tmp/repo$cash), persists its root_path, and list_projects returns the indexed project normally.
However, calling search_code on that indexed project with only {"project": "dollar_repo", "pattern": "hello"} (without passing file_pattern or path_filter) immediately fails with:
path or file_pattern contains invalid characters
Root cause: validate_search_args(root_path, file_pattern) (src/mcp/mcp.c:17506-17514) runs validate_search_path_arg (mcp.c:17466-17481) on the persisted root_path, which still rejects $ (as well as ;, |, ", etc., whereas #272 relaxed & because POSIX single-quoting neutralizes shell metacharacters). The same check also rejects root_path in detect_changes (mcp.c:20275-20287).
Expected: either search_code / detect_changes safely handle valid POSIX/Windows paths containing $ (since POSIX single-quoting already neutralizes $, or by avoiding shell interpolation via argv), or index_repository rejects/warns upfront instead of indexing a project whose search_code calls always fail with a misleading "path or file_pattern contains invalid characters" message even when the caller passed neither path nor file_pattern.
Reproduction
- Code: create a minimal dummy repo in a directory whose name contains
$:mkdir -p '/tmp/repo$cash' printf 'def hello():\n return "hello"\n' > '/tmp/repo$cash/main.py' - MCP calls:
- Step 1 —
index_repository:
Output: succeeds ({"repo_path": "/tmp/repo$cash", "name": "dollar_repo", "mode": "fast"}"project": "dollar_repo","files_indexed": 1,"nodes": ...). - Step 2 —
list_projects:
Output: lists{"format": "json"}"name": "dollar_repo","root_path": "/tmp/repo$cash". - Step 3 —
search_code(nofile_patternpassed):
Actual output ({"project": "dollar_repo", "pattern": "hello"}isError: true):path or file_pattern contains invalid characters
- Step 1 —
- Expected for Step 3:
search_codereturns the match inmain.py(or, if$paths are intentionally unsupported,index_repositoryrejects them at index time and the error clearly names the projectroot_pathrather than"path or file_pattern").
Logs
Step 1 (index_repository): {"project":"dollar_repo",...,"files_indexed":4,"nodes":18,"edges":19,...}
Step 2 (list_projects): {"projects":[{"name":"dollar_repo","root_path":".../repo$cash"}],"total":1,...}
Step 3 (search_code, isError=true): path or file_pattern contains invalid characters
Confirmations
- I searched existing issues and this is not a duplicate.
- My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
- 主要語言
- C
- 星號
- 45.8k
- 分支
- 3.8k
- 平均合併
- 2 天 18 小時
- 30 天內合併 PR
- 108
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
DeusData/codebase-memory-mcp 的其他 Issue
-
bug ux/behavior
難度 2/5 1-3 小時 新手友好度 70/100
DeusData/codebase-memory-mcp#3191 ·
維護者通常 1 天內回覆
-
documentation enhancement parsing/quality ux/behavior
難度 1/5 1-3 小時 新手友好度 82/100
DeusData/codebase-memory-mcp#3131 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug editor/integration parsing/quality ux/behavior
難度 2/5 1-3 小時 新手友好度 75/100
DeusData/codebase-memory-mcp#3062 · 2 則留言 ·
維護者通常 1 天內回覆
-
bug documentation editor/integration parsing/quality
難度 2/5 1-3 小時 新手友好度 75/100
DeusData/codebase-memory-mcp#3050 · 1 則留言 ·
維護者通常 1 天內回覆
-
editor/integration parsing/quality
難度 2/5 1-3 小時 新手友好度 68/100
DeusData/codebase-memory-mcp#2286 ·
維護者通常 1 天內回覆
查看 DeusData/codebase-memory-mcp 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
維護者通常 1 天內回覆
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the game未關閉game: 010065A014024000 ios
難度 2/5 1-3 小時 新手友好度 76/100
seedds/nxnative#3714 · 1 則留言 ·
維護者通常 2 天內回覆