Skip to content

write/edit/read submit relative paths so absolute and ~ permission rules never match out-of-worktree files #41067

Closed as not planned

Description

@anujbolewar

Description

write, edit, and read pass file paths to the permission layer as path.relative(worktree, filePath). Files outside the worktree are therefore submitted as ../... patterns (e.g. ../.ssh/id_ed25519). Absolute and ~/$HOME-expanded permission rules such as "~/.ssh/**": "deny" never match those relative forms, so a deny rule can be bypassed when a tool edits an out-of-worktree file at a relative path.

Steps to reproduce

  1. Configure a permission rule denying an absolute or ~-expanded path, e.g. "~/.ssh/**": "deny".
  2. In a session whose worktree is not the home directory, attempt an edit/write/read on a file under that path via a relative /tools path.
  3. Observe that the rule does not match the relative submission.

Expected

Rules match regardless of whether the tool passed the path as a relative ../ form, an absolute form, or a ~-expanded form.

Activity

  1. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your report covers additional tools (e.g. read) or adds new reproduction details not present in #40945, please add a comment there so the maintainer has the full picture.

  2. github-actions commented on Oct 8, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions