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 Support clearing an identity alias' custom_metadata into release/1.9.x #13704

Conversation

hc-github-team-secure-vault-core
Copy link
Collaborator

Backport

This PR is auto-generated from #13395 to be assessed for backporting due to the inclusion of the label backport/1.9.x.

The below text is copied from the body of the original PR.


Previously, an update to an entity alias supports updating the
custom_metadata as long as the update is not empty, which makes it
impossible to clear the metadata values completely.

Fixes:

  • empty custom_metadata parameters are honoured on entity alias update
  • update related tests
  • reformat with gofumpt

@hc-github-team-secure-vault-core hc-github-team-secure-vault-core force-pushed the backport/VAULT-4074/identity-alias-clear-custom-metadata/primarily-bright-lionfish branch from 5debdfa to 7e1c191 Compare January 19, 2022 15:41
@vercel vercel bot temporarily deployed to Preview – vault-storybook January 19, 2022 15:41 Inactive
@vercel vercel bot temporarily deployed to Preview – vault January 19, 2022 15:43 Inactive
if err != nil {
return nil, err
}
customMetadata = data.(map[string]string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could a client craft a request that causes a panic if they set custom_metadata to something that's not a map[string]string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not my PR, but I reviewed the original prior to the backport. This type assertion should be safe due to the GetOk call above. The custom_metadata field is defined as framework.TypeKVPairs which is ultimately parsed as map[string]string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explainer! TIL

if err != nil {
return nil, err
}
customMetadata = data.(map[string]string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explainer! TIL

…clear-custom-metadata/primarily-bright-lionfish
@vercel vercel bot temporarily deployed to Preview – vault-storybook January 19, 2022 18:48 Inactive
@benashz benashz merged commit 0657eb8 into release/1.9.x Jan 19, 2022
@benashz benashz deleted the backport/VAULT-4074/identity-alias-clear-custom-metadata/primarily-bright-lionfish branch January 19, 2022 19:17
akshya96 pushed a commit that referenced this pull request Jan 20, 2022
…release/1.9.x (#13704)

* backport of commit 43760fe

* backport of commit 76bc893

* backport of commit 6d2e589

Co-authored-by: Ben Ash <bash@hashicorp.com>
Co-authored-by: Ben Ash <32777270+benashz@users.noreply.github.com>
@benashz benashz added this to the 1.9.3 milestone Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants