mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
core: fix permission evaluation to use rule-based matching instead of wildcard patterns
This commit is contained in:
parent
7324b2260a
commit
9f38af44db
@ -232,9 +232,9 @@ export namespace PermissionNext {
|
||||
const result = new Set<string>()
|
||||
for (const tool of tools) {
|
||||
const permission = EDIT_TOOLS.includes(tool) ? "edit" : tool
|
||||
if (evaluate(permission, "*", ruleset).action === "deny") {
|
||||
result.add(tool)
|
||||
}
|
||||
const rule = ruleset.findLast((r) => Wildcard.match(permission, r.pattern))
|
||||
if (!rule) continue
|
||||
if (rule.pattern === "*" && rule.action === "deny") result.add(tool)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user