Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ CxPolicy[result] {
resource.Type == "AWS::ApiGateway::Stage"

properties := resource.Properties
methodSettings := properties.MethodSettings
not common_lib.valid_key(methodSettings, "LoggingLevel")
methodSetting := properties.MethodSettings[j]
not common_lib.valid_key(methodSetting, "LoggingLevel")

result := {
"documentId": input.document[i].id,
"resourceType": resource.Type,
"resourceName": cf_lib.get_resource_name(resource, name),
"searchKey": sprintf("Resources.%s.Properties.MethodSettings", [name]),
"issueType": "MissingAttribute",
"keyExpectedValue": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel should be defined and not null", [name]),
"keyActualValue": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel are undefined or null", [name]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "MethodSettings"], []),
"keyExpectedValue": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel should be defined and not null", [name, j]),
"keyActualValue": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel is undefined or null", [name, j]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "MethodSettings", j], []),
}
}

Expand All @@ -135,18 +135,18 @@ CxPolicy[result] {
resource.Type == "AWS::ApiGateway::Stage"

properties := resource.Properties
loggingLevel := properties.MethodSettings.LoggingLevel
loggingLevel := properties.MethodSettings[j].LoggingLevel
loggingLevel == ""

result := {
"documentId": input.document[i].id,
"resourceType": resource.Type,
"resourceName": cf_lib.get_resource_name(resource, name),
"searchKey": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel", [name]),
"searchKey": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel", [name, j]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel should be not be empty", [name]),
"keyActualValue": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel is empty", [name]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "MethodSettings", "LoggingLevel"], []),
"keyExpectedValue": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel should not be empty", [name, j]),
"keyActualValue": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel is empty", [name, j]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "MethodSettings", j, "LoggingLevel"], []),
}
}

Expand All @@ -156,18 +156,18 @@ CxPolicy[result] {
resource.Type == "AWS::ApiGateway::Stage"

properties := resource.Properties
loggingLevel := properties.MethodSettings.LoggingLevel
loggingLevel := properties.MethodSettings[j].LoggingLevel
loggingLevel == "OFF"

result := {
"documentId": input.document[i].id,
"resourceType": resource.Type,
"resourceName": cf_lib.get_resource_name(resource, name),
"searchKey": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel", [name]),
"searchKey": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel", [name, j]),
"issueType": "IncorrectValue",
"keyExpectedValue": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel should not be set to OFF", [name]),
"keyActualValue": sprintf("Resources.%s.Properties.MethodSettings.LoggingLevel is OFF", [name]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "MethodSettings", "LoggingLevel"], []),
"keyExpectedValue": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel should not be set to OFF", [name, j]),
"keyActualValue": sprintf("Resources.%s.Properties.MethodSettings[%d].LoggingLevel is OFF", [name, j]),
"searchLine": common_lib.build_search_line(["Resources", name, "Properties", "MethodSettings", j, "LoggingLevel"], []),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
"DeploymentId": {
"Ref": "MyDeployment"
},
"MethodSettings": {
"DetailedMetricsEnabled": true,
"LoggingLevel": "INFO",
"DataTraceEnabled": false,
"ThrottlingBurstLimit": 10,
"ThrottlingRateLimit": 10
},
"MethodSettings": [
{
"DetailedMetricsEnabled": true,
"LoggingLevel": "INFO",
"DataTraceEnabled": false,
"ThrottlingBurstLimit": 10,
"ThrottlingRateLimit": 10
}
],
"RestApiId": {
"Ref": "CFNWebSocket"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Resources:
DeploymentId: !Ref TestDeployment
DocumentationVersion: ""
MethodSettings:
LoggingLevel: "ON"
- LoggingLevel: "INFO"
AccessLogSetting:
DestinationArn: "dest"
Format: "format"
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"RestApiId": {
"Ref": "CFNWebSocket"
},
"MethodSettings": {
}
"MethodSettings": [
{}
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
"RestApiId": {
"Ref": "CFNWebSocket"
},
"MethodSettings": {
"DetailedMetricsEnabled": true,
"LoggingLevel": "OFF",
"DataTraceEnabled": false,
"ThrottlingBurstLimit": 10,
"ThrottlingRateLimit": 10
}
"MethodSettings": [
{
"DetailedMetricsEnabled": true,
"LoggingLevel": "OFF",
"DataTraceEnabled": false,
"ThrottlingBurstLimit": 10,
"ThrottlingRateLimit": 10
}
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Resources:
DeploymentId: !Ref TestDeployment
DocumentationVersion: ""
MethodSettings:
LoggingLevel: "OFF"
- LoggingLevel: "OFF"
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Resources:
DeploymentId: !Ref TestDeployment
DocumentationVersion: ""
MethodSettings:
LoggingLevel: "ON"
- LoggingLevel: "INFO"
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
"DeploymentId": {
"Ref": "MyDeployment"
},
"MethodSettings": {
"DetailedMetricsEnabled": true,
"LoggingLevel": "INFO",
"DataTraceEnabled": false,
"ThrottlingBurstLimit": 10,
"ThrottlingRateLimit": 10
},
"MethodSettings": [
{
"DetailedMetricsEnabled": true,
"LoggingLevel": "INFO",
"DataTraceEnabled": false,
"ThrottlingBurstLimit": 10,
"ThrottlingRateLimit": 10
}
],
"RestApiId": {
"Ref": "CFNWebSocket"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
{
"queryName": "API Gateway V2 Stage Access Logging Settings Not Defined",
"severity": "MEDIUM",
"line": 16,
"line": 17,
"fileName": "positive1.yaml"
},
{
"queryName": "API Gateway V2 Stage Access Logging Settings Not Defined",
"severity": "MEDIUM",
"line": 21,
"fileName": "positive1.yaml"
},
{
"queryName": "API Gateway V2 Stage Access Logging Settings Not Defined",
"severity": "MEDIUM",
"line": 25,
"fileName": "positive1.yaml"
},
{
Expand Down Expand Up @@ -68,13 +80,7 @@
{
"queryName": "API Gateway V2 Stage Access Logging Settings Not Defined",
"severity": "MEDIUM",
"line": 13,
"fileName": "positive11.yaml"
},
{
"queryName": "API Gateway V2 Stage Access Logging Settings Not Defined",
"severity": "MEDIUM",
"line": 21,
"line": 22,
"fileName": "positive12.json"
},
{
Expand Down
Loading