Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6bf4ce
commit 71e2854
Showing
7 changed files
with
163 additions
and
11 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
12 changes: 12 additions & 0 deletions
12
...cies/aws_cloudfront_distribution/AWS.CloudFront.EncryptionandKeyManagement.High.0407.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,12 @@ | ||
{ | ||
"name": "cloudfrontNoHTTPSTraffic", | ||
"file": "cloudfrontNoHTTPSTraffic.rego", | ||
"templateArgs": { | ||
"prefix": "" | ||
}, | ||
"severity": "HIGH", | ||
"description": "Use encrypted connection between CloudFront and origin server", | ||
"referenceId": "AWS.CloudFront.EncryptionandKeyManagement.High.0407", | ||
"category": "Encryption and Key Management", | ||
"version": 2 | ||
} |
12 changes: 12 additions & 0 deletions
12
...cies/aws_cloudfront_distribution/AWS.CloudFront.EncryptionandKeyManagement.High.0408.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,12 @@ | ||
{ | ||
"name": "cloudfrontNoSecureCiphers", | ||
"file": "cloudfrontNoSecureCiphers.rego", | ||
"templateArgs": { | ||
"prefix": "" | ||
}, | ||
"severity": "HIGH", | ||
"description": "Secure ciphers are not used in CloudFront distribution", | ||
"referenceId": "AWS.CloudFront.EncryptionandKeyManagement.High.0408", | ||
"category": "Encryption and Key Management", | ||
"version": 2 | ||
} |
12 changes: 12 additions & 0 deletions
12
...testdata/testpolicies/aws_cloudfront_distribution/AWS.CloudFront.Logging.Medium.0567.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,12 @@ | ||
{ | ||
"name": "cloudfrontNoLogging", | ||
"file": "cloudfrontNoLogging.rego", | ||
"templateArgs": { | ||
"prefix": "" | ||
}, | ||
"severity": "MEDIUM", | ||
"description": "Ensure that your AWS Cloudfront distributions have the Logging feature enabled in order to track all viewer requests for the content delivered through the Content Delivery Network (CDN).", | ||
"referenceId": "AWS.CloudFront.Logging.Medium.0567", | ||
"category": "Logging", | ||
"version": 2 | ||
} |
10 changes: 10 additions & 0 deletions
10
pkg/runtime/testdata/testpolicies/aws_cloudfront_distribution/cloudfrontNoHTTPSTraffic.rego
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,10 @@ | ||
package accurics | ||
|
||
{{.prefix}}cloudfrontNoHTTPSTraffic[retVal]{ | ||
cloudfront = input.aws_cloudfront_distribution[_] | ||
some i | ||
orderedcachebehaviour = cloudfront.config.ordered_cache_behavior[i] | ||
orderedcachebehaviour.viewer_protocol_policy == "allow-all" | ||
traverse := sprintf("ordered_cache_behavior[%d].viewer_protocol_policy", [i]) | ||
retVal := { "Id": cloudfront.id, "ReplaceType": "edit", "CodeType": "attribute", "Traverse": traverse, "Attribute": "ordered_cache_behavior.viewer_protocol_policy", "AttributeDataType": "string", "Expected": "redirect-to-https", "Actual": orderedcachebehaviour.viewer_protocol_policy } | ||
} |
21 changes: 21 additions & 0 deletions
21
pkg/runtime/testdata/testpolicies/aws_cloudfront_distribution/cloudfrontNoLogging.rego
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,21 @@ | ||
package accurics | ||
|
||
{{.prefix}}cloudfrontNoLogging[retVal]{ | ||
cloudfront = input.aws_cloudfront_distribution[_] | ||
not cloudfront.config.logging_config | ||
|
||
rc = "ewogICJsb2dnaW5nX2NvbmZpZyI6IHsKICAgICJpbmNsdWRlX2Nvb2tpZXMiOiBmYWxzZSwKICAgICJidWNrZXQiOiAiPGJ1Y2tldD4iLAogICAgInByZWZpeCI6ICI8cHJlZml4PiIKICB9Cn0=" | ||
|
||
traverse = "" | ||
retVal := { "Id": cloudfront.id, "ReplaceType": "add", "CodeType": "block", "Traverse": traverse, "Attribute": "logging_config", "AttributeDataType": "base64", "Expected": rc, "Actual": null } | ||
} | ||
|
||
{{.prefix}}cloudfrontNoLogging[retVal]{ | ||
cloudfront = input.aws_cloudfront_distribution[_] | ||
cloudfront.config.logging_config == [] | ||
|
||
rc = "ewogICJsb2dnaW5nX2NvbmZpZyI6IHsKICAgICJpbmNsdWRlX2Nvb2tpZXMiOiBmYWxzZSwKICAgICJidWNrZXQiOiAiPGJ1Y2tldD4iLAogICAgInByZWZpeCI6ICI8cHJlZml4PiIKICB9Cn0=" | ||
|
||
traverse = "" | ||
retVal := { "Id": cloudfront.id, "ReplaceType": "add", "CodeType": "block", "Traverse": traverse, "Attribute": "logging_config", "AttributeDataType": "base64", "Expected": rc, "Actual": null } | ||
} |
19 changes: 19 additions & 0 deletions
19
pkg/runtime/testdata/testpolicies/aws_cloudfront_distribution/cloudfrontNoSecureCiphers.rego
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,19 @@ | ||
package accurics | ||
|
||
{{.prefix}}cloudfrontNoSecureCiphers[retVal]{ | ||
cloudfront = input.aws_cloudfront_distribution[_] | ||
some i | ||
certificate = cloudfront.config.viewer_certificate[i] | ||
certificate.cloudfront_default_certificate = false | ||
not minimumAllowedProtocolVersion(certificate.minimum_protocol_version) | ||
traverse := sprintf("viewer_certificate[%d].minimum_protocol_version", [i]) | ||
retVal := { "Id": cloudfront.id, "ReplaceType": "edit", "CodeType": "attribute", "Traverse": traverse, "Attribute": "viewer_certificate.minimum_protocol_version", "AttributeDataType": "string", "Expected": "TLSv1.2", "Actual": certificate.minimum_protocol_version } | ||
} | ||
|
||
minimumAllowedProtocolVersion(currentVersion) { | ||
currentVersion == "TLSv1.1" | ||
} | ||
|
||
minimumAllowedProtocolVersion(currentVersion) { | ||
currentVersion == "TLSv1.2" | ||
} |