diff --git a/builtin/logical/transit/path_keys.go b/builtin/logical/transit/path_keys.go index 72e8bed715..8e453ed4eb 100644 --- a/builtin/logical/transit/path_keys.go +++ b/builtin/logical/transit/path_keys.go @@ -9,6 +9,7 @@ import ( "encoding/base64" "encoding/pem" "fmt" + "slices" "strconv" "strings" "time" @@ -179,6 +180,15 @@ func (b *backend) pathKeysList(ctx context.Context, req *logical.Request, d *fra return nil, err } + // filter out partial paths + entries = slices.DeleteFunc(entries, func(s string) bool { + if strings.HasSuffix(s, "/") { + return true + } + + return false + }) + return logical.ListResponse(entries), nil } diff --git a/changelog/30728.txt b/changelog/30728.txt new file mode 100644 index 0000000000..fb785a08f4 --- /dev/null +++ b/changelog/30728.txt @@ -0,0 +1,3 @@ +```release-note: improvement +transit: Exclude the partial wrapping key path from the transit/keys LIST operation. +``` \ No newline at end of file