-
Couldn't load subscription status.
- Fork 337
Optimized tenant privilege evaluation #5350
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
Optimized tenant privilege evaluation #5350
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5350 +/- ##
==========================================
+ Coverage 71.96% 72.06% +0.10%
==========================================
Files 378 379 +1
Lines 23562 23569 +7
Branches 3630 3635 +5
==========================================
+ Hits 16956 16986 +30
+ Misses 4794 4786 -8
+ Partials 1812 1797 -15
🚀 New features to boost your workflow:
|
8200022 to
e165558
Compare
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Show resolved
Hide resolved
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
e165558 to
eba1316
Compare
| final TransportAddress remoteAddress = threadContext.getTransient(ConfigConstants.OPENDISTRO_SECURITY_REMOTE_ADDRESS); | ||
|
|
||
| final Set<String> securityRoles = evaluator.mapRoles(user, remoteAddress); | ||
| PrivilegesEvaluationContext context = evaluator.createContext(user, null); |
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.
qq, is remoteAddress not being used when getting mappedRoles?
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.
The second parameter of createContext() is the action name, not the remoteAddress. createContext() will retrieve the remoteAddress by itself out of the thread context (i.e., do that what is also being done in line 123 as seen above).
We can pass null for the action name, as we are not actually authorizing any action here.
Description
This change applies the principles used for the optimized privilege evaluation feature (#4380) also for tenant privileges. This should fix the performance issues observed in #5342 and #5129.
Issues Resolved
Fixes #5342
Fixes #5129
Testing
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.