An AWS CDK API Gateway method is declared with AuthorizationType.NONE, so anyone can call it
What it finds
A method without an authorizer is open to every client on the internet. Public endpoints exist, but they are the exception; an IAM, Cognito or custom authorizer limits the rest.
From the rule's source, api_gateway_without_auth.rs.
from aws_cdk import aws_apigateway as apigw def stack(resource, integration): resource.add_method("GET", integration, authorization_type=apigw.AuthorizationType.NONE)tx0 reports: this API method needs no authorization resource.add_method("POST", integration, authorization_type=apigw.AuthorizationType.IAM) Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:api-gateway-without-auth" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:api-gateway-without-auth] reason="..."tx0 explain tx0/python:api-gateway-without-auth shows the same in the terminal. Found a false positive? Report it.