Skip to content

Conversation

@cwperks
Copy link
Member

@cwperks cwperks commented Sep 16, 2025

Description

This PR adds a new extensible method to DocRequest to specify type. By itself, this PR is not very interest in the core as all DocRequest would be of type indices. The point of this PR is that this would be an extension point for plugins to start categorizing requests into buckets that have meaning to their use-case.

The javadoc introduced in this PR brings up a use-case in the reporting plugin that would create REST APIs and corresponding transport actions for actions that pertain to a single report definitions such as creating a report definition, editing the definition, deleting it or getting it. In such cases, this method can be overridden to specify the type. When the security plugin is installed and resource sharing + authorization is used, this type would be used in the authorization process to figure out what actions the current user is allowed to perform on the single resource give its identifier (DocID). Without a change like this, it would need to be assumed that a single resource system index contains a single type of resource. This change would further allow multiple resource types to live in the same index (i.e. saved objects in dashboards).

Related Issues

Related to opensearch-project/security#4500

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

@cwperks cwperks requested a review from a team as a code owner September 16, 2025 19:34
@github-actions
Copy link
Contributor

❌ Gradle check result for cb7692d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good in terms of bwc as well since it's a default method

@github-actions
Copy link
Contributor

✅ Gradle check result for cb7692d: SUCCESS

@codecov
Copy link

codecov bot commented Sep 16, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.84%. Comparing base (01b34a8) to head (cb7692d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...rc/main/java/org/opensearch/action/DocRequest.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19313      +/-   ##
============================================
- Coverage     72.87%   72.84%   -0.03%     
+ Complexity    69796    69775      -21     
============================================
  Files          5672     5673       +1     
  Lines        320710   320711       +1     
  Branches      46360    46360              
============================================
- Hits         233704   233610      -94     
- Misses        68111    68201      +90     
- Partials      18895    18900       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cwperks cwperks merged commit 10f8c8e into opensearch-project:main Sep 17, 2025
31 of 34 checks passed
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…roject#19313)

* Add new extensible method to DocRequest to specify type

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…roject#19313)

* Add new extensible method to DocRequest to specify type

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Ankit Jain <[email protected]>
jainankitk pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 22, 2025
…roject#19313)

* Add new extensible method to DocRequest to specify type

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Ankit Jain <[email protected]>
asimmahmood1 pushed a commit to jainankitk/OpenSearch that referenced this pull request Sep 23, 2025
…roject#19313)

* Add new extensible method to DocRequest to specify type

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
pranikum pushed a commit to pranikum/OpenSearch that referenced this pull request Sep 23, 2025
…roject#19313)

* Add new extensible method to DocRequest to specify type

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
vinaykpud pushed a commit to vinaykpud/OpenSearch that referenced this pull request Sep 26, 2025
…roject#19313)

* Add new extensible method to DocRequest to specify type

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

* Add CHANGELOG entry

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants