Skip to content

Commit

Permalink
fix: handle string casting for aws conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Sep 6, 2024
1 parent 7b9d780 commit 8cc078a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scrapers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit 8cc078a

Please sign in to comment.