Move sort from listresponse to file backend to solve 5141

This commit is contained in:
Jeff Mitchell 2018-08-24 13:37:10 -04:00
parent 55b3dfbcc0
commit 05a896703c
3 changed files with 6 additions and 3 deletions

View File

@ -37,13 +37,13 @@ IMPROVEMENTS:
* agent: Add `exit_after_auth` to be able to use the Agent for a single
authentication [GH-5013]
* api: Sort keys in list responses [GH-5141]
* auth/approle: Add ability to set token bound CIDRs on individual Secret IDs
[GH-5034]
* cli: Add support for passing parameters to `vault read` operations [GH-5093]
* secrets/nomad: Support for longer token names [GH-5117]
* secrets/pki: Allow disabling CRL generation [GH-5134]
* storage/azure: Add support for different Azure environments [GH-4997]
* storage/file: Sort keys in list responses [GH-5141]
* storage/mysql: Support special characters in database and table names.
BUG FIXES:

View File

@ -3,7 +3,6 @@ package logical
import (
"encoding/json"
"errors"
"sort"
"github.com/hashicorp/vault/helper/wrapping"
)
@ -114,7 +113,6 @@ func ListResponse(keys []string) *Response {
Data: map[string]interface{}{},
}
if len(keys) != 0 {
sort.Strings(keys)
resp.Data["keys"] = keys
}
return resp

View File

@ -8,6 +8,7 @@ import (
"io"
"os"
"path/filepath"
"sort"
"strings"
"sync"
@ -339,6 +340,10 @@ func (b *FileBackend) ListInternal(ctx context.Context, prefix string) ([]string
default:
}
if len(names) > 0 {
sort.Strings(names)
}
return names, nil
}