Skip to content

Commit

Permalink
fix: handle nil interface for aws conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Sep 6, 2024
1 parent 6d93214 commit 1fb255a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scrapers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,11 @@ func parseAssumeRolePolicyDoc(ctx *AWSContext, encodedDoc string) (map[string]an
c := gabs.Wrap(policyDocObj)
for _, stmt := range c.S("Statement").Children() {
// If Principal.Service is a list, sort that for cleaner change diff
if svcs, ok := lo.FromAnySlice[string](stmt.Search("Principal", "Service").Data().([]any)); ok {
svcsObj := stmt.Search("Principal", "Service").Data()
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)
Expand Down

0 comments on commit 1fb255a

Please sign in to comment.