Repository navigation
Closed
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
A "edit" permission can currently be specified as follows:
"edit": {
"*": "allow"
}
The pattern (* in this case) is matched against path that is relative to the worktree, but since * matches everything (including ../) that doesn't matter here: a * just matches every file on the whole hard disk.
Lets say we have the following files:
1. /root/external1/worktree/bar/foo,
2. /root/external1/foo,
3. /root/external2/foo,
4. /root/foo
Trying to edit any of these files use the following strings to match against any of the given patterns:
1. "bar/foo"
2. "../foo"
3. "../../external2/foo"
4. "../../../foo"
all of which match a *.
Note that as a result it is not possible to use an absolute path as pattern,
using - for example -
"edit": {
"/root/external2/*": "allow"
}
doesn't match any of those string, because none will start with a '/' - failing the match already at the first character.
I have the following proposal:
- Each "edit" pattern belong to one of three categories:
A. absolute patterns (path.isAbsolute(pattern)will work)
B. patterns that start with"../".
C. all other patterns. - If a file needs to be checked we match its absolute path (eg
/root/external1/foo) against all patterns of category A, while matching its relative path (eg../foo) against category B and C. - If a file matches category C but the full path is outside the worktree - it is rejected anyway (as if it didn't match), and if a file matches category B but the full path is inside the worktree - it is rejected as well.
Example patterns and which files they would match (1,2,3 and/or 4):
"*" : (cat. C) matches 1 only [current: matches 1,2,3,4]
"*/foo: (cat. C) matches 1 only [current: matches 1,2,3,4]
"/root/external1/*": (cat. A) matches 1 and 2 [current: matches nothing]
"/root/external*": (cat. A) matches 1, 2 and 3 [current: matches nothing]
"/root/external2/*": (cat. A) matches 3 only [current: matches nothing]
"../*": (cat. B) matches 2 only [current: 2,3,4]
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Activity
github-actions commentedon Apr 13, 2026
This issue might be a duplicate of existing issues. Please check:
editpermission uses relative paths internally, causing absolute path patterns to fail to match (includes root cause analysis and suggested fix)If your request is distinct from those, please add a comment clarifying the difference so maintainers can track it separately.
CarloWood commentedon Apr 14, 2026
On discord @justfortheloveof (discord handle) suggested that simply implementing proper globbing (as is also documented?) would do the trick as well. I wrote a new feature request for that and closing this one in favor of that one.