-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make SearchTemplateRequest implement IndicesRequest.Replaceable #9122
Conversation
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Compatibility status:
|
Script that fails before the change, but succeeds after the change:
|
Gradle Check (Jenkins) Run Completed with:
|
Compatibility status:
|
Gradle Check (Jenkins) Run Completed with:
|
Are any maintainers available for a PR review? |
Compatibility status:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Tests for this are being added in the security plugin here: https://github.com/opensearch-project/security/pull/2921/files |
@reta Could I trouble you for a review of this PR? It's a small one for a bug fix related to privilege evaluation of SearchTemplateRequests |
@reta or @dblock Would either of you be able to review this PR? This calls on the underlying implementations in the SearchRequest that is part of the SearchTemplateRequest. This fixes an issue with how SearchTemplateRequests are authorized where the security plugin cannot currently get the list of indices the SearchTemplateRequest is executed on and instead assumes |
modules/lang-mustache/src/main/java/org/opensearch/script/mustache/SearchTemplateRequest.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.
Search request templates do not not fit in the security plugins model, they are cluster wide construction. I don't think we should fix opensearch-project/security#1678 which is driving this change.
Seeing aside the merits of that bug - the notion of a replaceable indices on request should be the standard for plugin capabilities. If we are taking this change from an platform perspective should IndicesRequest.Replaceable
be more prevalent (including this case)? @macohen can you help us find someone to advise on next steps?
@peternied it is not a cluster wide action, it is very much another type of search request which is done on a set of indices. It is a cluster wide action to save a template, but this PR is not about that. This PR is about fixing an issue in authorizing requests that use a search template. See my comment above about why Replaceable is needed: #9122 (comment) Its needed to support dnfof |
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.
Dug in on opensearch-project/security#1678 the intent is around fixing a place where GET /*/_search
works as expected and GET /*/_search/template
is broken, so lets unblock that scenario with this change.
Thanks @cwperks
Compatibility status:
|
* Make SearchTemplateRequest implement IndicesRequest.Replaceable Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit c73f727) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
… (#9275) * Make SearchTemplateRequest implement IndicesRequest.Replaceable * Add to CHANGELOG --------- (cherry picked from commit c73f727) Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…search-project#9122) * Make SearchTemplateRequest implement IndicesRequest.Replaceable Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]>
…search-project#9122) * Make SearchTemplateRequest implement IndicesRequest.Replaceable Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]>
…search-project#9122) * Make SearchTemplateRequest implement IndicesRequest.Replaceable Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Kaushal Kumar <[email protected]>
…search-project#9122) * Make SearchTemplateRequest implement IndicesRequest.Replaceable Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Ivan Brusic <[email protected]>
…search-project#9122) * Make SearchTemplateRequest implement IndicesRequest.Replaceable Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Shivansh Arora <[email protected]>
Description
Companion PR in Security plugin that includes tests of the behavior: opensearch-project/security#2921
This PR makes SearchTemplateRequest (inside
modules/lang-mustache
) implementIndicesRequest.Replaceable
and for the implementation of each method it calls the underlying SearchRequest's implementation.This change resolves an issue in authorization of SearchTemplateRequests where the security plugin is unable to extract the indices associated with the request properly. See Details: opensearch-project/security#1678
As an effect, even if a user does a SearchTemplateRequest on a specific index:
i.e.
within the security plugin, it is not able to determine the request is on
movies
index and instead tries to evaluate whether the user has permission to do search template requests on*
index.With this change, the Security plugin will be able to extract the indices from the request as is already done for
Replaceable
requests here: https://github.com/opensearch-project/security/blob/main/src/main/java/org/opensearch/security/resolver/IndexResolverReplacer.java#L752-L758Related Issues
Resolves opensearch-project/security#1678
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.