chore: generate
This commit is contained in:
@@ -119,7 +119,9 @@ export const Plugin = define({
|
|||||||
function expandPermissions(rules: PermissionV2.Ruleset, home: string): PermissionV2.Ruleset {
|
function expandPermissions(rules: PermissionV2.Ruleset, home: string): PermissionV2.Ruleset {
|
||||||
// Expand only resources tools resolve as filesystem paths. Bash resources are raw shell text:
|
// Expand only resources tools resolve as filesystem paths. Bash resources are raw shell text:
|
||||||
// rewriting `$HOME/private/**` would miss `$HOME/private/key`, and safe expansion needs shell-aware parsing.
|
// rewriting `$HOME/private/**` would miss `$HOME/private/key`, and safe expansion needs shell-aware parsing.
|
||||||
return rules.map((rule) => (isPathAction(rule.action) ? { ...rule, resource: expandHome(rule.resource, home) } : rule))
|
return rules.map((rule) =>
|
||||||
|
isPathAction(rule.action) ? { ...rule, resource: expandHome(rule.resource, home) } : rule,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPathAction(action: string): action is PathAction {
|
function isPathAction(action: string): action is PathAction {
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ describe("ConfigAgentPlugin.Plugin", () => {
|
|||||||
expect(
|
expect(
|
||||||
PermissionV2.evaluate("external_directory", "C:\\Users\\test\\p\\opencode\\src\\*", permissions).effect,
|
PermissionV2.evaluate("external_directory", "C:\\Users\\test\\p\\opencode\\src\\*", permissions).effect,
|
||||||
).toBe("allow")
|
).toBe("allow")
|
||||||
expect(
|
expect(PermissionV2.evaluate("external_directory", "C:\\Users\\test\\cache\\files\\*", permissions).effect).toBe(
|
||||||
PermissionV2.evaluate("external_directory", "C:\\Users\\test\\cache\\files\\*", permissions).effect,
|
"deny",
|
||||||
).toBe("deny")
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user