-
Notifications
You must be signed in to change notification settings - Fork 300
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
[Feature] Introduces Centralized Resource Access Control and Sharing #5016
[Feature] Introduces Centralized Resource Access Control and Sharing #5016
Conversation
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
…in action Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
… term Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
2e97360
to
f4cad15
Compare
Signed-off-by: Darshit Chanpura <[email protected]>
8f62c8f
to
f9ce77a
Compare
Signed-off-by: Darshit Chanpura <[email protected]>
466734d
to
4ccec7c
Compare
Sample-resource-plugin integrations tests pass locally:
|
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When security is disabled, the call will not reach here. Instead it would fail [here in the client] (
Line 68 in e6d43b6
client.execute(ResourceAccessAction.INSTANCE, request, verifyAccessResponseListener(listener)); |
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.
Does that mean that resource plugins cannot be used when security is disabled?
@@ -224,7 +225,7 @@ public boolean authenticate(final SecurityRequestChannel request) { | |||
if (adminDns.isAdminDN(sslPrincipal)) { | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
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.
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.
@@ -846,19 +846,16 @@ public void testIndexResolveMinus() throws Exception { | |||
resc = rh.executeGetRequest("/*,-foo*/_search", encodeBasicHeader("foo_all", "nagilum")); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
@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 <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
Signed-off-by: Darshit Chanpura <[email protected]>
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.