-
Notifications
You must be signed in to change notification settings - Fork 106
Update user attributes XContent parsing logic #878
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
Update user attributes XContent parsing logic #878
Conversation
…or custom_attribute_names field Signed-off-by: Mark Boyd <[email protected]>
…et of attributes in custom_attribute_names Signed-off-by: Mark Boyd <[email protected]>
…as a list of key=value entries Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
…not set Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
…ies as key=val and to throw an exception if format is unexpected Signed-off-by: Mark Boyd <[email protected]>
…Content Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
…ce the field is no longer expected Signed-off-by: Mark Boyd <[email protected]>
…field Signed-off-by: Mark Boyd <[email protected]>
…ead of custom attributes as map Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
…property is malformed Signed-off-by: Mark Boyd <[email protected]>
…tribute_names Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
…lArgumentException Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
@markdboyd @cwperks This PR appears to be a breaking change to downstream plugins. See opensearch-project/flow-framework#1235 (For clarity: just tests making wrong assumptions!) |
@markdboyd @cwperks and anyone else coming here, looks like I need to update the tests to match what they should have been all along. Sample fix: https://github.com/opensearch-project/security-analytics/pull/1583/files |
Thank you @dbwiddis! I should have referenced that PR in a comment in case anyone was looking. I know ISM and AD have had to consume the change as well. Initially, we thought The user attributes were never serialized by the security plugin, so we found that we have many plugins with existing system index mappings that have custom_attribute_names and they just sit empty without attributes. @markdboyd made a series of changes to introduce a feature flag that allows a cluster admin to turn on user attribute serialization to start using this field. Its solving a bug in the Alerting repo and I suspect the fix will solve the same problem in other plugins as well. This PR does enforce that each entry of At one point, we contemplated adding to existing system index mappings (see opensearch-project/index-management#1484), but turns out it was possible to re-use the existing Thank you to @markdboyd for the fix. Here's a collection of the PRs that went into the bugfix: |
All good and thanks for the clarity @cwperks . This looks like a great change. I was mostly amused that my repo broke on something specifically talking about avoiding breaking downstream repos... but only ones that were already broken. Just lazy with tests. Appreciate the pointer to the quick fix. |
Description
A previous PR, #827, introduced a change to write user custom attributes to a
custom_attributes
property when serializing aUser
to XContent.However, this change has an adverse affect on many downstream plugins which do not expect a
custom_attributes
property for a user in their mappings: https://github.com/search?q=org%3Aopensearch-project+custom_attribute_names+language%3AJSON&type=code&l=JSONTo avoid breaking changes for downstream plugins while still representing the custom attributes in the XContent, this PR writes custom attributes to the
custom_attribute_names
property of XContent in the form ofkey=value
. While it is admittedly confusing to have a property namedcustom_attribute_names
that actually contains both custom attribute names and values, it is a worthwhile approach to avoid the breaking changes on downstream plugins.Related Issues
Related to opensearch-project/alerting#1829
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.