-
Notifications
You must be signed in to change notification settings - Fork 344
Add user custom attributes to thread context #5491
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
Add user custom attributes to thread context #5491
Conversation
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Outdated
Show resolved
Hide resolved
|
@markdboyd I think your IDE may have some conflicts with the spotless rules in this repo. Make sure to run |
|
@markdboyd FYI for serialization, I was thinking something like this: cwperks#59 i.e. let's base64 encode it to serialize. I'm thinking that its safe to base64 encode as its done elsewhere (example) and won't clash with the pipe-delimited format. |
|
@cwperks OK, I applied your feedback on base64 encoding and ran |
|
Thank you @markdboyd1 Can you also make sure to sign the commits? (See DCO check failure) Each repo has a DCO check that requires contributors to sign commits as a Developer Certificate of Origin: https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin I think we should also add an entry in the CHANGELOG for this PR. |
a614db2 to
6d44822
Compare
|
@cwperks Sorry for the amount of commits here. I had to try a couple times to get the rebasing + commit signing to work correctly. But it should be ready now, including a CHANGELOG entry Also, if you have any suggestions on how to setup git to do automatic signoff of future commits, I would welcome that |
I've gotten in the habit of doing |
|
FYI tests are failing bc common-utils changes will need to be merged first. They are failing on User.parse here: https://github.com/opensearch-project/security/blob/main/sample-resource-plugin/src/main/java/org/opensearch/sample/resource/actions/transport/CreateResourceTransportAction.java#L58 |
|
Other test error is bc
|
|
OK. I'll fix the CHANGELOG. Any suggestions re: Serializable and ImmutableMap? Also the common-utils PR is up and ready for review as well if that needs to go first: opensearch-project/common-utils#827 |
c07b657 to
d4887ff
Compare
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Outdated
Show resolved
Hide resolved
125ea6b to
2ec314c
Compare
|
@markdboyd for an example of a feature flag see: https://github.com/opensearch-project/security/blob/main/src/main/java/org/opensearch/security/OpenSearchSecurityPlugin.java#L1365-L1373 Essentially, we'd add a setting that an admin can place in opensearch.yml to enable/disable serialization of user attributes. i.e. |
|
To resolve the serialization issue with ImmutableMap, we need to add that as a Safe class here: https://github.com/opensearch-project/security/blob/main/src/main/java/org/opensearch/security/support/SafeSerializationUtils.java#L41-L54 |
Signed-off-by: Mark Boyd <[email protected]>
…t consistent 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]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
…te file 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]>
Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
9971210 to
55a401e
Compare
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Show resolved
Hide resolved
… thread context Signed-off-by: Mark Boyd <[email protected]>
Signed-off-by: Mark Boyd <[email protected]>
8c69314
into
opensearch-project:main
Description
Category: Bug fix
Why these changes are required?
In opensearch-project/alerting#1829 (comment), I was informed that the the user serialization into the threadcontext does not handle custom attributes, which breaks DLS for alert monitors.
Without these changes, the serialized user in the thread context does not include custom attribute names. With these changes, the serialized user in the thread context does include custom attribute names.
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.
Testing
I have not done any testing because I was unsure how to implement it or run it
Check List
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.