-
Notifications
You must be signed in to change notification settings - Fork 343
[Resource Sharing] Keep track of list ofall_shared_principals for which sharable resource is visible for searching
#5596
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
…le for searching Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5596 +/- ##
==========================================
- Coverage 73.02% 72.96% -0.06%
==========================================
Files 408 408
Lines 25293 25387 +94
Branches 3854 3862 +8
==========================================
+ Hits 18469 18523 +54
- Misses 4952 4983 +31
- Partials 1872 1881 +9
🚀 New features to boost your workflow:
|
Signed-off-by: Craig Perkins <[email protected]>
5 tasks
all_shared_principals for which sharable resource is visible for searching
5 tasks
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
DarshitChanpura
approved these changes
Sep 5, 2025
src/main/java/org/opensearch/security/resources/ResourceIndexListener.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/resources/ResourceSharingIndexHandler.java
Show resolved
Hide resolved
RyanL1997
approved these changes
Sep 5, 2025
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change updates the
fetchAccessibleResourceIdsmethod inResourceSharingIndexHandlerto search the resource index directly instead of the*-sharingindex.Category: Enhancement
Why these changes are required?
Previously, we only searched the resource sharing index (
*-sharing) and derived principals fromshare_with. This required scripts and runtime fields to flatten recipients, adding overhead. This PR also keeps track ofprincipalsin each resource document, we can query this field directly to determine visibility. Principals are of the form:user:{username},role:{rolename},backend:{backend_role_name}.user:*will be used as the convention for making a resource publicly visible.Keeping track of
principalsin the resource document improves:termsQuery("principals", entities).Old behavior: Queries ran against the
*-sharingindex, required derived runtime fields, and fetchedresource_idfrom_source.New behavior: Queries run directly on the resource index, filtering by the
principalsfield, and collect_ids as resource identifiers.Note: There will be a follow-up change to this PR to change
fetchAccessibleResourceIdsto a behind-the-scenes DLS clause which would not require the resource plugin to make 2 queries to get the list of visible IDs followed by the request they intend to make. The security plugin would inject a clause behind-the-scenes to limit the result set to a resource plugin based on the authenticated user.Issues Resolved
Related to: #4500
Testing
fetchAccessibleResourceIdsto validate queries againstprincipals.principalsupdates are honored in queries.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](https://github.com/opensearch-project/security/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).