-
Notifications
You must be signed in to change notification settings - Fork 293
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
Set the mapped security roles of the user so these can be used by the… #1588
Set the mapped security roles of the user so these can be used by the… #1588
Conversation
Gentle ping - our stakeholders are still keen on this. Would appreciate feedback (positive or negative) on the approach and whether anything additional is needed. I note the failing "CodeQL" check - but I note that what it is complaining about is not relevant to (ie is not changed by) this PR. |
Thanks for contributing! Can you add UTs for all possible use cases? |
Can do. |
Tests added, will rebase and squash when everyone is happy. |
Any thoughts/comments stopping this from being merged. I'm happy to make changes if required? Also the documentation update has been completed by my colleague and is linked to the PR. |
132369f
to
45ff94c
Compare
@opensearch-project/security can we review this PR? |
Hey all, this has been sitting stagnant for a while. @ch-govau has added the tests, and @mm-govau has added the documentation in opensearch-project/documentation-website#420 which is already approved. I think all we are waiting on is an approval here? Any attention for review for would be much appreciated. Outside of the tests, it's 10 lines of new code, so hoping it's not a hard review task. Thanks again. |
@cliu123 can you review this? |
src/test/java/org/opensearch/security/dlic/dlsfls/DlsPropsReplaceTest.java
Show resolved
Hide resolved
Could you please sign all the commits? |
0efcaa5
to
f90dc0e
Compare
sorry about that. have rebased and the commit is signed. Thanks so much for reviewing this. It is very much appreciated :) |
Codecov Report
@@ Coverage Diff @@
## main #1588 +/- ##
============================================
- Coverage 62.94% 62.94% -0.01%
Complexity 3261 3261
============================================
Files 253 253
Lines 18126 18133 +7
Branches 3258 3259 +1
============================================
+ Hits 11410 11413 +3
- Misses 5067 5071 +4
Partials 1649 1649
Continue to review full report at Codecov.
|
… DLS privileges evaluator. Allow security roles to be used for DLS parameter substitution. Fixes opensearch-project/security/opensearch-project#1568 Signed-off-by: Caitlin Harper <caitlin.harper@defence.gov.au>
f90dc0e
to
f778b38
Compare
… DLS privileges evaluator. Allow security roles to be used for DLS parameter substitution. Fixes opensearch-project/security/opensearch-project#1568 (opensearch-project#1588) Signed-off-by: Caitlin Harper <caitlin.harper@defence.gov.au>
… DLS privileges evaluator. Allow security roles to be used for DLS parameter substitution. Fixes opensearch-project/security/#1568
Signed-off-by: Caitlin Harper caitlin.harper@defence.gov.au
Description
Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
Bug Fix /Enhancement
Why these changes are required?
The changes are required so that we can map the backend roles to more appropriately named roles via the roles.mapping and these security roles can be used in the DLS privileges evaluation.
What is the old behavior before changes and new behavior after changes?
Old behaviour:
security roles were not added to the user object prior to the DLS privileges evaluation
New behaviour:
mapped roles are added to the user object for DLS privileges evaluation
a new option for parameter substitution in the DLS query has been added. This is ${user.securityRoles} and is the mapped roles.
Note: there is no change to the existing ${user.roles} substitution. It remains the same.
Issues Resolved
Is this a backport? If so, please add backport PR # and/or commits #
Testing
Manual test steps:
Testing was completed for both basic auth and OIDC/jwt auth. Note that both users had read access to the index.
example:
doc1.json
example:
Expected result: This should return 1 document, doc1
8. Test jwt for user2
Expected result: This should return 2 documents.
9. Also tested with another user that has neither ROLE1 or ROLE2 and confirm they have access to zero documents.
Documentation
This will require an update to the DLS parameter substitution documentation to include the new ${user.securityRoles}.
The update to the documentation has been submitted here: opensearch-project/documentation-website#420
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.