Fix regression in returning empty value for approle cidrlist. (#13235)

This commit is contained in:
Nick Cabatoff 2021-11-23 12:13:47 -05:00 committed by GitHub
parent fe0dd6f867
commit c01b993bd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -118,6 +118,11 @@ func decodeSecretIDStorageEntry(entry *logical.StorageEntry) (*secretIDStorageEn
} }
cleanup := func(in []string) []string { cleanup := func(in []string) []string {
if len(in) == 0 {
// Don't change unnecessarily, if it was empty list leave as empty list
// instead of making it nil.
return in
}
var out []string var out []string
for _, s := range in { for _, s := range in {
out = append(out, parseip.TrimLeadingZeroesCIDR(s)) out = append(out, parseip.TrimLeadingZeroesCIDR(s))

3
changelog/13235.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
auth/approle: Fix regression where unset cidrlist is returned as nil instead of zero-length array.
```