mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 21:15:57 +03:00
fix(core): map legacy apply_patch permissions to edit (#57900)
This commit is contained in:
committed by
GitHub
Unverified
parent
2e5a4deea8
commit
3260ec767c
@@ -26,7 +26,7 @@ function permissions(info?: ConfigPermissionV1.Info) {
|
||||
|
||||
// Map v1 permission/tool keys onto their renamed v2 tool actions so migrated rules keep matching.
|
||||
export function normalizeAction(action: string) {
|
||||
if (action === "write" || action === "patch") return "edit"
|
||||
if (action === "write" || action === "patch" || action === "apply_patch") return "edit"
|
||||
if (action === "task") return "subagent"
|
||||
if (action === "bash") return "shell"
|
||||
return action
|
||||
|
||||
@@ -1237,6 +1237,7 @@ describe("Config", () => {
|
||||
task: "ask",
|
||||
bash: { "git status": "allow", "*": "deny" },
|
||||
write: "deny",
|
||||
apply_patch: "deny",
|
||||
read: "allow",
|
||||
},
|
||||
}).permissions,
|
||||
@@ -1245,6 +1246,7 @@ describe("Config", () => {
|
||||
{ action: "shell", resource: "git status", effect: "allow" },
|
||||
{ action: "shell", resource: "*", effect: "deny" },
|
||||
{ action: "edit", resource: "*", effect: "deny" },
|
||||
{ action: "edit", resource: "*", effect: "deny" },
|
||||
{ action: "read", resource: "*", effect: "allow" },
|
||||
])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user