Skip to content

Reauthorize tools changed by intervening call-tool filters #1733

Description

@PranavSenthilnathan

Summary

Track a follow-up identified by @halter73 during review of #1722.

Repeated AddAuthorizationFilters() registrations are intended to protect tools when an intervening ordinary call-tool filter changes RequestContext.MatchedPrimitive. The current post-configuration approach installs only one alternate authorization filter because TryAddEnumerable deduplicates the post-configurer. As a result, a primitive changed later in the ordinary filter pipeline is not reauthorized.

Proposed behavior

  • Keep one alternate authorization check outside Tasks so unauthorized task-backed calls are rejected before task creation.
  • Add an ordinary authorization filter for each AddAuthorizationFilters() registration so callers can reauthorize after filters that replace the matched primitive.
  • Consider caching the last authorized primitive in RequestContext.Items to avoid duplicate policy evaluation when the primitive has not changed.
  • Add regression coverage with two authorization registrations separated by an ordinary filter that changes the matched tool.

Context

Original finding by @halter73: #1722 (comment)

Note

This issue was drafted with GitHub Copilot.

Metadata

Metadata

Assignees

No one assigned

    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