> 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/public-exposure/appsec2-aws-51.md).

# AWS API Gateway endpoints without client certificate authentication misconfiguration detected in cod

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_AWS\_51                     |
| Category - Subcategory | Public Exposure - APIs               |
| Provider               | AWS                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 994d466e-fd3a-4a28-8c03-46f017447251 |

## Impact

This rule detects AWS API Gateway endpoints that do not use client certificate authentication. Client certificate authentication provides an additional layer of security by requiring clients to present a valid certificate issued by a trusted Certificate Authority (CA) in order to authenticate and establish a secure connection with the API Gateway endpoint.

## How to Fix

*Resource:* aws\_api\_gateway\_stage

* *Arguments:* client\_certificate\_id

To fix the issue, the `client_certificate_id` argument should be provided in the `aws_api_gateway_stage` resource. This argument allows you to specify the identifier of the ClientCertificate resource that represents the client certificate to use for authentication.

Secure code example:

In the above code example, the `aws_api_gateway_stage` resource includes the `client_certificate_id` argument which references the `aws_api_gateway_client_certificate` resource. This ensures that client certificate authentication is enabled for the API Gateway endpoint.

## By providing a valid client certificate, clients must present this certificate and undergo a mutual authentication process to establish a secure connection with the API Gateway endpoint, enhancing the overall security of the system. \[source,go]

resource "aws\_api\_gateway\_stage" "example" { stage\_name = "prod" rest\_api\_id = aws\_api\_gateway\_rest\_api.example.id deployment\_id = aws\_api\_gateway\_deployment.example.id

* client\_certificate\_id = aws\_api\_gateway\_client\_certificate.example.id }

## resource "aws\_api\_gateway\_client\_certificate" "example" { certificate\_body = filebase64("client\_certificate.pem") certificate\_chain = filebase64("certificate\_chain.pem") private\_key = filebase64("private\_key.pem") }


---

# 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/public-exposure/appsec2-aws-51.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.
