Merge pull request #5533 from justinsb/hotfix_5522

Check errors when parsing JSON on IAM policies
This commit is contained in:
k8s-ci-robot 2018-07-27 12:20:56 -07:00 committed by GitHub
commit d7486e490f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -187,7 +187,10 @@ func (b *IAMModelBuilder) buildIAMTasks(igRole kops.InstanceGroupRole, iamName s
}
statements := make([]*iam.Statement, 0)
json.Unmarshal([]byte(additionalPolicy), &statements)
if err := json.Unmarshal([]byte(additionalPolicy), &statements); err != nil {
return fmt.Errorf("additionalPolicy %q is invalid: %v", strings.ToLower(string(igRole)), err)
}
p.Statement = append(p.Statement, statements...)
policy, err := p.AsJSON()