|
1 | 1 | { |
2 | 2 | "Provider": "aws", |
3 | 3 | "CheckID": "apigatewayv2_api_access_logging_enabled", |
4 | | - "CheckTitle": "Ensure API Gateway V2 has Access Logging enabled.", |
| 4 | + "CheckTitle": "API Gateway V2 API stage has access logging enabled", |
5 | 5 | "CheckAliases": [ |
6 | 6 | "apigatewayv2_access_logging_enabled" |
7 | 7 | ], |
8 | 8 | "CheckType": [ |
9 | | - "IAM" |
| 9 | + "Software and Configuration Checks/AWS Security Best Practices" |
10 | 10 | ], |
11 | 11 | "ServiceName": "apigatewayv2", |
12 | 12 | "SubServiceName": "", |
13 | | - "ResourceIdTemplate": "arn:partition:service:region:account-id:resource-id", |
| 13 | + "ResourceIdTemplate": "", |
14 | 14 | "Severity": "medium", |
15 | | - "ResourceType": "AwsApiGatewayV2Api", |
16 | | - "Description": "Ensure API Gateway V2 has Access Logging enabled.", |
17 | | - "Risk": "If no authorizer is enabled anyone can use the service.", |
| 15 | + "ResourceType": "AwsApiGatewayV2Stage", |
| 16 | + "Description": "**API Gateway v2** stages have **access logging** configured to capture request details and deliver them to a logging destination (e.g., CloudWatch Logs or Firehose). The evaluation looks for logging being enabled at each API stage.", |
| 17 | + "Risk": "Without access logs, API calls lack traceability, making it hard to spot credential misuse, route abuse, or anomalous traffic.\n\nThis reduces confidentiality and integrity through undetected data access or manipulation, and impacts availability by slowing incident response.", |
18 | 18 | "RelatedUrl": "", |
| 19 | + "AdditionalURLs": [ |
| 20 | + "https://docs.aws.amazon.com/apigateway/latest/developerguide/security-monitoring.html", |
| 21 | + "https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html", |
| 22 | + "https://support.icompaas.com/support/solutions/articles/62000229562-ensure-api-gateway-v2-has-access-logging-enabled", |
| 23 | + "https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/APIGateway/api-gateway-stage-access-logging.html" |
| 24 | + ], |
19 | 25 | "Remediation": { |
20 | 26 | "Code": { |
21 | | - "CLI": "", |
22 | | - "NativeIaC": "", |
23 | | - "Other": "https://docs.prowler.com/checks/aws/logging-policies/bc_aws_logging_30#aws-console", |
24 | | - "Terraform": "https://docs.prowler.com/checks/aws/logging-policies/bc_aws_logging_30#cloudformation" |
| 27 | + "CLI": "aws apigatewayv2 update-stage --api-id <API_ID> --stage-name <STAGE_NAME> --access-log-settings DestinationArn=<LOG_GROUP_ARN>,Format='{\"requestId\":\"$context.requestId\"}'", |
| 28 | + "NativeIaC": "```yaml\n# CloudFormation: Enable access logging on API Gateway V2 stage\nResources:\n <example_resource_name>:\n Type: AWS::ApiGatewayV2::Stage\n Properties:\n ApiId: <example_resource_id>\n StageName: <example_resource_name>\n AccessLogSettings: # Critical: enables access logging for the stage\n DestinationArn: <example_log_group_arn> # CloudWatch Logs log group ARN\n Format: '{\"requestId\":\"$context.requestId\"}' # Minimal required format\n```", |
| 29 | + "Other": "1. In the AWS Console, go to API Gateway > your HTTP/WebSocket API\n2. Open Stages and select the target stage\n3. In Access logging, enable Access logging\n4. Set Log destination ARN to your CloudWatch log group (or Firehose stream)\n5. Set Log format to: {\"requestId\":\"$context.requestId\"}\n6. Click Save", |
| 30 | + "Terraform": "```hcl\n# Terraform: Enable access logging on API Gateway V2 stage\nresource \"aws_apigatewayv2_stage\" \"<example_resource_name>\" {\n api_id = \"<example_resource_id>\"\n name = \"<example_resource_name>\"\n\n access_log_settings { # Critical: enables access logging for the stage\n destination_arn = \"<example_log_group_arn>\"\n format = \"{\\\"requestId\\\":\\\"$context.requestId\\\"}\"\n }\n}\n```" |
25 | 31 | }, |
26 | 32 | "Recommendation": { |
27 | | - "Text": "Monitoring is an important part of maintaining the reliability, availability and performance of API Gateway and your AWS solutions. You should collect monitoring data from all of the parts of your AWS solution. CloudTrail provides a record of actions taken by a user, role, or an AWS service in API Gateway. Using the information collected by CloudTrail, you can determine the request that was made to API Gateway, the IP address from which the request was made, who made the request, etc.", |
28 | | - "Url": "https://docs.aws.amazon.com/apigateway/latest/developerguide/security-monitoring.html" |
| 33 | + "Text": "Enable **stage-level access logging** to a centralized destination and use structured formats. Apply appropriate retention and restrict log access per **least privilege**. Integrate logs with monitoring and alerts to detect anomalies, and complement with **defense in depth** controls.", |
| 34 | + "Url": "https://hub.prowler.com/check/apigatewayv2_api_access_logging_enabled" |
29 | 35 | } |
30 | 36 | }, |
31 | 37 | "Categories": [ |
|
0 commit comments