Skip to content

Conversation

@DarshitChanpura
Copy link
Member

@DarshitChanpura DarshitChanpura commented Apr 18, 2025

Description

Introduces Centralized Resource Access Control framework by declaring a new SPI for plugins to extend ResourceSharingExtension and use ResourceSharingClient to utilize the resource access control APIs. Design outlined in the proposal below.

Issues Resolved

Testing

  • unit and integration tests, manual testing

Check List

  • New functionality includes testing
  • New functionality has been documented
    - [ ] New Roles/Permissions have a corresponding security dashboards plugin PR
    - [ ] API changes companion pull request created
  • Commits are signed per the DCO using --signoff

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.

@codecov
Copy link

codecov bot commented Apr 21, 2025

Codecov Report

❌ Patch coverage is 65.70486% with 416 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.69%. Comparing base (cac58bc) to head (540d3c6).
⚠️ Report is 167 commits behind head on main.

Files with missing lines Patch % Lines
...ecurity/resources/ResourceSharingIndexHandler.java 57.98% 112 Missing and 9 partials ⚠️
...ecurity/spi/resources/sharing/ResourceSharing.java 50.60% 36 Missing and 5 partials ⚠️
...arch/security/resources/ResourceAccessHandler.java 66.66% 25 Missing and 11 partials ⚠️
...arch/security/resources/ResourceIndexListener.java 16.12% 26 Missing ⚠️
...y/spi/resources/sharing/SharedWithActionGroup.java 64.81% 17 Missing and 2 partials ⚠️
...arch/security/spi/resources/sharing/CreatedBy.java 46.15% 12 Missing and 2 partials ⚠️
...ain/java/org/opensearch/sample/SampleResource.java 64.70% 12 Missing ⚠️
...tions/transport/DeleteResourceTransportAction.java 69.44% 9 Missing and 2 partials ⚠️
.../opensearch/security/OpenSearchSecurityPlugin.java 74.41% 9 Missing and 2 partials ⚠️
...arch/security/spi/resources/sharing/ShareWith.java 64.00% 7 Missing and 2 partials ⚠️
... and 27 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5281      +/-   ##
==========================================
- Coverage   72.04%   71.69%   -0.36%     
==========================================
  Files         336      384      +48     
  Lines       22648    23858    +1210     
  Branches     3560     3632      +72     
==========================================
+ Hits        16317    17104     +787     
- Misses       4556     4929     +373     
- Partials     1775     1825      +50     
Files with missing lines Coverage Δ
...va/org/opensearch/sample/SampleResourcePlugin.java 100.00% <100.00%> (ø)
...urce/actions/rest/create/CreateResourceAction.java 100.00% <100.00%> (ø)
...urce/actions/rest/create/UpdateResourceAction.java 100.00% <100.00%> (ø)
...urce/actions/rest/delete/DeleteResourceAction.java 100.00% <100.00%> (ø)
...e/resource/actions/rest/get/GetResourceAction.java 100.00% <100.00%> (ø)
...source/actions/rest/get/GetResourceRestAction.java 100.00% <100.00%> (ø)
...ctions/rest/revoke/RevokeResourceAccessAction.java 100.00% <100.00%> (ø)
...source/actions/rest/share/ShareResourceAction.java 100.00% <100.00%> (ø)
...transport/RevokeResourceAccessTransportAction.java 100.00% <100.00%> (ø)
...resource/client/ResourceSharingClientAccessor.java 100.00% <100.00%> (ø)
... and 44 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…strate usage of Resource Access Control feature (#5187)

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
@DarshitChanpura DarshitChanpura force-pushed the feature/resource-permissions branch from cf377b6 to 88ad450 Compare April 21, 2025 21:35
@DarshitChanpura DarshitChanpura marked this pull request as ready for review April 21, 2025 21:36
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
@DarshitChanpura DarshitChanpura force-pushed the feature/resource-permissions branch from 22e0d96 to 6ccfcdf Compare April 22, 2025 14:43
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
@DarshitChanpura DarshitChanpura force-pushed the feature/resource-permissions branch from 6173cc7 to a4615fa Compare April 22, 2025 19:33
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…dds @nonnull to arguments

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…rce-sharing document related method to ResourceSharing class

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
cwperks
cwperks previously approved these changes Apr 24, 2025
Copy link
Member

@cwperks cwperks left a comment

Choose a reason for hiding this comment

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

Thank you for the persistence @DarshitChanpura. Approving this PR with some of the comments remaining above, particularly around setting up extendedPlugins within the integrationTest framework.

I think this change is sufficiently isolated behind the experimental feature flag where the new classes initialized in OpenSearchSecurityPlugin are not used/instantiated unless the feature flag is enabled.

I really wanted to laud the introduction of this new extensibility model which I can see extended further in the future for other use-cases for plugins integrating with security and really paves the path forward for getting rid of the awkward existing plugin use-cases reading the user from the threadcontext and storing a copy in their own system indices either for this sharing use-case or for the job scheduler use case where they inject the roles back in at job runtime.

I also wanted to leave this quote: opensearch-project/OpenSearch#4459 (comment)

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
cwperks
cwperks previously approved these changes Apr 24, 2025
@cwperks cwperks dismissed their stale review April 24, 2025 15:47

Reviewing use of painless

Copy link
Member

@cwperks cwperks left a comment

Choose a reason for hiding this comment

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

Marking as approved again with additional comments.

Copy link
Collaborator

@derek-ho derek-ho left a comment

Choose a reason for hiding this comment

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

Thank you, Darshit Chanpura

Copy link
Collaborator

@derek-ho derek-ho left a comment

Choose a reason for hiding this comment

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

Thanks

@DarshitChanpura DarshitChanpura merged commit 68babe0 into main Apr 24, 2025
51 of 53 checks passed
@DarshitChanpura DarshitChanpura deleted the feature/resource-permissions branch April 24, 2025 21:26
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 24, 2025
… Framework (#5281)

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
(cherry picked from commit 68babe0)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@DarshitChanpura DarshitChanpura added the resource-permissions Label to track all items related to resource permissions label Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 3.0 resource-permissions Label to track all items related to resource permissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants