Skip to content

View tool should respect directory trust #342

@williammartin

Description

@williammartin

Describe the bug

Right now the shell tool heuristically inspect paths in an executed command and shows a prompt:

 > Read /Users/williammartin/brewfile using cat

 ○ Read Brewfile using cat
   $ cat /Users/williammartin/Brewfile
   ↪ 1 line...

 ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ Allow directory access                                                                                                                                    │
 │                                                                                                                                                           │
 │ Copilot is attempting to read the following path outside your allowed directory list.                                                                     │
 │                                                                                                                                                           │
 │ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
 │ │ /Users/williammartin/Brewfile                                                                                                                         │ │
 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
 │                                                                                                                                                           │
 │ Do you want to add these directories to the allowed list?                                                                                                 │
 │                                                                                                                                                           │
 │ ❯ 1. Yes                                                                                                                                                  │
 │   2. No (Esc)                                                                                                                                             │
 │                                                                                                                                                           │
 │ Confirm with number keys or ↑↓ keys and Enter, Cancel with Esc                                                                                            │
 ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

But the standard Read tool does not:

> Read /Users/williammartin/brewfile

 ● I'll read the Brewfile for you.

 ✓ Read ~/Brewfile (50 lines)

 ● Your Brewfile contains 25 Homebrew formulas and 20 casks, including development
   tools (Go, Rust, Node via nvm, Neovim), CLI utilities (fzf, jq, gh, bat, rg),
   and applications (Ghostty, Claude Code, Raycast, Zed, VS Code, and various
   productivity apps).

Affected version

0.0.343 Commit: 5847051

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions