From 86cb9f58382b4944cd3cc9fafb2ab4cec899f295 Mon Sep 17 00:00:00 2001 From: Sergio Garcia <38561120+sergargar@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:29:58 +0200 Subject: [PATCH] fix(vpc): solve AWS principal key error (#3903) --- .../vpc_endpoint_connections_trust_boundaries.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/prowler/providers/aws/services/vpc/vpc_endpoint_connections_trust_boundaries/vpc_endpoint_connections_trust_boundaries.py b/prowler/providers/aws/services/vpc/vpc_endpoint_connections_trust_boundaries/vpc_endpoint_connections_trust_boundaries.py index 0884c2a513..936057e657 100644 --- a/prowler/providers/aws/services/vpc/vpc_endpoint_connections_trust_boundaries/vpc_endpoint_connections_trust_boundaries.py +++ b/prowler/providers/aws/services/vpc/vpc_endpoint_connections_trust_boundaries/vpc_endpoint_connections_trust_boundaries.py @@ -55,10 +55,14 @@ class vpc_endpoint_connections_trust_boundaries(Check): break else: - if isinstance(statement["Principal"]["AWS"], str): - principals = [statement["Principal"]["AWS"]] + if "AWS" in statement["Principal"]: + if isinstance(statement["Principal"]["AWS"], str): + principals = [statement["Principal"]["AWS"]] + else: + principals = statement["Principal"]["AWS"] else: - principals = statement["Principal"]["AWS"] + # If the principal is not an AWS principal, we don't need to check it since it could be a service or a federated principal + principals = [] for principal_arn in principals: report = Check_Report_AWS(self.metadata()) report.region = endpoint.region