mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
chore(metadata): Typos (#2595)
Co-authored-by: Pepe Fagoaga <pepe@verica.io>
This commit is contained in:
@@ -51,7 +51,7 @@ class Test_accessanalyzer_enabled:
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "IAM Access Analyzer in account 012345678910 is not enabled"
|
||||
== "IAM Access Analyzer in account 012345678910 is not enabled."
|
||||
)
|
||||
assert result[0].resource_id == "012345678910"
|
||||
|
||||
@@ -93,14 +93,14 @@ class Test_accessanalyzer_enabled:
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "IAM Access Analyzer in account 012345678910 is not enabled"
|
||||
== "IAM Access Analyzer in account 012345678910 is not enabled."
|
||||
)
|
||||
assert result[0].resource_id == "012345678910"
|
||||
assert result[0].region == "eu-west-1"
|
||||
assert result[1].status == "PASS"
|
||||
assert (
|
||||
result[1].status_extended
|
||||
== "IAM Access Analyzer Test Analyzer is enabled"
|
||||
== "IAM Access Analyzer Test Analyzer is enabled."
|
||||
)
|
||||
assert result[1].resource_id == "Test Analyzer"
|
||||
assert result[1].region == "eu-west-2"
|
||||
@@ -134,7 +134,7 @@ class Test_accessanalyzer_enabled:
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "IAM Access Analyzer Test Analyzer is enabled"
|
||||
== "IAM Access Analyzer Test Analyzer is enabled."
|
||||
)
|
||||
assert result[0].resource_id == "Test Analyzer"
|
||||
assert result[0].region == "eu-west-2"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from json import dumps
|
||||
from re import search
|
||||
from unittest import mock
|
||||
|
||||
from boto3 import client, session
|
||||
@@ -8,6 +7,7 @@ from moto import mock_iam
|
||||
from prowler.providers.aws.lib.audit_info.models import AWS_Audit_Info
|
||||
|
||||
AWS_ACCOUNT_NUMBER = "123456789012"
|
||||
AWS_REGION = "eu-west-1"
|
||||
|
||||
|
||||
class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
@@ -28,7 +28,7 @@ class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
profile_region=None,
|
||||
credentials=None,
|
||||
assumed_role_info=None,
|
||||
audited_regions=["us-east-1", "eu-west-1"],
|
||||
audited_regions=[AWS_REGION],
|
||||
organizations_metadata=None,
|
||||
audit_resources=None,
|
||||
mfa_enabled=False,
|
||||
@@ -71,6 +71,16 @@ class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
check = iam_policy_attached_only_to_group_or_roles()
|
||||
result = check.execute()
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"User {user} has the policy {policy_name} attached."
|
||||
)
|
||||
assert result[0].region == AWS_REGION
|
||||
assert result[0].resource_id == user
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:iam::{AWS_ACCOUNT_NUMBER}:user/{user}"
|
||||
)
|
||||
|
||||
@mock_iam
|
||||
def test_iam_user_attached_and_inline_policy(self):
|
||||
@@ -111,14 +121,23 @@ class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
result = check.execute()
|
||||
assert len(result) == 2
|
||||
assert result[0].status == "FAIL"
|
||||
assert result[1].status == "FAIL"
|
||||
assert search(
|
||||
f"User {user} has attached the following policy",
|
||||
result[0].status_extended,
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"User {user} has the policy {policyName} attached."
|
||||
)
|
||||
assert search(
|
||||
f"User {user} has the following inline policy",
|
||||
result[1].status_extended,
|
||||
assert result[0].region == AWS_REGION
|
||||
assert result[0].resource_id == user
|
||||
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"User {user} has the policy {policyName} attached."
|
||||
)
|
||||
assert result[0].region == AWS_REGION
|
||||
assert result[0].resource_id == user
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:iam::{AWS_ACCOUNT_NUMBER}:user/{user}"
|
||||
)
|
||||
|
||||
@mock_iam
|
||||
@@ -155,6 +174,16 @@ class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
check = iam_policy_attached_only_to_group_or_roles()
|
||||
result = check.execute()
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"User {user} has the inline policy {policyName} attached."
|
||||
)
|
||||
assert result[0].region == AWS_REGION
|
||||
assert result[0].resource_id == user
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:iam::{AWS_ACCOUNT_NUMBER}:user/{user}"
|
||||
)
|
||||
|
||||
@mock_iam
|
||||
def test_iam_user_no_policies(self):
|
||||
@@ -180,3 +209,13 @@ class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
check = iam_policy_attached_only_to_group_or_roles()
|
||||
result = check.execute()
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"User {user} has no inline or attached policies."
|
||||
)
|
||||
assert result[0].region == AWS_REGION
|
||||
assert result[0].resource_id == user
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:iam::{AWS_ACCOUNT_NUMBER}:user/{user}"
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ class Test_securityhub_enabled:
|
||||
result = check.execute()
|
||||
|
||||
assert result[0].status == "FAIL"
|
||||
assert result[0].status_extended == "Security Hub is not enabled"
|
||||
assert result[0].status_extended == "Security Hub is not enabled."
|
||||
assert result[0].resource_id == "Security Hub"
|
||||
|
||||
def test_securityhub_hub_active_with_standards(self):
|
||||
@@ -61,7 +61,7 @@ class Test_securityhub_enabled:
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "Security Hub is enabled with standards: cis-aws-foundations-benchmark/v/1.2.0"
|
||||
== "Security Hub is enabled with standards: cis-aws-foundations-benchmark/v/1.2.0."
|
||||
)
|
||||
assert result[0].resource_id == "default"
|
||||
|
||||
@@ -92,7 +92,7 @@ class Test_securityhub_enabled:
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "Security Hub is enabled without standards but with integrations: prowler"
|
||||
== "Security Hub is enabled without standards but with integrations: prowler."
|
||||
)
|
||||
assert result[0].resource_id == "default"
|
||||
|
||||
@@ -123,6 +123,6 @@ class Test_securityhub_enabled:
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "Security Hub is enabled but without any standard or integration"
|
||||
== "Security Hub is enabled but without any standard or integration."
|
||||
)
|
||||
assert result[0].resource_id == "default"
|
||||
|
||||
@@ -58,7 +58,7 @@ class Test_ssm_managed_compliant_patching:
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"EC2 managed instance {instance_id} is compliant"
|
||||
== f"EC2 managed instance {instance_id} is compliant."
|
||||
)
|
||||
|
||||
def test_compliance_resources_non_compliant(self):
|
||||
@@ -91,5 +91,5 @@ class Test_ssm_managed_compliant_patching:
|
||||
assert result[0].status == "FAIL"
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"EC2 managed instance {instance_id} is non-compliant"
|
||||
== f"EC2 managed instance {instance_id} is non-compliant."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user