Paths in edit permissions don't work well for teams with varying paths #9490

Open
opened 2026-02-16 18:12:33 -05:00 by yindo · 4 comments
Owner

Originally created by @jcowles on GitHub (Feb 16, 2026).

Originally assigned to: @Hona on GitHub.

Description

If you're a team of people with your code at different paths and want to allow a specific path to be edited, you can do it like this:

    "edit": {
      "*": "ask",
      "some\\path\\to\\file\\**": "allow",
    },
```

But this doesn't work, because edit has workspace path (without drive letter) prefixed, like this `src\\some\\path\\to\\file\\file.txt`, so the only solution is to prefix the path with `**` but that's not the same permission I stated above, because it matches ANY prefix to the path.


### Plugins

_No response_

### OpenCode version

1.50.0

### Steps to reproduce

add this to your config
//
    "edit": {
      "*": "ask",
      "test\\**": "allow",
    },
```

run `opencode run "write the word FOO to test/permissions.txt"`

This command will fail, reporting that the permission required "ask" access and was auto-rejected, despite explicitly setting it to "Allow" above.

### Screenshot and/or share link

_No response_

### Operating System

Windows 11

### Terminal

WezTerm
Originally created by @jcowles on GitHub (Feb 16, 2026). Originally assigned to: @Hona on GitHub. ### Description If you're a team of people with your code at different paths and want to allow a specific path to be edited, you can do it like this: ```` "edit": { "*": "ask", "some\\path\\to\\file\\**": "allow", }, ``` But this doesn't work, because edit has workspace path (without drive letter) prefixed, like this `src\\some\\path\\to\\file\\file.txt`, so the only solution is to prefix the path with `**` but that's not the same permission I stated above, because it matches ANY prefix to the path. ### Plugins _No response_ ### OpenCode version 1.50.0 ### Steps to reproduce add this to your config // "edit": { "*": "ask", "test\\**": "allow", }, ``` run `opencode run "write the word FOO to test/permissions.txt"` This command will fail, reporting that the permission required "ask" access and was auto-rejected, despite explicitly setting it to "Allow" above. ### Screenshot and/or share link _No response_ ### Operating System Windows 11 ### Terminal WezTerm
yindo added the windowsbug labels 2026-02-16 18:12:33 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 16, 2026):

This issue might be a duplicate of or closely related to existing issues. Please check:

  • #13872: "Permission edit patterns" - Similar question about glob patterns in edit permissions
  • #7279: "Bug: permission pathing crossplatform" - Windows-specific issue with backslash vs forward slash in permission paths
  • #13646: "Path-based read permissions not enforced; catch-all rules always take precedence" - Related issue about path-scoped permissions not working correctly

These issues describe related problems with path matching in the permissions system. Consolidating discussion may help identify if this is a single underlying bug affecting path pattern matching.

@github-actions[bot] commented on GitHub (Feb 16, 2026): This issue might be a duplicate of or closely related to existing issues. Please check: - #13872: "Permission edit patterns" - Similar question about glob patterns in edit permissions - #7279: "Bug: permission pathing crossplatform" - Windows-specific issue with backslash vs forward slash in permission paths - #13646: "Path-based read permissions not enforced; catch-all rules always take precedence" - Related issue about path-scoped permissions not working correctly These issues describe related problems with path matching in the permissions system. Consolidating discussion may help identify if this is a single underlying bug affecting path pattern matching.
Author
Owner

@jcowles commented on GitHub (Feb 16, 2026):

It would be nice if ".\path" implied the worktree root.

@jcowles commented on GitHub (Feb 16, 2026): It would be nice if ".\\path" implied the worktree root.
Author
Owner

@jcowles commented on GitHub (Feb 16, 2026):

looking closer, this seems like a bug -- the edit tool has this:
[path.relative(Instance.worktree, filepath)]

Which makes me think this is a windows-specific bug wher path.relative just chops off the drive letter, rather than actually makeing the path relative.

@jcowles commented on GitHub (Feb 16, 2026): looking closer, this seems like a bug -- the edit tool has this: `[path.relative(Instance.worktree, filepath)]` Which makes me think this is a windows-specific bug wher path.relative just chops off the drive letter, rather than actually makeing the path relative.
Author
Owner

@rekram1-node commented on GitHub (Feb 16, 2026):

I think there is a bug for permissions on windows specifically yeah. We will fix.

@rekram1-node commented on GitHub (Feb 16, 2026): I think there is a bug for permissions on windows specifically yeah. We will fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9490