Skip to content

Add a read_tool action so Cedar can grant tools/list visibility without invocation #6924

Done

Description

@rkb32

Current behavior

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.

Depends on #6903 (tool:call implies tool:read).

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.

Activity

  1. added
    needs-triage
    on Oct 22, 2026
  2. jhrozek commented on Oct 22, 2026

    @jhrozek
    Contributor

    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:

    permit(principal, action, resource);
    forbid(principal, action == Action::"call_tool", resource == Tool::"t");
    

    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.

  3. removed
    needs-triage
    on Oct 23, 2026
  4. 01men commented on Nov 1, 2026

    @01men

    @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.

  5. aponcedeleonch commented on Nov 12, 2026

    @aponcedeleonch
    Member

    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.

  6. rkb32 commented on Nov 13, 2026

    @rkb32
    ContributorAuthor

    @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:

    1. Should this stay tools-only, with prompts, resources and skills as a follow-up? I think yes.
    2. 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.
    3. Should the name stay read_tool? I think yes.
    4. 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.

  7. danbarr commented on Nov 23, 2026

    @danbarr
    Collaborator

    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.

  8. rkb32 commented on Nov 27, 2026

    @rkb32
    ContributorAuthor

    Draft PR #7358 implements this design: Cedar decides tools/list visibility with read_tool.

    • A permit that names read_tool lists its tool. An unscoped action permit grants nothing.
    • A forbid on call_tool or read_tool still hides the tool. A call-only forbid keeps hiding its tool.
    • A forbid naming read_tool hides a tool that call_tool allows.
    • Argument-conditioned call_tool permits never grant visibility.
    • Policy sets with no read_tool permit behave as before.
    • Cedar only, tools only. The HTTP PDP is unchanged.

    Still open for maintainers: call-only forbid semantics and the discovery audit. CI is green on 2e0566f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions