Project: KICS (Provisioning / Security & Compliance)
File: d6653eee-2d4d-4e6a-976f-6794a497999a.md

title: API Gateway With Invalid Compression hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: d6653eee-2d4d-4e6a-976f-6794a497999a Query name: API Gateway With Invalid Compression Platform: CloudFormation Severity: <span style="color:#edd57e">Low</span> Category: Encryption URL: API Gateway should have valid compression, which means attribute 'MinimumCompressionSize' should be set and its value should be greater than -1 and smaller than 10485760.<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="17" AWSTemplateFormatVersion: "2010-09-09" Resources: RestApi3: Type: AWS::ApiGateway::RestApi Properties: Body: swagger: 2.0 info: version: 0.0.1 title: test basePath: /pete schemes: https definitions: Empty: type: object MinimumCompressionSize: -1 Name: myApi Parameters: endpointConfigurationTypes: REGIONAL ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="17" AWSTemplateFormatVersion: "2010-09-09" Resources: RestApi4: Type: AWS::ApiGateway::RestApi Properties: Body: swagger: 2.0 info: version: 0.0.1 title: test basePath: /pete schemes: https definitions: Empty: type: object MinimumCompressionSize: 10485760 Name: myApi Parameters: endpointConfigurationTypes: REGIONAL ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="5" AWSTemplateFormatVersion: "2010-09-09" Resources: RestApi5: Type: AWS::ApiGateway::RestApi Properties: Body: swagger: 2.0 info: version: 0.0.1 title: test basePath: /pete schemes: https definitions: Empty: type: object Name: myApi Parameters: endpointConfigurationTypes: REGIONAL ``` <details><summary>Positive test num. 4 - json file</summary> ```json hl_lines="22" { "Resources": { "RestApi6": { "Type": "AWS::ApiGateway::RestApi", "Properties": { "Body": { "swagger": 2, "info": { "version": "0.0.1", "title": "test" }, "basePath": "/pete", "schemes": [ "https" ], "definitions": { "Empty": { "type": "object" } } }, "MinimumCompressionSize": -1, "Name": "myApi", "Parameters": { "endpointConfigurationTypes": "REGIONAL" } } } } } ``` </details> <details><summary>Positive test num. 5 - json file</summary> ```json hl_lines="22" { "Resources": { "RestApi7": { "Type": "AWS::ApiGateway::RestApi", "Properties": { "Body": { "swagger": 2, "info": { "version": "0.0.1", "title": "test" }, "basePath": "/pete", "schemes": [ "https" ], "definitions": { "Empty": { "type": "object" } } }, "MinimumCompressionSize": 10485760, "Name": "myApi", "Parameters": { "endpointConfigurationTypes": "REGIONAL" } } } } } ``` </details> <details><summary>Positive test num. 6 - json file</summary> ```json hl_lines="5" { "Resources": { "RestApi8": { "Type": "AWS::ApiGateway::RestApi", "Properties": { "Body": { "swagger": 2, "info": { "version": "0.0.1", "title": "test" }, "basePath": "/pete", "schemes": [ "https" ], "definitions": { "Empty": { "type": "object" } } }, "Name": "myApi", "Parameters": { "endpointConfigurationTypes": "REGIONAL" } } } } } ``` </details> ```yaml title="Negative test num. 1 - yaml file" AWSTemplateFormatVersion: "2010-09-09" Resources: RestApi: Type: AWS::ApiGateway::RestApi Properties: Body: swagger: 2.0 info: version: 0.0.1 title: test basePath: /pete schemes: https definitions: Empty: type: object MinimumCompressionSize: 0 Name: myApi Parameters: endpointConfigurationTypes: REGIONAL ``` ```json title="Negative test num. 2 - json file" { "Resources": { "RestApi2": { "Type": "AWS::ApiGateway::RestApi", "Properties": { "Body": { "swagger": 2, "info": { "version": "0.0.1", "title": "test" }, "basePath": "/pete", "schemes": [ "https" ], "definitions": { "Empty": { "type": "object" } } }, "MinimumCompressionSize": 0, "Name": "myApi", "Parameters": { "endpointConfigurationTypes": "REGIONAL" } } } } } ```