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

Replicate member_entity_ids and policies in identity/group across nodes identically #16088

Merged
merged 3 commits into from Jun 28, 2022

Conversation

hghaf099
Copy link
Contributor

@hghaf099 hghaf099 commented Jun 21, 2022

Addresses https://hashicorp.atlassian.net/browse/VAULT-2282
Example of reading an identity/group from a standby node:

{ "request_id": "4015c4c6-ee28-eec9-a42d-a0be91970dbc", "lease_id": "", "lease_duration": 0, "renewable": false, "data": { "alias": {}, "creation_time": "2022-06-21T05:56:12.378602Z", "id": "6a769520-f4b5-59a1-d7d7-21a650c91343", "last_update_time": "2022-06-21T05:56:12.378602Z", "member_entity_ids": null, "member_group_ids": [ "66bcfa57-8aab-04c8-d9ed-263bb5d2e6b0", "b7919faf-0a16-6acd-9e4d-82ac6db946bc" ], "metadata": null, "modify_index": 1, "name": "testgroup3", "namespace_id": "root", "parent_group_ids": null, "policies": [ "default" ], "type": "internal" }, "warnings": [ "Endpoint ignored these unrecognized parameters: [-format]" ] }

A group is marshalled and persisted in the leader node and then replicated to standby nodes. In standby node, memDB is populated after unmarshalling the group entry. However, member_entity_ids is an initialized empty slice when marshalled, but become a nil entry upon unmarshalling. This creates an inconsistency on the way active/standby nodes return the results.

To fix that, it was noticed that member_entity_ids field is nil, then passed into strutil.RemoveDuplicates function so that the duplicated entries be removed. That function returns an initialized empty slice regardless of the nil argument. The fix simply checks if the member_entity_ids field is not nil before passing it to that function. A test is going to be added to the ENT repo. Further details can be found in the ticket.

@hghaf099 hghaf099 disabled auto-merge June 28, 2022 23:12
@hghaf099 hghaf099 merged commit 2ccc3e0 into main Jun 28, 2022
@hghaf099 hghaf099 deleted the vault-2282 branch June 28, 2022 23:54
hghaf099 added a commit that referenced this pull request Jun 29, 2022
…es identically (#16088)

* Replicate values of group member_entity_ids and policies across nodes identically

* Adding CL

* fixing tests
hghaf099 added a commit that referenced this pull request Jun 29, 2022
…es identically (#16088)

* Replicate values of group member_entity_ids and policies across nodes identically

* Adding CL

* fixing tests
hghaf099 added a commit that referenced this pull request Jun 29, 2022
…es identically (#16088)

* Replicate values of group member_entity_ids and policies across nodes identically

* Adding CL

* fixing tests
hghaf099 added a commit that referenced this pull request Jun 29, 2022
…es identically (#16088) (#16185)

* Replicate values of group member_entity_ids and policies across nodes identically

* Adding CL

* fixing tests
hghaf099 added a commit that referenced this pull request Jun 29, 2022
…es identically (#16088) (#16187)

* Replicate values of group member_entity_ids and policies across nodes identically

* Adding CL

* fixing tests
hghaf099 added a commit that referenced this pull request Jun 29, 2022
…es identically (#16088) (#16186)

* Replicate values of group member_entity_ids and policies across nodes identically

* Adding CL

* fixing tests
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

3 participants