mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 12:31:54 +00:00
fix(emr): resource arn should be the account
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
||||
"CheckType": [],
|
||||
"ServiceName": "emr",
|
||||
"SubServiceName": "",
|
||||
"ResourceIdTemplate": "arn:aws:emr:region:account-id",
|
||||
"ResourceIdTemplate": "arn:partition:emr:region:account-id",
|
||||
"Severity": "high",
|
||||
"ResourceType": "AwsAccount",
|
||||
"Description": "EMR Account Public Access Block enabled.",
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class emr_cluster_account_public_block_enabled(Check):
|
||||
)
|
||||
report.region = region
|
||||
report.resource_id = emr_client.audited_account
|
||||
report.resource_arn = emr_client._get_cluster_arn_template(region)
|
||||
report.resource_arn = emr_client._get_account_arn_template(region)
|
||||
if emr_client.block_public_access_configuration[
|
||||
region
|
||||
].block_public_security_group_rules:
|
||||
|
||||
@@ -22,6 +22,9 @@ class EMR(AWSService):
|
||||
def _get_cluster_arn_template(self, region):
|
||||
return f"arn:{self.audited_partition}:elasticmapreduce:{region}:{self.audited_account}:cluster"
|
||||
|
||||
def _get_account_arn_template(self, region):
|
||||
return f"arn:{self.audited_partition}:elasticmapreduce:{region}:{self.audited_account}:account"
|
||||
|
||||
def _list_clusters(self, regional_client):
|
||||
logger.info("EMR - Listing Clusters...")
|
||||
try:
|
||||
|
||||
+16
@@ -18,9 +18,13 @@ class Test_emr_cluster_account_public_block_enabled:
|
||||
emr_client.region = AWS_REGION_EU_WEST_1
|
||||
emr_client.audited_partition = "aws"
|
||||
emr_client.cluster_arn_template = f"arn:{emr_client.audited_partition}:elasticmapreduce:{emr_client.region}:{emr_client.audited_account}:cluster"
|
||||
emr_client.account_arn_template = f"arn:{emr_client.audited_partition}:elasticmapreduce:{emr_client.region}:{emr_client.audited_account}:account"
|
||||
emr_client._get_cluster_arn_template = mock.MagicMock(
|
||||
return_value=emr_client.cluster_arn_template
|
||||
)
|
||||
emr_client._get_account_arn_template = mock.MagicMock(
|
||||
return_value=emr_client.account_arn_template
|
||||
)
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.emr.emr_service.EMR",
|
||||
new=emr_client,
|
||||
@@ -36,6 +40,10 @@ class Test_emr_cluster_account_public_block_enabled:
|
||||
assert len(result) == 1
|
||||
assert result[0].region == AWS_REGION_EU_WEST_1
|
||||
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:elasticmapreduce:{AWS_REGION_EU_WEST_1}:{AWS_ACCOUNT_NUMBER}:account"
|
||||
)
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
@@ -53,9 +61,13 @@ class Test_emr_cluster_account_public_block_enabled:
|
||||
emr_client.region = AWS_REGION_EU_WEST_1
|
||||
emr_client.audited_partition = "aws"
|
||||
emr_client.cluster_arn_template = f"arn:{emr_client.audited_partition}:elasticmapreduce:{emr_client.region}:{emr_client.audited_account}:cluster"
|
||||
emr_client.account_arn_template = f"arn:{emr_client.audited_partition}:elasticmapreduce:{emr_client.region}:{emr_client.audited_account}:account"
|
||||
emr_client._get_cluster_arn_template = mock.MagicMock(
|
||||
return_value=emr_client.cluster_arn_template
|
||||
)
|
||||
emr_client._get_account_arn_template = mock.MagicMock(
|
||||
return_value=emr_client.account_arn_template
|
||||
)
|
||||
with mock.patch(
|
||||
"prowler.providers.aws.services.emr.emr_service.EMR",
|
||||
new=emr_client,
|
||||
@@ -71,6 +83,10 @@ class Test_emr_cluster_account_public_block_enabled:
|
||||
assert len(result) == 1
|
||||
assert result[0].region == AWS_REGION_EU_WEST_1
|
||||
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:elasticmapreduce:{AWS_REGION_EU_WEST_1}:{AWS_ACCOUNT_NUMBER}:account"
|
||||
)
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
|
||||
Reference in New Issue
Block a user