From b7400c8840cd3a47f8282fc021bc58290edfec2a Mon Sep 17 00:00:00 2001 From: Sofia Sazonova Date: Tue, 9 Jan 2024 13:17:54 +0000 Subject: [PATCH] Check role ARN Check if role ARN matches the role name (boto3 get_role works by name, not by arn) --- backend/dataall/base/aws/iam.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/dataall/base/aws/iam.py b/backend/dataall/base/aws/iam.py index a6fcf4b8c..b3cc1c636 100644 --- a/backend/dataall/base/aws/iam.py +++ b/backend/dataall/base/aws/iam.py @@ -20,6 +20,7 @@ def get_role(account_id: str, role_arn: str, role=None): response = iamcli.get_role( RoleName=role_arn.split("/")[-1] ) + assert response['Role']['Arn'] == role_arn, "Arn doesn't match the role name. Check Arn and try again." except Exception as e: log.error( f'Failed to get role {role_arn} due to: {e}'