Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of VAULT-15840: Allow updates of only entity-alias custom-metadata into release/1.13.x #20440

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/20368.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
core/identity: Allow updates of only the custom-metadata for entity alias.
```
5 changes: 3 additions & 2 deletions vault/identity_store_aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ func (i *IdentityStore) handleAliasCreateUpdate() framework.OperationFunc {
}
switch {
case mountAccessor == "" && name == "":
// Just a canonical ID update, maybe
if canonicalID == "" {
// Check if the canonicalID or the customMetadata are being
// updated
if canonicalID == "" && !customMetadataExists {
// Nothing to do, so be idempotent
return nil, nil
}
Expand Down
40 changes: 40 additions & 0 deletions vault/identity_store_aliases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,46 @@ func TestIdentityStore_AliasUpdate(t *testing.T) {
"custom_metadata": map[string]string{},
},
},
{
name: "only-metadata",
createData: map[string]interface{}{
"name": "only",
"mount_accessor": githubAccessor,
"custom_metadata": map[string]string{
"foo": "bar",
},
},
updateData: map[string]interface{}{
"custom_metadata": map[string]string{
"bar": "baz",
},
},
},
{
name: "only-metadata-clear",
createData: map[string]interface{}{
"name": "only-clear",
"mount_accessor": githubAccessor,
"custom_metadata": map[string]string{
"foo": "bar",
},
},
updateData: map[string]interface{}{
"custom_metadata": map[string]string{},
},
},
{
name: "only-metadata-none-before",
createData: map[string]interface{}{
"name": "no-metadata",
"mount_accessor": githubAccessor,
},
updateData: map[string]interface{}{
"custom_metadata": map[string]string{
"foo": "bar",
},
},
},
}

handleRequest := func(t *testing.T, req *logical.Request) *logical.Response {
Expand Down
Loading