fix: normalize permission rule tool names to lowercase (#94)

PermissionRule::parse now normalizes tool_name to lowercase, matching
the runtime convention. Previously "Bash(rm:*)" would never match
because the runtime tool name is lowercase "bash". Same fix applied
to denied_tools list.

Generated with https://github.com/Yeachan-Heo/gajae-code
Co-authored-by: Gajae Code <dev@gajae-code.com>
This commit is contained in:
bellman
2026-06-05 09:53:26 +09:00
parent b8cbb1834f
commit aca6584fd5
2 changed files with 11 additions and 4 deletions

View File

@@ -149,7 +149,12 @@ impl PermissionPolicy {
.iter()
.map(|rule| PermissionRule::parse(rule))
.collect();
self.denied_tools = config.denied_tools().to_vec();
// #94: normalize denied tool names to lowercase to match runtime convention
self.denied_tools = config
.denied_tools()
.iter()
.map(|t| t.to_lowercase())
.collect();
self
}
@@ -375,7 +380,8 @@ impl PermissionRule {
let matcher = parse_rule_matcher(content);
return Self {
raw: trimmed.to_string(),
tool_name: tool_name.to_string(),
// #94: normalize tool name to lowercase to match runtime convention
tool_name: tool_name.to_lowercase(),
matcher,
};
}
@@ -384,7 +390,8 @@ impl PermissionRule {
Self {
raw: trimmed.to_string(),
tool_name: trimmed.to_string(),
// #94: normalize tool name to lowercase to match runtime convention
tool_name: trimmed.to_lowercase(),
matcher: PermissionRuleMatcher::Any,
}
}