mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-12 15:55:09 +00:00
fix(kms): handle empty principal error (#2192)
This commit is contained in:
@@ -20,14 +20,17 @@ class kms_key_not_publicly_accessible(Check):
|
||||
if key.policy and "Statement" in key.policy:
|
||||
for statement in key.policy["Statement"]:
|
||||
if (
|
||||
"*" == statement["Principal"]
|
||||
"Principal" in statement
|
||||
and "*" == statement["Principal"]
|
||||
and "Condition" not in statement
|
||||
):
|
||||
report.status = "FAIL"
|
||||
report.status_extended = (
|
||||
f"KMS key {key.id} may be publicly accessible!"
|
||||
)
|
||||
elif "AWS" in statement["Principal"]:
|
||||
elif (
|
||||
"Principal" in statement and "AWS" in statement["Principal"]
|
||||
):
|
||||
if type(statement["Principal"]["AWS"]) == str:
|
||||
principals = [statement["Principal"]["AWS"]]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user