fix: correct inverted logic in blocklist check (#1336)
The should_block_action method was checking if blocklist items start with the action, instead of checking if the action starts with blocklist items. This caused commands like 'vim test.py' to not be blocked even though 'vim' is in the blocklist. Before: f.startswith(action) - checks if 'vim' starts with 'vim test.py' (False) After: action.startswith(f) - checks if 'vim test.py' starts with 'vim' (True) Fixes #1316 Co-authored-by: MiloBot <milobot@milobots-mini.home>
This commit is contained in:
@@ -355,7 +355,7 @@ class ToolHandler:
|
||||
action = action.strip()
|
||||
if not action:
|
||||
return False
|
||||
if any(f.startswith(action) for f in self.config.filter.blocklist):
|
||||
if any(action.startswith(f) for f in self.config.filter.blocklist):
|
||||
return True
|
||||
if action in self.config.filter.blocklist_standalone:
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user