AWS apigateway documentation change
Summary
Rewrote documentation to focus specifically on API execution permissions, added concrete IAM policy examples for invoking APIs, removed general permissions model explanations, and updated resource ARN patterns
Security assessment
The changes improve documentation about IAM policies for API execution permissions but do not address a specific security vulnerability. The added examples demonstrate secure access control patterns but are routine documentation improvements rather than fixes for existing vulnerabilities.
Diff
diff --git a/apigateway/latest/developerguide/api-gateway-iam-policy-examples-for-api-execution.md b/apigateway/latest/developerguide/api-gateway-iam-policy-examples-for-api-execution.md index ca0520384..0886b59c2 100644 --- a//apigateway/latest/developerguide/api-gateway-iam-policy-examples-for-api-execution.md +++ b//apigateway/latest/developerguide/api-gateway-iam-policy-examples-for-api-execution.md @@ -1 +1 @@ -[](/pdfs/apigateway/latest/developerguide/apigateway-dg.pdf#permissions "Open PDF") +[](/pdfs/apigateway/latest/developerguide/apigateway-dg.pdf#api-gateway-iam-policy-examples-for-api-execution "Open PDF") @@ -5 +5 @@ -API Gateway permissions model for creating and managing an API API Gateway permissions model for invoking an API +# IAM policy examples for API execution permissions @@ -7 +7 @@ API Gateway permissions model for creating and managing an API API Gateway permi -# Control access to a REST API with IAM permissions +For permissions model and other background information, see [Control access for invoking an API](./api-gateway-control-access-using-iam-policies-to-invoke-api.html). @@ -9,45 +9 @@ API Gateway permissions model for creating and managing an API API Gateway permi -You control access to your Amazon API Gateway API with [IAM permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_controlling.html) by controlling access to the following two API Gateway component processes: - - * To create, deploy, and manage an API in API Gateway, you must grant the API developer permissions to perform the required actions supported by the API management component of API Gateway. - - * To call a deployed API or to refresh the API caching, you must grant the API caller permissions to perform required IAM actions supported by the API execution component of API Gateway. - - - - -The access control for the two processes involves different permissions models, explained next. - -## API Gateway permissions model for creating and managing an API - -To allow an API developer to create and manage an API in API Gateway, you must [create IAM permissions policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html) that allow a specified API developer to create, update, deploy, view, or delete required [API entities](https://docs.aws.amazon.com/apigateway/latest/api/API_Resource.html). You attach the permissions policy to a user, role, or group. - -To provide access, add permissions to your users, groups, or roles: - - * Users and groups in AWS IAM Identity Center: - -Create a permission set. Follow the instructions in [Create a permission set](https://docs.aws.amazon.com/singlesignon/latest/userguide/howtocreatepermissionset.html) in the _AWS IAM Identity Center User Guide_. - - * Users managed in IAM through an identity provider: - -Create a role for identity federation. Follow the instructions in [Create a role for a third-party identity provider (federation)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp.html) in the _IAM User Guide_. - - * IAM users: - - * Create a role that your user can assume. Follow the instructions in [Create a role for an IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html) in the _IAM User Guide_. - - * (Not recommended) Attach a policy directly to a user or add a user to a user group. Follow the instructions in [Adding permissions to a user (console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_change-permissions.html#users_change_permissions-add-console) in the _IAM User Guide_. - - - - -For more information on how to use this permissions model, see [API Gateway identity-based policies](./security_iam_service-with-iam.html#security_iam_service-with-iam-id-based-policies). - -## API Gateway permissions model for invoking an API - -To allow an API caller to invoke the API or refresh its caching, you must create IAM policies that permit a specified API caller to invoke the API method for which user authentication is enabled. The API developer sets the method's `authorizationType` property to `AWS_IAM` to require that the caller submit the user's credentials to be authenticated. Then, you attach the policy to a user, role, or group. - -In this IAM permissions policy statement, the IAM `Resource` element contains a list of deployed API methods identified by given HTTP verbs and API Gateway [resource paths](https://docs.aws.amazon.com/apigateway/latest/api/API_Resource.html). The IAM `Action` element contains the required API Gateway API executing actions. These actions include `execute-api:Invoke` or `execute-api:InvalidateCache`, where `execute-api` designates the underlying API execution component of API Gateway. - -For more information on how to use this permissions model, see [Control access for invoking an API](./api-gateway-control-access-using-iam-policies-to-invoke-api.html). - -When an API is integrated with an AWS service (for example, AWS Lambda) in the back end, API Gateway must also have permissions to access integrated AWS resources (for example, invoking a Lambda function) on behalf of the API caller. To grant these permissions, create an IAM role of the **AWS service for API Gateway** type. When you create this role in the IAM Management console, this resulting role contains the following IAM trust policy that declares API Gateway as a trusted entity permitted to assume the role: +The following policy statement gives the user permission to call any POST method along the path of `mydemoresource`, in the stage of `test`, for the API with the identifier of `a123456789`, assuming the corresponding API has been deployed to the AWS region of us-east-1: @@ -66 +21,0 @@ JSON - "Sid": "", @@ -68,4 +23,6 @@ JSON - "Principal": { - "Service": "apigateway.amazonaws.com" - }, - "Action": "sts:AssumeRole" + "Action": [ + "execute-api:Invoke" + ], + "Resource": [ + "arn:aws:execute-api::*:a123456789/test/POST/my-demo-resource-path;/*" + ] @@ -77,3 +34 @@ JSON -If you create the IAM role by calling the [create-role](https://docs.aws.amazon.com/cli/latest/reference/iam/create-role.html) command of CLI or a corresponding SDK method, you must supply the above trust policy as the input parameter of `assume-role-policy-document`. Do not attempt to create such a policy directly in the IAM Management console or calling AWS CLI [create-policy](https://docs.aws.amazon.com/cli/latest/reference/iam/create-policy.html) command or a corresponding SDK method. - -For API Gateway to call the integrated AWS service, you must also attach to this role appropriate IAM permissions policies for calling integrated AWS services. For example, to call a Lambda function, you must include the following IAM permissions policy in the IAM role: +The following example policy statement gives the user permission to call any method on the resource path of `petstorewalkthrough/pets`, in any stage, for the API with the identifier of `a123456789`, in any AWS region where the corresponding API has been deployed: @@ -93,2 +48,6 @@ JSON - "Action": "lambda:InvokeFunction", - "Resource": "*" + "Action": [ + "execute-api:Invoke" + ], + "Resource": [ + "arn:aws:execute-api:*:*:a123456789/*/*/petstorewalkthrough/pets" + ] @@ -100,6 +58,0 @@ JSON -Note that Lambda supports resource-based access policy, which combines both trust and permissions policies. When integrating an API with a Lambda function using the API Gateway console, you are not asked to set this IAM role explicitly, because the console sets the resource-based permissions on the Lambda function for you, with your consent. - -###### Note - -To enact access control to an AWS service, you can use either the caller-based permissions model, where a permissions policy is directly attached to the caller's user or group, or the role-based permission model, where a permissions policy is attached to an IAM role that API Gateway can assume. The permissions policies may differ in the two models. For example, the caller-based policy blocks the access while the role-based policy allows it. You can take advantage of this to require that a user access an AWS service through an API Gateway API only. - @@ -112,2 +64,0 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please -AWS condition keys that can be used in API Gateway resource policies - @@ -115,0 +67,2 @@ Control access for invoking an API +Use VPC endpoint policies for private APIs +