From ee534a740e373b56898b30a48ec244778372e172 Mon Sep 17 00:00:00 2001 From: Prowler Bot Date: Thu, 13 Feb 2025 16:35:19 +0100 Subject: [PATCH] fix(aws): SNS threw IndexError if SubscriptionArn is PendingConfirmation (#6923) Co-authored-by: Kay Agahd --- prowler/providers/aws/services/sns/sns_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prowler/providers/aws/services/sns/sns_service.py b/prowler/providers/aws/services/sns/sns_service.py index a2f2d3be29..2eb93ee792 100644 --- a/prowler/providers/aws/services/sns/sns_service.py +++ b/prowler/providers/aws/services/sns/sns_service.py @@ -92,12 +92,12 @@ class SNS(AWSService): ) subscriptions: list[Subscription] = [ Subscription( - id=sub["SubscriptionArn"].split(":")[-1], + id=(parts := sub["SubscriptionArn"].split(":"))[-1], arn=sub["SubscriptionArn"], owner=sub["Owner"], protocol=sub["Protocol"], endpoint=sub["Endpoint"], - region=sub["SubscriptionArn"].split(":")[3], + region=parts[3] if len(parts) > 3 else "unknown", ) for sub in response["Subscriptions"] ]