Reauthorize tools changed by call-tool filters - #1737
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5feb0906-73fc-4e1a-8cf2-c9a99c588487
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5feb0906-73fc-4e1a-8cf2-c9a99c588487
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5feb0906-73fc-4e1a-8cf2-c9a99c588487
|
Reviewed the change in depth. It is correct and the Tasks order-guard removal is justified (ordinary filters always run inside the task background via the alternate pipeline, so the old restriction was over-strict). A few risks/gaps and an alternative worth considering: Risks / gaps
Alternative Tests |
Add coverage for repeated authorization across multiple tool replacements. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5feb0906-73fc-4e1a-8cf2-c9a99c588487
|
@tarekgh Thanks for the detailed review. I kept the explicit ordered-checkpoint design because that is both the pre-#1722 behavior and the behavior requested by #1733: each I pushed 2c38637 to make the checkpoint semantics explicit in the API remarks (including changes to either On the other points:
|
halter73
left a comment
There was a problem hiding this comment.
I agree it'd be nice to avoid running auth in both the legacy and new experimental alternate-tool-result pipeline, but I think it's the best approach currently.
c7e4b82
into
modelcontextprotocol:main
|
@PranavSenthilnathan Thanks, your responses address the points well. Agreed the checkpoint contract matches #1733, and points 2 and 4 are valid (User is mutable so a primitive-only cache is unsafe, and the replacement is only known after Tasks dispatches). The PR as-is is good enough for the current release. One follow-up worth tracking: the checkpoint model is fail-open by default. If an author rewrites This can be done later without a breaking change: it is internal wiring in |
Summary
AddAuthorizationFilters()registration so an intervening call-tool filter can replace and reauthorize the matched toolCloses #1733
Testing
dotnet builddotnet test tests\ModelContextProtocol.AspNetCore.Tests\ModelContextProtocol.AspNetCore.Tests.csproj --no-build --filter "FullyQualifiedName~AuthorizeAttributeTests|FullyQualifiedName~HttpTaskIntegrationTests"dotnet test --no-build(all ASP.NET Core tests pass; existing Core integration tests fail becauseTestServer.exeis not available on PATH)