-
Couldn't load subscription status.
- Fork 106
Update user parsing to include custom attributes #827
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 parsing to include custom attributes #827
Conversation
|
I see that this repo has customAttrNames, however, I'm not sure how its used because the security repo does not serialize it. I think its safe to change the data structure to a Map and include the values as well. I created this change on my fork cwperks#1, but haven't adequately done any e2e test with your changes on the security repo yet. |
bc02a31 to
6b34ec4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @markboyd.
I'd like to look into 2 more things:
- Let's see about adding a test for the changes in
public static User parse(XContentParser parser) - Potentially copying over any tests from the security repo for the Base64Helper class
src/test/java/org/opensearch/commons/authuser/util/Base64HelperTest.java
Show resolved
Hide resolved
src/test/java/org/opensearch/commons/authuser/util/SafeSerializationUtilsTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM! Thank you @markdboyd
For the maintainers of this repo, we need to merge this and opensearch-project/security#5491 at the same time
0606e52 to
0091951
Compare
…rosoft/vscode-java-test#1740 Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
… compatibility Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…ibility Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…s compatibility Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…in a custom thread context Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…hen non-empty and fall back to empty list of custom attribute names when custom attributes are empty Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…l-group (#3715) * Onboards to centralized resource access control mechanism for ml-model-group Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes sharing logic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Consumes feature flag exposed by SPI Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates tests and dependency visibility Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes implmentation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Conforms to SPI changes Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Conforms to SPI changes in security plugin Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Reflects changes in SPI Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Refactors to use centralized method in ModelAccessControlHelper Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Corrects search handler to match against accessible model_group_ids Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes spotless Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix missed reference Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix compilation errors Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix compileTestsJava Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds existing feature-flag in conjunction with new feature flage Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes if condition Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates default creation and update logic to support existing scenarios Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Removes left over comment Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Refactors to conform to standalone authz framework supplied by security plugin Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Update model-group related requests to be doc requests Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Refactors verifyAccess to pass action names Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Re-add resource sharing client accessor Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Refactors how resource-sharing client is accessed Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Code cleanup Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Code cleanup 2 Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Code cleanup 3 Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix test compilation error Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix filter for model-groups on search request Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix most of the tests Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix search model transport action and tests Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix test failure by passing correct listener Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Refactors SearchModelGroupTransportActionTests to include new path and adds test for resource sharing extension Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix spotless Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix incorrect eval logic to check whether ml group index is present when search models Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adapts changes to make ResourceExtension consumed via @Inject Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix UTs broken due to opensearch-project/common-utils#827 Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Reverts "Adapts changes to make ResourceExtension consumed via @Inject" 8611f25 and adds setup for sec testing Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes extension over-ridden method Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes remaining broken UTs due to user object change Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds plugin client, related permissions and resource-action-groups file Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates resource-type and removes plugin client since it is not being used Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates config schema to handle all_shared_principals to be used in search Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix CI Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix unit test Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates API response message and adds method doc Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates resource-action-groups and search handler sequence Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates model search handler flow Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fixes method call broken during latest merge from main Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Cleans up search Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Reorders rsc client preference Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Handles hidden models in predict action Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds types to DocRequest Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Fix prediction action error handling to pass safe modelId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Boost MLSearchHandler test coverage Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Co-authored-by: Dhrubo Saha <dhrubo@amazon.com>
Description
As part of opensearch-project/alerting#1829, I found that the user parsing in this library, which is used by the alerting plugin, does not parse custom attribute names from a user string.
The current implementation makes sense because the security plugin does not currently include custom attribute names in the user string in the thread context: https://github.com/opensearch-project/security/blob/dfe16b004a6bb1c8d2bc50ac0c0f76780a3519cb/src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java#L276-L290.
However, I plan to update the security plugin to include custom attribute names in the thread context. Ultimately, the goal of this change and other related changes is to make sure that user custom attributes are available when the alerting plugin executes monitor queries, so that DLS parameter substitution will work correctly.
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.