Repository navigation
Let Cedar grant tool visibility with read_tool - #7358
Conversation
A tool is listed when a call_tool permit allows it and no read_tool forbid matches, or when a read_tool-scoped permit allows it and no call or read forbid matches. Policy sets with no read_tool policy list the same tools as before. Cedar answers tool:read itself, so the tool:call fallback no longer applies to Cedar.
The warning matched the unquoted action name, so it never fired. Match the quoted form cedar-go writes, add a test for it, and update the ToolReadNative comment that still said Cedar does not implement it.
Name the unused receiver, and iterate policies with All() instead of the deprecated Map().
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7358 +/- ##
==========================================
- Coverage 82.69% 82.64% -0.05%
==========================================
Files 947 934 -13
Lines 97369 97023 -346
==========================================
- Hits 80519 80186 -333
+ Misses 16845 16832 -13
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ad8f74a to
9e0b20e
Compare
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
ChrisJBurns
left a comment
There was a problem hiding this comment.
-
Nit · correctness · tests — ToolCallImpliesRead contract docs and callers still describe Cedar as using the decorator fallback (
pkg/authz/authorizers/tool_read.go:10)Cedar now implements ToolReadNative and answers true, so neither in-tree authorizer takes the read-then-call path described in the type doc (tool_read.go:10-15) or in tool_filter.go:17-18. Cedar's own visibility rule also breaks "tool:call implies tool:read" when a read_tool forbid exists. pkg/vmcp/core/admission_test.go:614-617 says "Cedar denies every tool:read check ... Keeping weather proves the fallback". That is no longer true: the test would pass even if the vMCP factory stopped wrapping the decorator, so it no longer guards the wrapping it was written for.
Recommendation: Update the ToolCallImpliesRead and ToolReadNative docs to name Cedar as a native answerer and describe the fallback as applying only to authorizers that do not implement ToolReadNative. Update the tool_filter.go comment. Rewrite the admission test to check that the decorator is wrapped, for example with a non-native mock authorizer, rather than relying on Cedar.
|
Re @ChrisJBurns review (ToolCallImpliesRead contract docs): fixed in c7fcc15. The doc now says Cedar decides tool:read itself (ToolReadNative), so the fallback does not apply to it. |
|
@rkb32 Thanks bud, got some lint failures in CI that we'd need to get fixed before we merge |
|
Addressed in
|
Closes #6924.
Part of #4048. Builds on #6903 (tool:call implies tool:read), now on main.
Summary
Why: Cedar lists a tool on
tools/listonly when acall_toolpolicy allows it, so a policy cannot grant visibility without also allowing invocation (#6924).What: A
read_toolaction. A tool is listed when a permit scoped toread_toolallows it and no call or read forbid matches, or when acall_toolpermit allows it and noread_toolforbid matches. Cedar answerstool:readitself, so thetool:callfallback does not apply to Cedar. The read decision uses only the policies whose action scope namesread_tool.Does this introduce a user-facing change?
read_toolpolicy: no change. They list the same tools as before.read_toolpermit: a tool can be listed without being callable.call_toolforbid still hides its tool fromtools/list. This is unchanged.read_toolin its scope hides the tool even whencall_toolallows it.read_toolonly in its conditions does not hide tools. The server logs a warning at load.tools/list. Before, the same error also hid it.call_toolpermit only means that permit did not match. Aread_toolpermit can still list the tool.read_toolpermit fails the tool read with an error and hides the tool. A brokenread_toolpolicy shows up in the logs.Special notes for reviewers
when { resource.operation == "read" }) and action-group scopes do not hide tools. The docs say so.tool:callfor visibility unlessforward_tool_readis set.Test plan
go test ./pkg/authz/... ./pkg/vmcp/core/(run locally)read_toolrules)golangci-lint(upstream CI, green on 2e0566f)🤖 Generated with Claude Code
Uncovered lines are defensive returns that can't be reached because IDs are built with fixed
::prefixes.