centralize role resolution across all MCP tools
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- csharp
調査の方向性
McpAuthorizationHelper と、名前が指定された 8 つの MCP ツールのエントリポイントを読み、続いて PR #3737 にある既存の alignment および security の変更と比較します。role header が McpAuthorizationHelper でのみ読み取られていること、MCP コードがそれを分割していないこと、すべてのツールが TryResolveValidatedRole を使用していること、既存のテストが通ることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Related PR: #3737 — MSRC 31000000666371: MCP describe_entities info-disclosure fix + single-role alignment
Proposed fix
Add a single choke point on McpAuthorizationHelper that every MCP tool calls to obtain the caller's role:
public static bool TryResolveValidatedRole(
HttpContext httpContext,
IAuthorizationResolver authResolver,
out string? role);
Behavior:
- Delegates validation to
IAuthorizationResolver.IsValidRoleContext(exactly-one non-empty header value +HttpContext.User.IsInRole(header)). - Returns the validated
X-MS-API-ROLEheader value verbatim as the single role for the request. - Is the only place any MCP code reads
AuthorizationResolver.CLIENT_ROLE_HEADER.
Then refactor every MCP tool to call it: DescribeEntitiesTool, AggregateRecordsTool, CreateRecordTool, DeleteRecordTool, ExecuteEntityTool, ReadRecordsTool, UpdateRecordTool, DynamicCustomTool.
Design
- Single-role model.
X-MS-API-ROLEis one atomic role. No splitting, no unioning. Matches REST, GraphQL, and DAB's existingClientRoleHeaderAuthorizationMiddleware. - Resolver-owned inheritance. Per-entity authorization goes through
IAuthorizationResolver.AreRoleAndOperationDefinedForEntity/GetAllowedExposedColumns, soanonymous → authenticated → namedinheritance and wildcardAllexpansion are consistent with REST/GraphQL. - One header read.
AuthorizationResolver.CLIENT_ROLE_HEADERappears in exactly one MCP file after this change.
Acceptance
grep AuthorizationResolver.CLIENT_ROLE_HEADER src/Azure.DataApiBuilder.Mcp/**returns one match, inMcpAuthorizationHelper.- No
.Split(',')on the role header anywhere in the MCP project. - All MCP tools use
TryResolveValidatedRole; existing tests still pass.
Non-goals
- No resolver behavior changes.
- No config schema changes.
- No new live-database tests.
Reference
See PR #3737 for the single-role model, the MSRC fix in DescribeEntitiesTool, and the McpAuthorizationHelper.TryResolveAuthorizedRole alignment this issue builds on.
- 主要言語
- C#
- スター
- 1.5k
- フォーク
- 372
- 平均マージ
- 9日 1時間
- マージ済み PR(30日)
- 13
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/data-api-builder のほかの issue
-
pgsql
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3598 ·
-
2.x cli mcp-server
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3576 ·
-
2.x health-endpoint
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3570 ·
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/data-api-builder#3564 ·
-
2.x telemetry
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/data-api-builder#3562 ·
Azure/data-api-builder の issue をすべて見る
似ている issue
-
area-ai untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/extensions#7783 ·
-
untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
dotnet/dotnet-api-docs#13095 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
type/automation type/tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
newrelic/newrelic-dotnet-agent#3850 · コメント 1 件 ·