[Feature] Introduces Centralized Resource Access Control and Sharing#5016
[Feature] Introduces Centralized Resource Access Control and Sharing#5016DarshitChanpura wants to merge 244 commits intoopensearch-project:mainfrom
Conversation
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>
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>
…in action 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>
… term 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>
2e97360 to
f4cad15
Compare
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
8f62c8f to
f9ce77a
Compare
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
466734d to
4ccec7c
Compare
Sample-resource-plugin integrations tests pass locally: |
nibix
left a comment
There was a problem hiding this comment.
This is a huge change. Meanwhile, it's architectural decisions like the common module are not entirely clear to me, which makes reviewing quite difficult.
Thus, I could only skim the changes, and added a few comments.
For a thorough review, I do not have the time ATM, though :-(
|
|
||
| # **Resource Sharing Client** | ||
|
|
||
| This package provides a **ResourceSharing client** that resource plugins can use to **implement access control** by communicating with the **OpenSearch Security Plugin**. |
There was a problem hiding this comment.
How do plugins consume this? Is this published as a separate maven package?
This README should probably have instructions on how to consume it.
| */ | ||
|
|
||
| /** | ||
| * This package defines common classes required to implement resource access control in OpenSearch. |
There was a problem hiding this comment.
It is unclear to me why these classes need to be moved into an own module. I see that the client module depends on it via an implementation dependency, right? So, will each plugin then carry a JAR with these implementations?
As some of them feel rather security-core-ish, like AdminDNs, I am not sure if it is good to move these out of the security core.
|
|
||
| // If no user is authenticated, return an empty set | ||
| if (user == null) { | ||
| LOGGER.warn("Unable to fetch user details. User is null."); |
There was a problem hiding this comment.
A resource sharing plugin indirectly cosumes the code via the client dependency, right?
Will this be also the case when security is disabled?
If so, what's the strategy for the case that security is disabled? Here it looks like that resources are not available at all when security is disabled (i.e., the user object is null).
There was a problem hiding this comment.
When security is disabled, the call will not reach here. Instead it would fail [here in the client] (
) with action not foundThere was a problem hiding this comment.
Does that mean that resource plugins cannot be used when security is disabled?
| // PKI authenticated REST call | ||
| User superuser = new User(sslPrincipal); | ||
| UserSubject subject = new UserSubjectImpl(threadPool, superuser); | ||
| UserSubject subject = new UserSubjectImpl(threadPool, new org.opensearch.security.common.user.User(sslPrincipal)); |
There was a problem hiding this comment.
Why is this change necessary?
There was a problem hiding this comment.
At present, the persistent header is only utilized in ResourceAccessHandler. And since we have an implementation of User in common package, we utilize that package's User here to avoid mismatch issues during runtime. This will be cleaned up once User is completely moved to common package.
| assertThat(resc.getStatusCode(), is(HttpStatus.SC_FORBIDDEN)); | ||
|
|
||
| resc = rh.executeGetRequest("/*,-*security/_search", encodeBasicHeader("foo_all", "nagilum")); | ||
| resc = rh.executeGetRequest("/*,-*security,-*resource*/_search", encodeBasicHeader("foo_all", "nagilum")); |
There was a problem hiding this comment.
Following up on this: https://github.com/opensearch-project/security/pull/5016/files#r1992120543
I think this indicates a deeper problem that needs to be investigated.
There was a problem hiding this comment.
I believe this might require updating the test framework. But I believe that could be done in a separate PR.
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
|
@nibix I understand this is a huge change, but I've tried to split it into multiple components, and highlighted the same in PR description.
I've documented the final design in detail here: #4500 (comment) |
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>
9195805 to
2d19530
Compare
|
As reviewers are leaning towards smaller PR, I'm closing this monolith, in lieu of individual PRs:
|
Apologies, I did not want to sound harsh. Just wanted to point out that I cannot give a thorough and complete review at the moment due to the size and time constraints. |
Description
Introduces a new authorization mechanism to control access to resources defined by plugins.
There are 4 major components to this PR:
Issues Resolved
Testing
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.