-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Superuser fastpath for indexAccessControl #78498
Merged
ywangd
merged 13 commits into
elastic:master
from
ywangd:superuser-fast-path-for-index-authorization
Oct 18, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b0c2594
Superuser fastpath for index authorization
ywangd b014814
fix bugs
ywangd 914f56e
fix test
ywangd 8a35041
Revert "fix test"
ywangd 1e3dbdf
adjust the fastpath location for indicesAccessControl
ywangd 120aeaf
Merge remote-tracking branch 'origin/master' into superuser-fast-path…
ywangd 175260b
Merge branch 'master' into superuser-fast-path-for-index-authorization
elasticmachine 2bc6593
remove fastpath for load authorized indices
ywangd 800cf1e
Merge remote-tracking branch 'origin/master' into superuser-fast-path…
ywangd 69b3ed3
address feedback to push shortcircuit down a level
ywangd 95737ac
Merge remote-tracking branch 'origin/master' into superuser-fast-path…
ywangd 7f055b1
Merge remote-tracking branch 'origin/master' into superuser-fast-path…
ywangd a0b0a62
address feedback
ywangd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,7 +336,7 @@ private void authorizeAction(final RequestInfo requestInfo, final String request | |
if (ClusterPrivilegeResolver.isClusterAction(action)) { | ||
final ActionListener<AuthorizationResult> clusterAuthzListener = | ||
wrapPreservingContext(new AuthorizationResultListener<>(result -> { | ||
threadContext.putTransient(INDICES_PERMISSIONS_KEY, IndicesAccessControl.ALLOW_ALL); | ||
threadContext.putTransient(INDICES_PERMISSIONS_KEY, IndicesAccessControl.allowAll()); | ||
listener.onResponse(null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like how GH throws in a |
||
}, listener::onFailure, requestInfo, requestId, authzInfo), threadContext); | ||
authzEngine.authorizeClusterAction(requestInfo, authzInfo, ActionListener.wrap(result -> { | ||
|
@@ -512,7 +512,7 @@ private void authorizeSystemUser(final Authentication authentication, final Stri | |
final TransportRequest request, final ActionListener<Void> listener) { | ||
final AuditTrail auditTrail = auditTrailService.get(); | ||
if (SystemUser.isAuthorized(action)) { | ||
threadContext.putTransient(INDICES_PERMISSIONS_KEY, IndicesAccessControl.ALLOW_ALL); | ||
threadContext.putTransient(INDICES_PERMISSIONS_KEY, IndicesAccessControl.allowAll()); | ||
threadContext.putTransient(AUTHORIZATION_INFO_KEY, SYSTEM_AUTHZ_INFO); | ||
auditTrail.accessGranted(requestId, authentication, action, request, SYSTEM_AUTHZ_INFO); | ||
listener.onResponse(null); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 seem to have 3 different (overlapping) methods for deciding whether an
IndicesAccessControl
object is the allow all object.instanceof AllowAllIndicesAccessControl
== AllowAllIndicesAccessControl.ALLOW_ALL_INDICES_ACCESS_CONTROL
isAllowAll()
(implemented via method 2)Can we standardise?
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 removed the 3rd method (it is actually not used ...) and thus remove 2 as well. Option 1 is the standard now.