Skip to content

feat: enforce tool permissions on agent tool calls#2465

Open
lulululu-debug wants to merge 1 commit into
the-open-agent:masterfrom
lulululu-debug:feat/tool-permission-enforce
Open

feat: enforce tool permissions on agent tool calls#2465
lulululu-debug wants to merge 1 commit into
the-open-agent:masterfrom
lulululu-debug:feat/tool-permission-enforce

Conversation

@lulululu-debug

Copy link
Copy Markdown
Contributor

What

Enforce the configured tool-permission policies on every agent tool call — the piece that makes issue #2462 functional end to end.

  • mcp/toolset.go — add an optional CheckPermission hook on ToolSet; nil means checks are disabled (tools run unchanged).
  • object/tool_guard.goBuildToolPermissionChecker builds a guard.CasbinGuard from the store's ToolPolicy rows and returns the check closure. Exec/shell calls are decided per program (via shellcmd) so chaining/subshell/sudo wrappers can't smuggle a denied program past a whole-string match. Returns nil (zero overhead) when a store has no policies.
  • object/merge_agent_tools.go — attach the checker to the merged tool set.
  • model/mcp.go — consult the checker before executing a tool; a denial short-circuits and is surfaced to the model as an error tool result instead of silently proceeding.

Non-breaking: the guard defaults to allow, so stores without policies behave exactly as before. Builds on #2463 (guard engine) and #2464 (policy management).

Tests

go build ./... and go test ./guard/... ./shellcmd/...

Fix: #2462

@lulululu-debug
lulululu-debug force-pushed the feat/tool-permission-enforce branch 9 times, most recently from 35cf2b6 to 3f1c41d Compare July 23, 2026 16:19
@lulululu-debug
lulululu-debug force-pushed the feat/tool-permission-enforce branch from 3f1c41d to 4f0e2ec Compare July 23, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] need a more fine-grained and flexible permission management for agents

1 participant