> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/iam/appsec-aws-309.md).

# Authorization type for API GatewayV2 routes is not specified misconfiguration detected in code

## Rule Details

|                        |                               |
| ---------------------- | ----------------------------- |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_309              |
| Category - Subcategory | IAM - Authentication Policies |
| Provider               | AWS                           |
| Severity               | MEDIUM                        |
| Framework              | Terraform, Terraform Plan     |

## Impact

This rule is reviewing AWS API GatewayV2 configurations to ensure that all routes specify an authorization type. Without specifiying an authorization type within the routes, it might allow unauthorized users to access sensitive data or execute harmful operations. Therefore, not setting an authorization type can potentially lead to data leakage or other security issues.

## How to Fix

*Resource:* aws\_apigatewayv2\_route

* *Arguments:* authorization\_type

To fix this issue, you should explicitly define the authorization type for the API GatewayV2 route of either "AWS\_IAM", "CUSTOM", or "JWT".

## The provided code is secure because it specifies the authorization type for the API GatewayV2 route which controls who can access the API. In this specific case, we are using AWS\_IAM as the authorization type which restricts access to users with the necessary IAM policies. By specifying the authorization type, you can ensure that only authorized users can access your API, thus reducing the risk of unauthorized access. \[source,go]

## resource "aws\_apigatewayv2\_route" "example" { api\_id = aws\_apigatewayv2\_api.example.id route\_key = "$default" target = "integrations/${aws\_apigatewayv2\_integration.example.id}" authorization\_type = "AWS\_IAM" }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/iam/appsec-aws-309.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
