chore: generate
This commit is contained in:
parent
fd9ee435ec
commit
888dc67cc3
2 changed files with 6 additions and 4 deletions
|
|
@ -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")
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue