From 8cc078aedd5f9f6fc4bc54f8daf1aaca07018833 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Fri, 6 Sep 2024 21:57:42 +0530 Subject: [PATCH] fix: handle string casting for aws conversion --- scrapers/aws/aws.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scrapers/aws/aws.go b/scrapers/aws/aws.go index efc42b2c..38ea6441 100644 --- a/scrapers/aws/aws.go +++ b/scrapers/aws/aws.go @@ -1976,11 +1976,13 @@ func parseAssumeRolePolicyDoc(ctx *AWSContext, encodedDoc string) (map[string]an if svcsObj == nil { continue } - if svcs, ok := lo.FromAnySlice[string](svcsObj.([]any)); ok { - slices.Sort(svcs) - if _, err := stmt.Set(svcs, "Principal", "Service"); err != nil { - ctx.Errorf("error setting services object[%v] in Principal.Services: %v", svcs, err) - continue + if svcAnySlice, ok := svcsObj.([]any); ok { + if svcs, ok := lo.FromAnySlice[string](svcAnySlice); ok { + slices.Sort(svcs) + if _, err := stmt.Set(svcs, "Principal", "Service"); err != nil { + ctx.Errorf("error setting services object[%v] in Principal.Services: %v", svcs, err) + continue + } } } }