Protect Shell Tools
Policy
deny:
- capability: shell.execute
contains: "rm -rf"
allow:
- capability: shell.executeIntegration
from capfence import CapFenceTool
from langchain.tools import ShellTool
safe_shell = CapFenceTool(
tool=ShellTool(),
agent_id="ops-agent",
capability="shell.execute",
policy_path="policies/shell.yaml",
)Expected result
- Destructive commands are blocked before execution.
- Safe commands run normally.