mirror of https://github.com/kubernetes/kops.git
Check errors when parsing JSON on IAM policies
We weren't checking the error code, and this led to #5522
This commit is contained in:
parent
8169f14124
commit
3ddf598448
|
|
@ -189,7 +189,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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue