You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a read_tool action so Cedar can grant tools/list visibility without invocation #6924
Cedar only checks call_tool. A tool appears in tools/list only when a call_tool policy allows it, so a policy cannot grant visibility alone.
Wanted
A read_tool action, so a policy can list a tool without allowing it to be called.
Where
pkg/authz/authorizers/cedar/core.go: AuthorizeWithJWTClaims has no tool/read case. The read check currently returns an "unsupported" error, which is ignored, and the tool:call check decides.
I found this while reviewing #6903. I'd like to work on it if a maintainer agrees it's worth doing. Could you assign it to me once you've had a look? Thanks.
Thanks for writing this up. Before anyone starts on it, there's a catch. A real read_tool action changes what some existing policies do, so it isn't purely additive.
Today tools/list asks about call_tool, so the forbid applies and t is hidden. With #6903 as it stands it's still hidden, because the Cedar read check errors and the call check decides. If Cedar evaluated Action::"read_tool", the read request would match the broad permit and not the call-only forbid, so t would be listed. I checked this against the real Cedar authorizer. The same goes for unless { action == Action::"call_tool" } and any forbid that only looks at call context.
Action groups don't get us out of it. With read_tool in call_tool, policies written as action == Action::"call_tool" still never match a read request, because == is exact. With call_tool in read_tool, a read grant would allow calls.
So I think this needs a short design first. It should say what a call-only forbid should mean for visibility, and how existing deployments get through the change: opt-in, a migration note, or something else. Happy to look at a proposal here before any code.
@jhrozek is right that it isn't additive, and I think the reason is narrower than "a new action changes policy meaning." It's that forbid(action == Action::"call_tool") is currently the only way to express two different intents, and they're about to diverge.
In the policy set you posted, the author's intent is almost certainly "this tool must never be invoked." But the enforcement they observe is "this tool is never advertised." Those coincide only because authorizeToolCall is the single gate. Once read_tool exists, that one policy means the first and not the second — so every existing deployment that used a call-only forbid as a hiding mechanism silently starts advertising tools it meant to hide. That's a confidentiality change, not a listing change, and it's the part that needs an explicit decision.
One thing that makes it tractable: there are already two gates, not one.
authorizeFeatureList evaluates Action::"list_tools" against FeatureType::tool — a coarse, per-feature-type gate on the whole list.
authorizeToolCall then decides per tool, and today it's what the response filter consults (responseFilterForMethod → responseFilterTools).
So per-tool visibility is currently inferred from the call gate. read_tool would make it explicit, which is why it's a fourth level rather than a rename of the third. Deployments already setting list_tools to false are unaffected — nothing is listed regardless — so the blast radius is only "listed, then refused per tool," which is exactly the set that today looks hidden.
On migration, an opt-in flag is the wrong seam (two policy languages in one process). A policy-set-level check is cleaner: parse the loaded policy set once for any reference to Action::"read_tool". If absent, evaluate reads by delegating to the call decision, which reproduces today's behaviour byte for byte and needs no migration note. If present, the author has opted in and the new semantics apply. That keeps a single evaluation path and makes the change opt-in per policy set rather than per deployment.
For the semantic question itself: a call-only forbid should mean "not invocable," and should not imply "not visible." That's the defensible reading — but it's the opposite of what ships today, so it needs to be stated in the release notes as a behaviour change with the delegation fallback as the escape hatch, not presented as additive.
Thanks for the detailed design, @01men, and sorry it sat for a while. I went through it against the code. The diagnosis is right: today a call-only forbid does double duty, since tools/list visibility comes only from the call_tool check.
The part I'd change is the set-wide opt-in. It brings back the regression flagged earlier in this thread. Adding one narrow read_tool permit for a single group flips the whole policy set, and every existing call-only forbid stops hiding its tool from anyone covered by a broad permit. That's a fail-open caused by an unrelated, additive edit. Since one authorizer config can be shared across servers, one team's policy could also change another team's semantics.
Detecting "any reference" is also fragile. read_tool can be referenced by string through action.operation, and a call-only forbid can be written as resource.operation == "call" without naming the action.
I'd rather make read grants explicit: a tool is visible if call is allowed, or if read_tool is allowed by a permit that names read_tool in its action scope. Unscoped action permits alone wouldn't grant visibility. That's additive, so no existing policy set changes behavior. If we do want a mode, I'd make it an explicit config flag rather than detection.
Two smaller points. list_tools isn't a separate gate today: list operations are always allowed and only the per-tool filter applies. And prompts, resources and skills have the same visibility vs access conflation, so we should either say this is tools-only on purpose or pick a verb that generalizes, since read_resource already means fetching content.
This builds on #6903, which is still in review, so I'd land that first. @rkb32, you offered to take this. Happy to assign it to you once #6903 is in and we've agreed on the shape.
@aponcedeleonch@jhrozek@01men thanks for the design and the reviews. They helped me see the problem more clearly. Here is how I would implement explicit read grants, with four questions for you.
The rule I have in mind is this. A tool shows up in tools/list if no forbid matches it on call_tool or read_tool, and a permit allows it, either for call_tool or for read_tool when the permit names read_tool directly. An unscoped action permit grants nothing, even if it checks resource.operation. Forbids always win, scoped or not. That covers @jhrozek's example: a call-only forbid still hides the tool, so nothing changes there.
Existing policy sets that have no read_tool permit keep behaving as they do today, which is why I'm not proposing a set-wide mode, following @aponcedeleonch. Read checks pass no arguments and use operation = read, so any has-guarded argument condition never matches. The HTTP PDP stays on tool:call for now, so read visibility applies to Cedar only.
I'd like your view on four things:
Should this stay tools-only, with prompts, resources and skills as a follow-up? I think yes.
Should a call-only forbid keep hiding the tool, as it does today, or follow @01men's reading that it should only stop invocation? I'd keep hiding, and treat any change as its own explicit change with release notes.
Should the name stay read_tool? I think yes.
Should the discovery audit count tools that are listed through a read_tool permit, even though they can't be called? I think yes.
I'll wait for #6903 to land and for the assignment before I write any code.
A concrete use case for this, from a demo I built today: an MCPServer running Google's MCP Toolbox for Databases, with a Cedar policy that permits execute_sql only when the sql argument is a single SELECT:
permit(principal, action == Action::"call_tool", resource == Tool::"execute_sql")
when { context has arg_sql && (context.arg_sql like "SELECT *" || context.arg_sql like "select *") && ... };
That permit hides execute_sql from tools/list entirely, because list filtering checks call_tool with no arguments. I had to widen the permit to !(context has arg_sql) || (...) and add forbid ... when { context has arg_sql_present } for non-scalar values. That works, but it's not obvious, and it reads as "calls without the argument are allowed". With read_tool, the intent would be explicit: one read_tool permit for visibility, and the argument-conditioned call_tool permit for invocation.
Until this lands, it would help if docs/authz.md said that an argument-conditioned call_tool permit hides the tool from tools/list. The doc currently says only that list results are filtered by call_tool policies and that arg_* conditions don't match the completion and subscription methods.
Activity
jhrozek commentedon Oct 22, 2026
Thanks for writing this up. Before anyone starts on it, there's a catch. A real read_tool action changes what some existing policies do, so it isn't purely additive.
Take this policy set:
Today tools/list asks about call_tool, so the forbid applies and t is hidden. With #6903 as it stands it's still hidden, because the Cedar read check errors and the call check decides. If Cedar evaluated Action::"read_tool", the read request would match the broad permit and not the call-only forbid, so t would be listed. I checked this against the real Cedar authorizer. The same goes for
unless { action == Action::"call_tool" }and any forbid that only looks at call context.Action groups don't get us out of it. With read_tool in call_tool, policies written as
action == Action::"call_tool"still never match a read request, because == is exact. With call_tool in read_tool, a read grant would allow calls.So I think this needs a short design first. It should say what a call-only forbid should mean for visibility, and how existing deployments get through the change: opt-in, a migration note, or something else. Happy to look at a proposal here before any code.
01men commentedon Nov 1, 2026
@jhrozek is right that it isn't additive, and I think the reason is narrower than "a new action changes policy meaning." It's that
forbid(action == Action::"call_tool")is currently the only way to express two different intents, and they're about to diverge.In the policy set you posted, the author's intent is almost certainly "this tool must never be invoked." But the enforcement they observe is "this tool is never advertised." Those coincide only because
authorizeToolCallis the single gate. Onceread_toolexists, that one policy means the first and not the second — so every existing deployment that used a call-only forbid as a hiding mechanism silently starts advertising tools it meant to hide. That's a confidentiality change, not a listing change, and it's the part that needs an explicit decision.One thing that makes it tractable: there are already two gates, not one.
authorizeFeatureListevaluatesAction::"list_tools"againstFeatureType::tool— a coarse, per-feature-type gate on the whole list.authorizeToolCallthen decides per tool, and today it's what the response filter consults (responseFilterForMethod→responseFilterTools).So per-tool visibility is currently inferred from the call gate.
read_toolwould make it explicit, which is why it's a fourth level rather than a rename of the third. Deployments already settinglist_toolsto false are unaffected — nothing is listed regardless — so the blast radius is only "listed, then refused per tool," which is exactly the set that today looks hidden.On migration, an opt-in flag is the wrong seam (two policy languages in one process). A policy-set-level check is cleaner: parse the loaded policy set once for any reference to
Action::"read_tool". If absent, evaluate reads by delegating to the call decision, which reproduces today's behaviour byte for byte and needs no migration note. If present, the author has opted in and the new semantics apply. That keeps a single evaluation path and makes the change opt-in per policy set rather than per deployment.For the semantic question itself: a call-only
forbidshould mean "not invocable," and should not imply "not visible." That's the defensible reading — but it's the opposite of what ships today, so it needs to be stated in the release notes as a behaviour change with the delegation fallback as the escape hatch, not presented as additive.aponcedeleonch commentedon Nov 12, 2026
Thanks for the detailed design, @01men, and sorry it sat for a while. I went through it against the code. The diagnosis is right: today a call-only forbid does double duty, since tools/list visibility comes only from the call_tool check.
The part I'd change is the set-wide opt-in. It brings back the regression flagged earlier in this thread. Adding one narrow read_tool permit for a single group flips the whole policy set, and every existing call-only forbid stops hiding its tool from anyone covered by a broad permit. That's a fail-open caused by an unrelated, additive edit. Since one authorizer config can be shared across servers, one team's policy could also change another team's semantics.
Detecting "any reference" is also fragile. read_tool can be referenced by string through
action.operation, and a call-only forbid can be written asresource.operation == "call"without naming the action.I'd rather make read grants explicit: a tool is visible if call is allowed, or if read_tool is allowed by a permit that names read_tool in its action scope. Unscoped
actionpermits alone wouldn't grant visibility. That's additive, so no existing policy set changes behavior. If we do want a mode, I'd make it an explicit config flag rather than detection.Two smaller points.
list_toolsisn't a separate gate today: list operations are always allowed and only the per-tool filter applies. And prompts, resources and skills have the same visibility vs access conflation, so we should either say this is tools-only on purpose or pick a verb that generalizes, sinceread_resourcealready means fetching content.This builds on #6903, which is still in review, so I'd land that first. @rkb32, you offered to take this. Happy to assign it to you once #6903 is in and we've agreed on the shape.
rkb32 commentedon Nov 13, 2026
@aponcedeleonch @jhrozek @01men thanks for the design and the reviews. They helped me see the problem more clearly. Here is how I would implement explicit read grants, with four questions for you.
The rule I have in mind is this. A tool shows up in
tools/listif no forbid matches it oncall_toolorread_tool, and a permit allows it, either forcall_toolor forread_toolwhen the permit namesread_tooldirectly. An unscopedactionpermit grants nothing, even if it checksresource.operation. Forbids always win, scoped or not. That covers @jhrozek's example: a call-only forbid still hides the tool, so nothing changes there.Existing policy sets that have no
read_toolpermit keep behaving as they do today, which is why I'm not proposing a set-wide mode, following @aponcedeleonch. Read checks pass no arguments and useoperation=read, so anyhas-guarded argument condition never matches. The HTTP PDP stays ontool:callfor now, so read visibility applies to Cedar only.I'd like your view on four things:
read_tool? I think yes.read_toolpermit, even though they can't be called? I think yes.I'll wait for #6903 to land and for the assignment before I write any code.
danbarr commentedon Nov 23, 2026
A concrete use case for this, from a demo I built today: an MCPServer running Google's MCP Toolbox for Databases, with a Cedar policy that permits
execute_sqlonly when thesqlargument is a singleSELECT:That permit hides
execute_sqlfromtools/listentirely, because list filtering checkscall_toolwith no arguments. I had to widen the permit to!(context has arg_sql) || (...)and addforbid ... when { context has arg_sql_present }for non-scalar values. That works, but it's not obvious, and it reads as "calls without the argument are allowed". Withread_tool, the intent would be explicit: oneread_toolpermit for visibility, and the argument-conditionedcall_toolpermit for invocation.Until this lands, it would help if
docs/authz.mdsaid that an argument-conditionedcall_toolpermit hides the tool fromtools/list. The doc currently says only that list results are filtered bycall_toolpolicies and thatarg_*conditions don't match the completion and subscription methods.rkb32 commentedon Nov 27, 2026
Draft PR #7358 implements this design: Cedar decides
tools/listvisibility withread_tool.read_toollists its tool. An unscopedactionpermit grants nothing.call_toolorread_toolstill hides the tool. A call-only forbid keeps hiding its tool.read_toolhides a tool thatcall_toolallows.call_toolpermits never grant visibility.read_toolpermit behave as before.Still open for maintainers: call-only forbid semantics and the discovery audit. CI is green on 2e0566f.