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

Merging of entities should sanitize from_entity_id input #10100

Closed
mdgreenfield opened this issue Oct 6, 2020 · 0 comments · Fixed by #10101
Closed

Merging of entities should sanitize from_entity_id input #10100

mdgreenfield opened this issue Oct 6, 2020 · 0 comments · Fixed by #10101
Labels
bug Used to indicate a potential bug core/identity

Comments

@mdgreenfield
Copy link
Contributor

Describe the bug
When two entities are being merged, duplicate from_entity_ids results in duplicate entity aliases in the "to" entity.

To Reproduce
Steps to reproduce the behavior:

  1. Add an auth mount - vault auth enable -path=userpass1 userpass
  2. Get the auth mount accessor - mount1accessor=$(vault auth list -format=json | jq -r '.["userpass1/"].accessor')
  3. Create an entity - originalParentID=$(vault write -field=id -force identity/entity)
  4. Create an entity alias - vault write -field=id identity/entity-alias name=foobar canonical_id=$originalParentID mount_accessor=$mount1accessor
  5. Create a second entity - newParentID=$(vault write -field=id identity/entity name=foobar)
  6. Merge duplicate originalParentIDs into newParentID - vault write identity/entity/merge to_entity_id=$newParentID from_entity_ids=$originalParentID,$originalParentID
  7. Observe that the number of entity aliases on newParentID is incorrect. It should be 1 but it is 2. - vault read -format=json identity/entity/id/$newParentID | jq '.data.aliases | length'

Expected behavior
If from_entity_ids contains duplicates when merging two entities, they should be de-duplicated.

Environment:

  • Vault Server Version (retrieve with vault status): 1.5.4
  • Vault CLI Version (retrieve with vault version): 1.5.4
mdgreenfield added a commit to mdgreenfield/vault that referenced this issue Oct 6, 2020
@raskchanky raskchanky added bug Used to indicate a potential bug core/identity labels Oct 6, 2020
mdgreenfield added a commit to mdgreenfield/vault that referenced this issue Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug core/identity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants