-
Couldn't load subscription status.
- Fork 337
[Resource Access Control] [Part2] Updates SPI to introduce a ResourceSharingClient interface and implements it within security plugin #5240
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
Conversation
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…ntrol implementation in common package Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…tion Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…into resource-sharing-client
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…nges log level Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…control (opensearch-project#5185) Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
src/main/java/org/opensearch/security/resources/rest/revoke/RevokeResourceAccessRequest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…rser class Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
95f5b32 to
9560737
Compare
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
9560737 to
d365764
Compare
| - name: Checkout security | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Publish components to Maven Local |
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.
Are these steps required?
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.
Yes, CI checks will fail without these.
| * @param client the ResourceSharingClient instance | ||
| */ | ||
| String getResourceIndex(); | ||
| void assignResourceSharingClient(ResourceSharingClient client); |
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.
For plugins that implement this extension, can't we rely on the the ResourceSharingClient never being provided as having either 1) security uninstalled, 2) security disabled or 3) this feature disabled?
I see that there are checks added in the AD PR to see if security is disabled, but I don't think the checks should be present in those repos.
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.
I see that there are checks added in the AD PR to see if security is disabled, but I don't think the checks should be present in those repos.
The checks are meant to be for the feature to be disabled. If you do see a security enabled/disabled check then it is a miss on my end. Would you mind pointing me to the exact code change?
src/main/java/org/opensearch/security/resources/ResourceSharingIndexHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/resources/ResourceSharingIndexHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/resources/ResourceAccessHandler.java
Outdated
Show resolved
Hide resolved
| private final User user; | ||
|
|
||
| UserSubjectImpl(ThreadPool threadPool, User user) { | ||
| public UserSubjectImpl(ThreadPool threadPool, User user) { |
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.
This should remain package-private
| } | ||
| resourcePluginInfo.setResourceIndices(resourceIndices); | ||
| resourcePluginInfo.setResourceProviders(resourceProviders); | ||
| resourcePluginInfo.setResourceSharingExtensions(resourceSharingExtensions); |
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.
wdyt about only having this setter and then computing everything else within the ResourcePluginInfo class?
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.
We have an opportunity to preload the information that will not change, and will allows us to have constant time look-ups instead of computing these from resourceSharingExtensions. I think we should keep it as is.
| FeatureConfigConstants.OPENSEARCH_RESOURCE_SHARING_ENABLED, | ||
| FeatureConfigConstants.OPENSEARCH_RESOURCE_SHARING_ENABLED_DEFAULT | ||
| ); | ||
| resourceSharingIndexManagementRepository = ResourceSharingIndexManagementRepository.create( |
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.
Is this wrapper class needed? Looks like you can call this.resourceSharingIndexHandler.createResourceSharingIndexIfAbsent directly down below. What is the purpose of the callable as an arg to that method?
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.
I've followed suit with existing pattern:
security/src/main/java/org/opensearch/security/configuration/ConfigurationRepository.java
Line 320 in 7603dc2
| private boolean createSecurityIndexIfAbsent() { |
This will allows us to separate any index management tasks to its own class. Callable was a placeholder. I have removed extra abstraction since the only method offer by the repository was to create the index. I've replaced it with direct call
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
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.
Thank you @DarshitChanpura, I think most large structural items have been addressed. I think we should keep references to the feature flag only in this repo and not expose those outside the repo.
I am having trouble reviewing the queries in the ResourceSharingIndexHandler where its computing the resources visible to the current user, but the code and the intent is easy to follow.
I think this PR is a big step forward towards sensible authz for resources created by plugins where this lays the groundwork towards removing the copies of the users stored across various plugin system indices. Even with the placeholder for action groups at this point, these set of PRs can be built upon towards the desired end state of resource authorization where the owner of the resource gets to specify the access level when sharing.
While this change is large, it is done in a way not to cause disruption to the certain system and is enabled by a new feature flag. This is particularly good for anyone implementing a plugin from scratch to have a mechanism they can leverage from the security plugin and also allows for an opt-in model where existing plugins can opt into this mechanism from the security plugin to avoid a lot of existing code duplication around the plugin ecosystem.
I'm very eager to see the next steps after this initial groundwork to truly move towards the new model of resource authorization. This is a benefit for 1) OpenSearch users that will be empowered to control how their resources are shared, 2) plugin developers which can now delegate resource authz to the security plugin and 3) cluster administrators will not be bottlenecked figuring out how to do resource sharing using the existing filter_by_backend_role mechanism.
This PR is against a feature branch and a separate PR will be done to the main branch.
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
|
My highest-level comments have been addressed. Have you been able to organize it in such a way where only this repo refers to the Marking PR approved to merge into the feature branch, another review will be performed before merging to main. |
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
I see two potential ways to handle plugin's backwards compatibility atm:
Feature-flag made sense to me in terms of readability compared to option 2. Let me know your thoughts. |
|
Merging this. All future comments can be addressed in PR towards main. |
adf96f1
into
opensearch-project:feature/resource-permissions
…SharingClient interface and implements it within security plugin (opensearch-project#5240) Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Continuation of #5194 with a no-client approach.
#5016 is being broken down into smaller pieces. This is part 2.
Description
Modifies SPI to add a client to invoke resource-access-control APIs.
There are 4 java APIs as well as 4 REST APIs introduced as part of this PR. Plugins will leverage the client to call the java APIs to implement resource access control.
Refer to the [RESOURCE_ACCESS_CONTROL_FOR_PLUGINS.md](https://github.com/DarshitChanpura/security/blob/resource-sharing-no-client/RESOURCE_ACCESS_CONTROL_FOR_PLUGINS.md file to understand in-depth implementation of this feature.
Issues Resolved
Testing
Check List
- [ ] New Roles/Permissions have a corresponding security dashboards plugin PR- [ ] API changes companion pull request createdBy 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.