AWS ML ★ 89 4 min

Implementing defense-in-depth authorization for MCP tools on Amazon Quick

Advanced (300)Amazon Quick SuiteTechnical How-to

🔗 https://aws.amazon.com/blogs/machine-learning/implementing-defense-in-depth-authorization-for-mcp-tools-on-amazon-quick/

📌 SSO過關不代表能為所欲為:MCP工具的四道授權閘道

TL;DR:AWS示範用JWT claims串聯四道閘道,為MCP工具打造細粒度、可稽核的縱深防禦授權。

拿到一組有效的 SSO token,是不是就等於可以呼叫任何 MCP 工具、存取任何資料?AWS 這篇部落格給出的答案是:不行。「已驗證身分」不等於「已獲得授權」。

🤔 當MCP工具碰到敏感資料,單靠SSO不夠用

MCP(Model Context Protocol)是一種開放協定,能讓應用程式串接內部工具、資料庫與 API,減少客製整合的工作量。但文章指出,一旦這些工具開始碰觸敏感資料,單純有效的 SSO token 就不再足夠:沒有分層的縱深防禦授權機制,一個範圍過寬的 token 就可能讓呼叫者存取超出其角色範圍的工具與資料,進而讓合規稽核變得複雜。舉例來說,一個受監管組織可能要求登入時強制多因子驗證(MFA),並限制來自未核准國家的存取——身分提供者(IdP)能滿足前者,但唯有授權層能落實後者。

🧩 四道閘道,一道攔截器搞定

AWS 提出的做法,是在 Amazon Bedrock AgentCore Gateway 上掛載一個 AWS Lambda REQUEST 攔截器(interceptor),依固定順序評估 OpenID Connect(OIDC)JWT 中的 claims,共分四道閘道:

  1. MFA 驗證
  2. 地理位置限制
  3. 群組對角色的對應(RBAC)
  4. 工具層級的權限檢查

其中第 3、4 道閘道(RBAC 與工具權限)是核心授權層,恆常啟用;第 1、2 道閘道則可透過環境變數彈性開關,依組織的合規需求決定要啟用幾道。文章特別說明第 1 道 MFA 閘道其實有兩層把關:Entra ID 的 Conditional Access Policy 會在核發 token 前就先要求完成 MFA,攔截器內則可另外再檢查 token 中的 amr claim,作為第二層確認;任何一道閘道未通過的請求,會直接被拒絕並回傳 403,不會碰到工具或底層資料,通過的每一筆異動(mutation)則會寫入不可竄改的稽核紀錄。

💡 用PKCE與Resource Indicators把token鎖死在單一端點

技術實作上,Amazon Quick 使用 PKCE(Proof Key for Code Exchange)搭配 RFC 8707 Resource Indicators,將每個 access token 綁定到特定的 API 端點:在 token 交換過程中,Amazon Quick 會把 AgentCore Gateway 的 URL 當作 resource 參數傳給 Entra ID,而當 resource 是以 URL 表示時,Entra ID 要求 client 與 resource 必須是各自獨立的應用程式註冊。文章以一家虛構企業 AnyCompany Global Services 為例,說明這套模式如何應用在一個透過 MCP 存取、架設於 Amazon DynamoDB 上的多租戶風險登記系統,並指出這類需求在金融服務、醫療與政府單位這類需要合規稽核的產業中特別常見。

⚠️ 這是一份接續部署的設定指南,不是從零開始的教學

文章明確說明,這套走查(walkthrough)假設 AWS 端的資源(AgentCore Gateway、攔截器 Lambda、工具 Lambda、DynamoDB 資料表)都已經部署完成,重點放在身分與授權層的設定;此外,啟用 Conditional Access Policy 需要 Microsoft Entra ID P1 或 P2 授權,操作者也需要具備 Global Administrator 或 Application Administrator 權限。

🎯 實務啟示

如果團隊正把敏感資料源透過 MCP 接上像 Amazon Quick 這類 AI 助理,這套「四道閘道+不可竄改稽核紀錄」的模式,提供了一個可落地的合規範本:核心思路是把 RBAC 與工具層級權限設為恆常防線,再依實際合規要求彈性疊加 MFA 與地理限制,讓每一次工具呼叫都成為一個可被稽核、可被解釋的存取事件。

🔗 來源

#MCP #AWS #AmazonBedrock #AgentCore #Authorization #Cybersecurity #RBAC #JWT #EnterpriseAI #CloudSecurity

原始資料 AWS ML · 收集於 2026-09-17
來源原標題
Implementing defense-in-depth authorization for MCP tools on Amazon Quick
作者
Anneline Sibanda
原始標籤
Advanced (300) · Amazon Quick Suite · Technical How-to
原始連結
https://aws.amazon.com/blogs/machine-learning/implementing-defense-in-depth-authorization-for-mcp-tools-on-amazon-quick/

摘要原文

Each Model Context Protocol (MCP) tool invocation on Amazon Quick is an access event that can require defense-in-depth authorization at the tool and parameter level. This applies in addition to a valid token. Without granular controls, a single misconfigured permission can bypass the access requirements that organizations might need to fulfill for compliance purposes. In this blog post, you implement a multi-gate authorization pattern that evaluates OpenID Connect (OIDC) JSON Web Token (JWT) claims in sequence. The pattern enforces role-based and attribute-based access control on each invocation. You configure which authorization controls to activate based on your compliance requirements, from group-based permissions to parameter-level attribute checks. Microsoft Entra ID serves as the identity provider (IdP) for this walkthrough. When you connect MCP tools to Amazon Quick, a valid single sign-on (SSO) confirms who the caller is but not what they should be allowed to do. Authorization closes that gap, turning a verified identity into a set of enforceable rules about what each caller can reach. Model Context Protocol (MCP) is an open protocol that connects applications to internal tools, databases, and APIs, reducing the need for custom integrations. However, the moment those tools reach sensitive data, a valid SSO token is no longer enough. Without layered, defense-in-depth authorization, a single over-broad token can reach tools and data beyond the caller’s role, which can expose data and complicate compliance audits. When an organization connects sensitive data sources to Amazon Quick through MCP, “authenticated” no longer equals “authorized.” Authorization decides which tools a caller can invoke, from which locations, and at what privilege level. For example, a regulated organization requires multi-factor authentication (MFA) at sign-in and restricts access from unapproved countries. The identity provider enforces the first requirement, and the authorization layer enforces the second. Standard OAuth 2.0 identity verification doesn’t enforce what callers can do at the tool and parameter level. This post explains how the multi-gate authorization pattern works and walks you through configuring the identity layer that drives it. The interceptor processes OpenID Connect (OIDC) JSON Web Token (JWT) claims through four gates: MFA, geographic restriction, group-to-role mapping, and tool-level permission checks. In this walkthrough you configure the Microsoft Entra ID applications, claims, and policies the gates rely on. You then connect Amazon Quick to an existing Amazon Bedrock AgentCore Gateway, a capability of Amazon Bedrock AgentCore. The gateway provides the HTTP endpoint and JWT validation layer between clients and MCP tools. You validate the allow and restricted paths by signing in as different personas. This walkthrough assumes you have already deployed the AWS components, including the gateway, the interceptor AWS Lambda function, the tool Lambda functions, and the Amazon DynamoDB tables. You get an auditable, composable security layer that sits between the user’s natural-language request and your business logic. This blog post uses a fictional example: AnyCompany Global Services, an enterprise that maintains a multi-tenant risk register hosted on Amazon DynamoDB accessed through MCP tools on Amazon Quick. This pattern is relevant for financial services, healthcare, and government organizations that can require granular access controls for compliance audits. AnyCompany requires that each tool invocation comes from an authenticated caller who has completed MFA. Callers connecting from unapproved countries are denied access. Role-based permissions enforce a strict read/write boundary: readers can query risks but can’t create, update, or delete them, while administrators can bypass conditional gates for operational flexibility. Finally, every mutation must produce an immutable audit record to satisfy compliance and forensic requirements. The multi-gate authorization user flow shown in Figure 1 addresses each of the preceding requirements. You implement it through a single AWS Lambda REQUEST interceptor attached to Amazon Bedrock AgentCore Gateway . The interceptor evaluates JWT claims in a fixed sequence, and each gate operates independently. Figure 1: Multi-gate authorization user flow The authorization gates process requests in this order: Each gate is independently configured through environment variables. Gates 3 and 4, group role-based access control (RBAC) and tool permission, form the core authorization layer and are always active. The remaining two gates are conditional and can be disabled by setting the environment variables to false or by omitting them entirely. This means a deployment requiring only RBAC and geo-fencing activates three gates. A deployment requiring further granularity and control can activate each of the four checks. Gate 1 is the only gate that is enforced outside the interceptor. Entra ID applies the Conditional Access Policy before it issues a token, so every token that reaches the gateway has already satisfied MFA. Setting REQUIRE_MFA turns on an additional check of the amr claim inside the interceptor, for identity providers that record MFA evidence in the token. The two mechanisms work together: the policy keeps unverified callers out, and the claim check confirms in the request path that the token carries the evidence. The interceptor evaluates all four authorization gates before business logic runs. A request that fails a gate is denied with a 403 and doesn’t reach the tool or its data. Each mutation that passes writes an immutable audit record, giving you a complete, queryable trail of who did what. Before deploying the solution, set up your identity provider. This walkthrough assumes familiarity with AWS Lambda, OAuth 2.0 authorization flows, and Microsoft Entra identity provider configuration. You also need access to a few AWS services and an OIDC identity provider, described in the following sections. This walkthrough assumes the AWS side of the pattern is already deployed in your account. That side comprises an Amazon Bedrock AgentCore Gateway configured with a CUSTOM_JWT authorizer, the AWS Lambda REQUEST interceptor, the tool Lambda functions, and the Amazon DynamoDB tables they use. Deploying those resources is outside the scope of this post, which focuses on the identity and authorization configuration. This walkthrough uses Microsoft Entra ID as the identity provider. The authorization pattern works with OIDC-eligible identity providers. However, the configuration steps vary based on the identity provider you choose. You need the following in your Entra ID tenant: a Global Administrator or Application Administrator role to create app registrations, security groups, and the Conditional Access Policy that enforces MFA. Conditional Access Policies need a Microsoft Entra ID P1 or P2 license. For validation, prepare at least three test users with different group memberships. The following sections walk you through registering the two app registrations, exposing the API, and wiring up permissions. You also configure the claims the AWS Lambda interceptor reads to control permissions on the MCP tools. Throughout, replace the placeholder identifiers ({TENANT_ID}, {RESOURCE_APP_ID}, {GATEWAY_URL}, and so on) with the values from your own tenant. Amazon Quick uses Proof Key for Code Exchange (PKCE) and RFC 8707 Resource Indicators , a standard for binding tokens to specific API endpoints. Together they scope each access token to a specific MCP server. During the token exchange, Amazon Quick sends the AgentCore Gateway URL as the resource parameter. Entra ID requires the client and resource represented by separate app registrations when the resource is identified by a URL. Steps 1 through 3 register the resource application, set its Application ID URI, and expose the API scopes that Amazon Quick requests.

由 claude-code/sonnet 自動生成