mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 06:45:08 +00:00
fix: Linter issues (#1471)
Co-authored-by: Sergio Garcia <38561120+sergargar@users.noreply.github.com>
This commit is contained in:
@@ -35,7 +35,7 @@ class Test_iam_no_root_access_key_test:
|
||||
# raise Exception
|
||||
assert result[0].status == "PASS"
|
||||
assert search(
|
||||
f"User <root_account> has not access keys.",
|
||||
"User <root_account> has not access keys.",
|
||||
result[0].status_extended,
|
||||
)
|
||||
assert result[0].resource_id == "<root_account>"
|
||||
@@ -73,7 +73,7 @@ class Test_iam_no_root_access_key_test:
|
||||
# raise Exception
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
f"User <root_account> has one active access key.",
|
||||
"User <root_account> has one active access key.",
|
||||
result[0].status_extended,
|
||||
)
|
||||
assert result[0].resource_id == "<root_account>"
|
||||
@@ -111,7 +111,7 @@ class Test_iam_no_root_access_key_test:
|
||||
# raise Exception
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
f"User <root_account> has one active access key.",
|
||||
"User <root_account> has one active access key.",
|
||||
result[0].status_extended,
|
||||
)
|
||||
assert result[0].resource_id == "<root_account>"
|
||||
@@ -149,7 +149,7 @@ class Test_iam_no_root_access_key_test:
|
||||
# raise Exception
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
f"User <root_account> has two active access key.",
|
||||
"User <root_account> has two active access key.",
|
||||
result[0].status_extended,
|
||||
)
|
||||
assert result[0].resource_id == "<root_account>"
|
||||
|
||||
@@ -21,6 +21,6 @@ class iam_password_policy_lowercase(Check):
|
||||
)
|
||||
else:
|
||||
report.status = "FAIL"
|
||||
report.status_extended = f"Password policy cannot be found"
|
||||
report.status_extended = "Password policy cannot be found"
|
||||
findings.append(report)
|
||||
return findings
|
||||
|
||||
@@ -25,9 +25,7 @@ class iam_policy_attached_only_to_group_or_roles(Check):
|
||||
report = Check_Report(self.metadata)
|
||||
report.region = iam_client.region
|
||||
report.status = "FAIL"
|
||||
report.status_extended = (
|
||||
f"User {user.name} has the following inline policy {policy}"
|
||||
)
|
||||
report.status_extended = f"User {user.name} has the following inline policy {policy}"
|
||||
report.resource_id = user.name
|
||||
findings.append(report)
|
||||
|
||||
|
||||
@@ -81,7 +81,10 @@ class Test_iam_policy_attached_only_to_group_or_roles:
|
||||
f"User {user} has attached the following policy",
|
||||
result[0].status_extended,
|
||||
)
|
||||
assert search(f"User {user} has the following inline policy", result[1].status_extended)
|
||||
assert search(
|
||||
f"User {user} has the following inline policy",
|
||||
result[1].status_extended,
|
||||
)
|
||||
|
||||
@mock_iam
|
||||
def test_iam_user_inline_policy(self):
|
||||
|
||||
@@ -382,10 +382,10 @@ class MFADevice:
|
||||
class User:
|
||||
name: str
|
||||
arn: str
|
||||
mfa_devices: "list[MFADevice]"
|
||||
mfa_devices: list[MFADevice]
|
||||
password_last_used: str
|
||||
attached_policies: "list[dict]"
|
||||
inline_policies: "list[str]"
|
||||
attached_policies: list[dict]
|
||||
inline_policies: list[str]
|
||||
|
||||
def __init__(self, name, arn, password_last_used):
|
||||
self.name = name
|
||||
@@ -400,8 +400,8 @@ class User:
|
||||
class Group:
|
||||
name: str
|
||||
arn: str
|
||||
attached_policies: "list[dict]"
|
||||
users: " list[User]"
|
||||
attached_policies: list[dict]
|
||||
users: list[User]
|
||||
|
||||
def __init__(self, name, arn):
|
||||
self.name = name
|
||||
|
||||
@@ -230,7 +230,7 @@ class Test_IAM_Service:
|
||||
assert iam.password_policy.uppercase == require_upper
|
||||
assert iam.password_policy.lowercase == require_lower
|
||||
assert iam.password_policy.allow_change == allow_users_to_change
|
||||
assert iam.password_policy.expiration == True
|
||||
assert iam.password_policy.expiration is True
|
||||
assert iam.password_policy.max_age == max_password_age
|
||||
assert iam.password_policy.reuse_prevention == password_reuse_prevention
|
||||
assert iam.password_policy.hard_expiry == hard_expiry
|
||||
@@ -379,7 +379,7 @@ class Test_IAM_Service:
|
||||
@mock_iam
|
||||
def test__get_entities_attached_to_support_roles__no_roles(self):
|
||||
iam_client = client("iam")
|
||||
support_roles = iam_client.list_entities_for_policy(
|
||||
_ = iam_client.list_entities_for_policy(
|
||||
PolicyArn="arn:aws:iam::aws:policy/aws-service-role/AWSSupportServiceRolePolicy",
|
||||
EntityFilter="Role",
|
||||
)["PolicyRoles"]
|
||||
@@ -458,7 +458,7 @@ class Test_IAM_Service:
|
||||
assert iam.list_policies_version[0]["Statement"][0]["Effect"] == "Allow"
|
||||
assert iam.list_policies_version[0]["Statement"][0]["Action"] == "*"
|
||||
assert iam.list_policies_version[0]["Statement"][0]["Resource"] == "*"
|
||||
|
||||
|
||||
# Test IAM List SAML Providers
|
||||
@mock_iam
|
||||
def test__list_saml_providers__(self):
|
||||
|
||||
@@ -16,6 +16,6 @@ class iam_support_role_created(Check):
|
||||
report.status_extended = f"Support policy attached to role {iam_client.entities_attached_to_support_roles[0]['RoleName']}"
|
||||
else:
|
||||
report.status = "FAIL"
|
||||
report.status_extended = f"Support policy is not attached to any role"
|
||||
report.status_extended = "Support policy is not attached to any role"
|
||||
findings.append(report)
|
||||
return findings
|
||||
|
||||
Reference in New Issue
Block a user