From 94d449b5440b607271f35620c3cd352e34eb7b9a Mon Sep 17 00:00:00 2001 From: Elie Date: Fri, 16 Jul 2021 11:48:03 +0200 Subject: [PATCH] Add path to iam_role in enumerator --- pkg/remote/aws/iam_role_enumerator.go | 4 +++- pkg/remote/iam_scanner_test.go | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/remote/aws/iam_role_enumerator.go b/pkg/remote/aws/iam_role_enumerator.go index 0154d0fe..73072fd1 100644 --- a/pkg/remote/aws/iam_role_enumerator.go +++ b/pkg/remote/aws/iam_role_enumerator.go @@ -54,7 +54,9 @@ func (e *IamRoleEnumerator) Enumerate() ([]resource.Resource, error) { e.factory.CreateAbstractResource( string(e.SupportedType()), *role.RoleName, - map[string]interface{}{}, + map[string]interface{}{ + "path": *role.Path, + }, ), ) } diff --git a/pkg/remote/iam_scanner_test.go b/pkg/remote/iam_scanner_test.go index 9f919993..7ca64805 100644 --- a/pkg/remote/iam_scanner_test.go +++ b/pkg/remote/iam_scanner_test.go @@ -371,12 +371,15 @@ func TestIamRole(t *testing.T) { repo.On("ListAllRoles").Return([]*iam.Role{ { RoleName: aws.String("test_role_0"), + Path: aws.String("/"), }, { RoleName: aws.String("test_role_1"), + Path: aws.String("/"), }, { RoleName: aws.String("test_role_2"), + Path: aws.String("/"), }, }, nil) }, @@ -389,12 +392,15 @@ func TestIamRole(t *testing.T) { repo.On("ListAllRoles").Return([]*iam.Role{ { RoleName: aws.String("AWSServiceRoleForOrganizations"), + Path: aws.String("/aws-service-role/organizations.amazonaws.com/"), }, { RoleName: aws.String("AWSServiceRoleForSupport"), + Path: aws.String("/aws-service-role/support.amazonaws.com/"), }, { RoleName: aws.String("AWSServiceRoleForTrustedAdvisor"), + Path: aws.String("/aws-service-role/trustedadvisor.amazonaws.com/"), }, }, nil) },