Support Skills authorization without cross-package dependencies
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- csharp
- Bereich
- api, authentication, backend
Rechercherichtung
Start by reading the Core hosting primitive-filter composition and the existing AddAuthorizationFilters policy evaluator, then trace how Skills composes skills/list and skills/get handlers. The issue requires a shared hook that preserves existing authorization checkpoints, request services, and Tasks dispatch order while avoiding package dependency changes. Done means the acceptance criteria pass, including Native AOT compatibility and no new package dependency.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
The registered-Skills/typed-handler design associated with #1863 should participate in AddAuthorizationFilters. Authorizing the file resources alone does not protect the frontmatter and manifests exposed by skills/list and skills/get. Wrapping the optional custom Skills handlers is insufficient: registered entries augment the list afterward, and matched registered gets take precedence over the fallback.
Applications should be able to use WithSkills(...) plus AddAuthorizationFilters() with their existing ASP.NET authorization services, without a separate integration registration or package. ModelContextProtocol.AspNetCore must not reference Skills, and Skills must not acquire an ASP.NET authorization dependency.
Recommended approach
Add a small, experimental, policy-neutral primitive-filter seam in Core/hosting over IMcpServerPrimitive and its server-local metadata. It needs a typed invocation hook around the complete composed handler after matching, plus a listing-visibility hook for entries mapped to registered primitives. A McpServerPrimitiveFilter-style contract is illustrative; this does not require a new catalog abstraction or a large generic framework.
AddAuthorizationFilters registers an adapter that reuses its existing policy evaluator. Skills owns the protocol-specific matching and list projection and consumes the shared hook automatically. Keep the existing tool/prompt/resource typed adapters at their current checkpoints rather than replacing them with a single outer filter: intervening filters can change the principal or matched primitive, and tool authorization must still precede Tasks dispatch.
Expected behavior and acceptance criteria
WithSkillsandAddAuthorizationFilterswork in either registration order, with no additional application integration step or cross-package dependency.- Protected registered entries are omitted from the complete composed listing. Registered gets are matched and authorized before dispatch, including URI-equivalent requests; denial never falls through to the custom handler. Authorized direct get/read does not depend on listing membership.
- Reuse the existing
IAuthorizeData, explicitAuthorizationPolicy,IAuthorizationRequirementData, andIAllowAnonymousbehavior. Unprotected/anonymous entries remain usable; missing authorization services or filters produce actionable local diagnostics rather than silently exposing protected entries. - Preserve repeated authorization checkpoints around changes to the user or matched primitive, existing typed-filter order, and denial before task creation.
- Resolve authorization services from
context.Servicesand usecontext.User. Reuse stateless HTTP'sHttpContext.RequestServicesand existing MCP request scopes/disposal; do not manufacture scopes or capture request services in shared filters. - Preserve Skills snapshots, validation, initial-null-cursor augmentation, registered-get precedence, conservative get defaults, protocol-version handling, and source-generated/Native AOT compatibility.
Boundaries and open decision
Custom database entries without registered primitive metadata remain application-owned: authorize before pagination and cursor construction, and authorize direct get/read independently. A generic post-page filter cannot sanitize an arbitrary application cursor. Do not load a whole database source or mutate shared registrations per caller to compensate.
Skill files remain ordinary resources with separately applied corresponding policies, especially when files are shared. Do not implicitly copy/merge skill metadata onto files or add automatic file revocation when a skill is removed.
The prototype preserves handler-supplied cache hints. Caller-dependent results must not be reused through public caching; decide whether authorization filtering should constrain/reject public hints or leave that enforcement with the application.
A local-only prototype exercised composed Skills list/get, stateless HTTP service identity and async disposal, policy/guard parity, repeated checkpoints, and pre-Tasks authorization, and built and ran under Native AOT without changing the package dependency graph. The recommendation is the small shared seam, not shipping the prototype verbatim. Related: #1941 for request-service integration and #1704 for broader extension-handler composition.
[!NOTE]
This issue was generated by GitHub Copilot from a local prototype at the maintainer's request.
- Vorherrschende Sprache
- C#
- Sterne
- 4.6k
- Forks
- 849
- Ø Merge
- 1 T. 16 Std.
- Gemergte PRs (30 T.)
- 24
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/csharp-sdk
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
modelcontextprotocol/csharp-sdk#2031 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Static resources whose URIs differ only in the fragment or user info collapse into oneEvtl. vergeben @halter73 hat das vor 9 Tagen übernommen. OffenP2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
modelcontextprotocol/csharp-sdk#1970 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
POST /mcp with a missing or unparseable Content-Type returns HTTP 500 instead of a 4xxEvtl. vergeben @halter73 hat das vor 9 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
modelcontextprotocol/csharp-sdk#1966 · 5 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Reserved URI-template expansion throws for supplementary Unicode charactersEvtl. vergeben @tarekgh hat das vor 2 Tagen übernommen. OffenP3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
modelcontextprotocol/csharp-sdk#1913 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
ClaimsPrincipal parameter injection sample requestEvtl. vergeben @utsavjain2809 hat das vor 48 Tagen übernommen. Offenhelp wanted P3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
modelcontextprotocol/csharp-sdk#1899 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/csharp-sdk
Ähnliche Issues
-
account bug effort:S P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
nightscout/nocturne#3745 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
grate-devs/grate#969 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
jsboige/CoursIA#27768 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 63/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
martin-stromberg/FinanceManager#562 ·
Maintainer antworten meist innerhalb von 1 Tag