Copilot constantly nags about "parent directory" access when it's clearly in a subfolder of the project directory
還沒有人認領這個 Issue。
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
Describe the bug
When using Claude Opus, it will occasionally cd into a lower directory and then access a sibling directory using the relative parent directory shortcut (..). This will inevitably be flagged by Copilot CLI as going outside of the project directory, which is clearly incorrect. Rather than assuming .. is going out of the project directory, Copilot CLI should be getting the absolute directory and checking that.
Affected version
Copilot v1.0.80
Steps to reproduce the behavior
Example issue:
- Start Copilot CLI in
/work. - Ask Claude to review code with a deep directory structure.
- Claude will use something like the following command:
cd subfolder/subfolder3/subfolder5 && grep -rn "searching for text" ../subfolder4 - The CLI incorrectly "warns" me that it's accessing a directory outside my workspace. And then wants me to add
../subfolder4to my "allowed" directories, which is not secure. If it was added to the "allowed" directories, it actually could do it at the top level.
Expected behavior
The CLI should be converting relative addressing to absolute addressing and checking the full path.
Additional context
No response
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,在根目錄為 /work 的 Copilot CLI 工作階段中重現回報的命令,尤其是在切換目錄後使用相對路徑 ../subfolder4 的情況。追蹤 CLI 的工作區存取檢查,並確認它會在比較之前解析命令的路徑。只有當工作區內的同層路徑不需允許清單提示即可被接受,而真正位於外部的路徑仍會被拒絕時,才算完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- shell
- 領域
- cli, security
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 活躍
- 描述清晰度
- 基本清楚
- 新手友好度
- 66/100