-
Notifications
You must be signed in to change notification settings - Fork 324
[Resource Sharing] Adds a Resource Access Evaluator for standalone Resource access authorization #5408
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
base: main
Are you sure you want to change the base?
[Resource Sharing] Adds a Resource Access Evaluator for standalone Resource access authorization #5408
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>
…ource access Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
… framework 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>
8c7eb57
to
f636120
Compare
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…abled scenarios 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>
src/main/java/org/opensearch/security/privileges/ResourceAccessEvaluator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/ResourceAccessEvaluator.java
Outdated
Show resolved
Hide resolved
…api test 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>
70b7628
to
98eef3a
Compare
c472133
to
d842b4d
Compare
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
d842b4d
to
9871f17
Compare
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>
…ecurity filter Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
0dc358f
to
9876fde
Compare
…s context in action-listener, and merges main Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
76db70e
to
6670f51
Compare
// NOTE: Since resource-access evaluation requires fetching documents from index, we make the call async otherwise it would | ||
// require blocking transport threads leading to thread exhaustion and request timeouts | ||
// We perform the rest of the evaluation as normal if the request is not for resource-access or if the feature is disabled | ||
resourceAccessEvaluator.evaluateAsync(request, action, context, ActionListener.wrap(response -> { |
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'd like to see if we can move this down into PrivilegesEvaluator along with the rest of the authorizers like system index and snapshot restore.
I know that one of the problems is PrivilegesEvaluatorResponse pres = eval.evaluate(context);
expects a return value of PrivilegesEvaluatorResponse
and not designed to be async.
I'm wondering if it makes sense to change this to either return an Optional
or just handle the case where it can return null
and then simply return
. i.e. if the return value indicates that privilege evaluation is not done, then it means its being done async so stop here and the decision to proceed will be handled in the async call where it either proceeds through the chain or returns early with forbidden error if the user does not have access.
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.
There is a markPending() method in PrivilegeEvalResponse class. I tried using it but was not successful. I can give it another try. With rest of PrivilegeEval being synchronous there are only 2 paths forward, as i see:
- Create a delegating handler that handles rest of the evaluation when feature is disabled or request is not of Resource type
- Utilize markPending() to indicate that access is currently being evaluated and will be processed by the evaluator. However, due to the nature of PrivilegeEval being synchronous i'm not entirely sure if that will be helpful.
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.
markPending()
looks perfectly suited for this use-case :). I see its not utilized atm as well.
Description
This PR adds a new privilege evaluator for evaluating access to a resource. #5281 introduced a way for plugin offload sharing and access evaluation to security plugin but that was done by requiring plugins to call verifyAccess method on their end. This leaves room for error. This new evaluator will filter all resource access requests through SecurityFilter class without requiring plugins to explicitly call verifyAccess method. It also adds support for access-levels instead of just the default one declared in the previous PR.
Notes:
verifyAccess
from the client as plugin no longer have to explicitly call the method to check user access.Issues Resolved
#5442
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.