-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(checks): migrate AWS emr, kinesis, kms, lambda to Rego
Signed-off-by: Nikita Pivkin <[email protected]>
- Loading branch information
Showing
35 changed files
with
484 additions
and
603 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
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
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
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
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
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
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
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
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,38 @@ | ||
# METADATA | ||
# title: Enable at-rest encryption for EMR clusters. | ||
# description: | | ||
# Data stored within an EMR cluster should be encrypted to ensure sensitive data is kept private. | ||
# scope: package | ||
# schemas: | ||
# - input: schema["cloud"] | ||
# related_resources: | ||
# - https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-nist_800-171.html | ||
# custom: | ||
# id: AVD-AWS-0137 | ||
# avd_id: AVD-AWS-0137 | ||
# provider: aws | ||
# service: emr | ||
# severity: HIGH | ||
# short_code: enable-at-rest-encryption | ||
# recommended_action: Enable at-rest encryption for EMR cluster | ||
# input: | ||
# selector: | ||
# - type: cloud | ||
# subtypes: | ||
# - service: emr | ||
# provider: aws | ||
# terraform: | ||
# links: | ||
# - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/emr_security_configuration | ||
# good_examples: checks/cloud/aws/emr/enable_at_rest_encryption.tf.go | ||
# bad_examples: checks/cloud/aws/emr/enable_at_rest_encryption.tf.go | ||
package builtin.aws.emr.aws0137 | ||
|
||
import rego.v1 | ||
|
||
deny contains res if { | ||
some sec_conf in input.aws.emr.securityconfiguration | ||
vars := json.unmarshal(sec_conf.configuration.value) | ||
vars.EncryptionConfiguration.EnableAtRestEncryption == false | ||
res := result.new("EMR cluster does not have at-rest encryption enabled.", sec_conf.configuration) | ||
} |
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
package builtin.aws.emr.aws0137_test | ||
|
||
import rego.v1 | ||
|
||
import data.builtin.aws.emr.aws0137 as check | ||
import data.lib.test | ||
|
||
test_allow_with_encryption if { | ||
inp := {"aws": {"emr": {"securityconfiguration": [{"configuration": {"value": json.marshal({"EncryptionConfiguration": {"EnableAtRestEncryption": true}})}}]}}} | ||
|
||
test.assert_empty(check.deny) with input as inp | ||
} | ||
|
||
test_deny_without_encryption if { | ||
inp := {"aws": {"emr": {"securityconfiguration": [{"configuration": {"value": json.marshal({"EncryptionConfiguration": {"EnableAtRestEncryption": false}})}}]}}} | ||
|
||
test.assert_equal_message("EMR cluster does not have at-rest encryption enabled.", check.deny) with input as inp | ||
} |
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
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,38 @@ | ||
# METADATA | ||
# title: Enable in-transit encryption for EMR clusters. | ||
# description: | | ||
# Data stored within an EMR cluster should be encrypted to ensure sensitive data is kept private. | ||
# scope: package | ||
# schemas: | ||
# - input: schema["cloud"] | ||
# related_resources: | ||
# - https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-nist_800-171.html | ||
# custom: | ||
# id: AVD-AWS-0138 | ||
# avd_id: AVD-AWS-0138 | ||
# provider: aws | ||
# service: emr | ||
# severity: HIGH | ||
# short_code: enable-in-transit-encryption | ||
# recommended_action: Enable in-transit encryption for EMR cluster | ||
# input: | ||
# selector: | ||
# - type: cloud | ||
# subtypes: | ||
# - service: emr | ||
# provider: aws | ||
# terraform: | ||
# links: | ||
# - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/emr_security_configuration | ||
# good_examples: checks/cloud/aws/emr/enable_in_transit_encryption.tf.go | ||
# bad_examples: checks/cloud/aws/emr/enable_in_transit_encryption.tf.go | ||
package builtin.aws.emr.aws0138 | ||
|
||
import rego.v1 | ||
|
||
deny contains res if { | ||
some sec_conf in input.aws.emr.securityconfiguration | ||
vars := json.unmarshal(sec_conf.configuration.value) | ||
vars.EncryptionConfiguration.EnableInTransitEncryption == false | ||
res := result.new("EMR cluster does not have in-transit encryption enabled.", sec_conf.configuration) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.