forked from Checkmarx/kics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(query): 'cloudwatch_metrics_disabled' check correct resource and …
…field (Checkmarx#4184) Signed-off-by: Felipe Avelar <[email protected]>
- Loading branch information
1 parent
47c78ea
commit df58fc3
Showing
9 changed files
with
255 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 26 additions & 26 deletions
52
assets/queries/cloudFormation/cloudwatch_metrics_disabled/test/negative1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Creating ECS service | ||
Description: Creating TestDeployment | ||
Resources: | ||
LambdaInvocationsAnomalyDetector: | ||
Type: AWS::CloudWatch::AnomalyDetector | ||
Prod: | ||
Type: AWS::ApiGateway::Stage | ||
Properties: | ||
MetricName: Invocations | ||
Namespace: AWS/Lambda | ||
Stat: Sum | ||
|
||
LambdaInvocationsAlarm: | ||
Type: AWS::CloudWatch::Alarm | ||
Properties: | ||
AlarmDescription: Lambda invocations | ||
AlarmName: LambdaInvocationsAlarm | ||
ComparisonOperator: LessThanLowerOrGreaterThanUpperThreshold | ||
EvaluationPeriods: 1 | ||
Metrics: | ||
- Expression: ANOMALY_DETECTION_BAND(m1, 2) | ||
Id: ad1 | ||
- Id: m1 | ||
MetricStat: | ||
Metric: | ||
MetricName: Invocations | ||
Namespace: AWS/Lambda | ||
Period: !!int 86400 | ||
Stat: Sum | ||
ThresholdMetricId: ad1 | ||
TreatMissingData: breaching | ||
StageName: Prod | ||
Description: Prod Stage | ||
RestApiId: !Ref MyRestApi | ||
DeploymentId: !Ref TestDeployment | ||
DocumentationVersion: !Ref MyDocumentationVersion | ||
ClientCertificateId: !Ref ClientCertificate | ||
Variables: | ||
Stack: Prod | ||
MethodSettings: | ||
- ResourcePath: / | ||
HttpMethod: GET | ||
MetricsEnabled: 'true' | ||
DataTraceEnabled: 'false' | ||
- ResourcePath: /stack | ||
HttpMethod: POST | ||
MetricsEnabled: 'true' | ||
DataTraceEnabled: 'false' | ||
ThrottlingBurstLimit: '999' | ||
- ResourcePath: /stack | ||
HttpMethod: GET | ||
MetricsEnabled: 'true' | ||
DataTraceEnabled: 'false' | ||
ThrottlingBurstLimit: '555' |
66 changes: 37 additions & 29 deletions
66
assets/queries/cloudFormation/cloudwatch_metrics_disabled/test/negative2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 26 additions & 17 deletions
43
assets/queries/cloudFormation/cloudwatch_metrics_disabled/test/positive1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
Description: Creating ECS service | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Creating TestDeployment | ||
Resources: | ||
LambdaInvocationsAnomalyDetector3: | ||
Type: AWS::CloudWatch::AnomalyDetector | ||
Prod: | ||
Type: AWS::ApiGateway::Stage | ||
Properties: | ||
MetricName: Invocations | ||
Namespace: AWS/Lambda | ||
Stat: Sum | ||
|
||
LambdaInvocationsAlarm3: | ||
Type: AWS::CloudWatch::Alarm | ||
Properties: | ||
AlarmDescription: Lambda invocations | ||
AlarmName: LambdaInvocationsAlarm | ||
ComparisonOperator: LessThanLowerOrGreaterThanUpperThreshold | ||
EvaluationPeriods: 1 | ||
ThresholdMetricId: ad1 | ||
TreatMissingData: breaching | ||
StageName: Prod | ||
Description: Prod Stage | ||
RestApiId: !Ref MyRestApi | ||
DeploymentId: !Ref TestDeployment | ||
DocumentationVersion: !Ref MyDocumentationVersion | ||
ClientCertificateId: !Ref ClientCertificate | ||
Variables: | ||
Stack: Prod | ||
MethodSettings: | ||
- ResourcePath: / | ||
HttpMethod: GET | ||
MetricsEnabled: 'false' | ||
DataTraceEnabled: 'false' | ||
- ResourcePath: /stack | ||
HttpMethod: POST | ||
DataTraceEnabled: 'false' | ||
ThrottlingBurstLimit: '999' | ||
- ResourcePath: /stack | ||
HttpMethod: GET | ||
MetricsEnabled: 'true' | ||
DataTraceEnabled: 'false' | ||
ThrottlingBurstLimit: '555' |
56 changes: 40 additions & 16 deletions
56
assets/queries/cloudFormation/cloudwatch_metrics_disabled/test/positive2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
assets/queries/cloudFormation/cloudwatch_metrics_disabled/test/positive3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: Creating TestDeployment | ||
Resources: | ||
Prod: | ||
Type: AWS::ApiGateway::Stage | ||
Properties: | ||
StageName: Prod | ||
Description: Prod Stage | ||
RestApiId: !Ref MyRestApi | ||
DeploymentId: !Ref TestDeployment | ||
DocumentationVersion: !Ref MyDocumentationVersion | ||
ClientCertificateId: !Ref ClientCertificate | ||
Variables: | ||
Stack: Prod |
26 changes: 26 additions & 0 deletions
26
assets/queries/cloudFormation/cloudwatch_metrics_disabled/test/positive4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"Resources": { | ||
"Prod": { | ||
"Type": "AWS::ApiGateway::Stage", | ||
"Properties": { | ||
"StageName": "Prod", | ||
"Description": "Prod Stage", | ||
"RestApiId": { | ||
"Ref": "MyRestApi" | ||
}, | ||
"DeploymentId": { | ||
"Ref": "TestDeployment" | ||
}, | ||
"DocumentationVersion": { | ||
"Ref": "MyDocumentationVersion" | ||
}, | ||
"ClientCertificateId": { | ||
"Ref": "ClientCertificate" | ||
}, | ||
"Variables": { | ||
"Stack": "Prod" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.