-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from nikpivkin/go2rego-azure-3
refactor(checks): migrate Azure datafactory, datalake, keyvault to Rego
- Loading branch information
Showing
40 changed files
with
805 additions
and
523 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,42 @@ | ||
# METADATA | ||
# title: Data Factory should have public access disabled, the default is enabled. | ||
# description: | | ||
# Data Factory has public access set to true by default. | ||
# | ||
# Disabling public network access is applicable only to the self-hosted integration runtime, not to Azure Integration Runtime and SQL Server Integration Services (SSIS) Integration Runtime. | ||
# scope: package | ||
# schemas: | ||
# - input: schema["cloud"] | ||
# related_resources: | ||
# - https://docs.microsoft.com/en-us/azure/data-factory/data-movement-security-considerations#hybrid-scenarios | ||
# custom: | ||
# id: AVD-AZU-0035 | ||
# avd_id: AVD-AZU-0035 | ||
# provider: azure | ||
# service: datafactory | ||
# severity: CRITICAL | ||
# short_code: no-public-access | ||
# recommended_action: Set public access to disabled for Data Factory | ||
# input: | ||
# selector: | ||
# - type: cloud | ||
# subtypes: | ||
# - service: datafactory | ||
# provider: azure | ||
# terraform: | ||
# links: | ||
# - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_factory#public_network_enabled | ||
# good_examples: checks/cloud/azure/datafactory/no_public_access.tf.go | ||
# bad_examples: checks/cloud/azure/datafactory/no_public_access.tf.go | ||
package builtin.azure.datafactory.azure0035 | ||
|
||
import rego.v1 | ||
|
||
deny contains res if { | ||
some factory in input.azure.datafactory.datafactories | ||
factory.enablepublicnetwork.value == true | ||
res := result.new( | ||
"Data factory allows public network access.", | ||
factory.enablepublicnetwork, | ||
) | ||
} |
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.azure.datafactory.azure0035_test | ||
|
||
import rego.v1 | ||
|
||
import data.builtin.azure.datafactory.azure0035 as check | ||
import data.lib.test | ||
|
||
test_deny_datafactory_public_access_enabled if { | ||
res := check.deny with input as build_input(true) | ||
count(res) == 1 | ||
} | ||
|
||
test_allow_datafactory_public_access_disabled if { | ||
res := check.deny with input as build_input(false) | ||
count(res) == 0 | ||
} | ||
|
||
build_input(enabled) := {"azure": {"datafactory": {"datafactories": [{"enablepublicnetwork": {"value": enabled}}]}}} |
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
40 changes: 40 additions & 0 deletions
40
checks/cloud/azure/datalake/enable_at_rest_encryption.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,40 @@ | ||
# METADATA | ||
# title: Unencrypted data lake storage. | ||
# description: | | ||
# Datalake storage encryption defaults to Enabled, it shouldn't be overridden to Disabled. | ||
# scope: package | ||
# schemas: | ||
# - input: schema["cloud"] | ||
# related_resources: | ||
# - https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-security-overview | ||
# custom: | ||
# id: AVD-AZU-0036 | ||
# avd_id: AVD-AZU-0036 | ||
# provider: azure | ||
# service: datalake | ||
# severity: HIGH | ||
# short_code: enable-at-rest-encryption | ||
# recommended_action: Enable encryption of data lake storage | ||
# input: | ||
# selector: | ||
# - type: cloud | ||
# subtypes: | ||
# - service: datalake | ||
# provider: azure | ||
# terraform: | ||
# links: | ||
# - https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_lake_store | ||
# good_examples: checks/cloud/azure/datalake/enable_at_rest_encryption.tf.go | ||
# bad_examples: checks/cloud/azure/datalake/enable_at_rest_encryption.tf.go | ||
package builtin.azure.datalake.azure0036 | ||
|
||
import rego.v1 | ||
|
||
deny contains res if { | ||
some store in input.azure.datalake.stores | ||
not store.enableencryption.value | ||
res := result.new( | ||
"Data lake store is not encrypted.", | ||
object.get(store, "enableencryption", store), | ||
) | ||
} |
65 changes: 0 additions & 65 deletions
65
checks/cloud/azure/datalake/enable_at_rest_encryption_test.go
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
checks/cloud/azure/datalake/enable_at_rest_encryption_test.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,18 @@ | ||
package builtin.azure.datalake.azure0036_test | ||
|
||
import rego.v1 | ||
|
||
import data.builtin.azure.datalake.azure0036 as check | ||
import data.lib.test | ||
|
||
test_deny_unencrypted_data_lake_store if { | ||
res := check.deny with input as build_input(false) | ||
count(res) == 1 | ||
} | ||
|
||
test_allow_encrypted_data_lake_store if { | ||
res := check.deny with input as build_input(true) | ||
count(res) == 0 | ||
} | ||
|
||
build_input(enable) := {"azure": {"datalake": {"stores": [{"enableencryption": {"value": enable}}]}}} |
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.