github / github/copilot-cli

Directories listed in allowed_directories in ~/.copilot/permissions-config.json do not suppress the "path outside your allowed directory list" prompt for shell commands.

未关闭
#4,482 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:configuration area:permissions
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

Directories listed in allowed_directories in ~/.copilot/permissions-config.json do not suppress the "path outside your allowed directory list" prompt for shell commands. /add-dir with the identical path fixes it for the session.

Startup log says it loaded:
[INFO] permissions::api_orchestrator] Applied persisted allowed directories {"count":2,"location_key":"..."} 
Probable cause: in app.js, addAdditionalDirectory() is only called inside the paths.add handler. hydrate_location_permission_directories applies persisted dirs to the native permission service but never performs that sync, so the path gate used for shell commands doesn't see them.
Secondary: the prompt's "Yes, and add these directories to the allowed list" option maps to {kind:"approve-for-session"} — the wording implies persistence it doesn't have.

Affected version

GitHub Copilot CLI 1.0.79.

Steps to reproduce the behavior

Repro: add an absolute dir to allowed_directories under a location key; start a session whose git root is that key; run a shell command reading a file under that dir → prompt appears. Run /add-dir  → no more prompts.

Expected behavior

No response

Additional context

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 app.js 开始,将 paths.add 处理程序中的 addAdditionalDirectory() 与 hydrate_location_permission_directories 以及持久化目录的启动路径进行比较。使用绝对的 allowed_directories 条目复现,然后运行一个读取其中某个文件的 shell 命令。完成的标准是:持久化目录像 /add-dir 一样抑制路径提示,并且提示措辞准确反映仅限当前会话的批准。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, shell
领域
cli, security
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。