Allow API key to retrieve its own information with no API key privilege#45433
Merged
bizybot merged 7 commits intoelastic:manage-own-api-key-privilegefrom Aug 15, 2019
Conversation
Unless the API key has `manage_api_key` privilege, it cannot get its own API key information when authenticating using API key. There can be a use case wherein we do not wish the user authenticating using API key to be able to invalidate or view any other API keys. This commit solves this by adding allowing the request in case the API key id from the `GetApiKeyRequest` matches the API key id present in the `authentication` metadata. Relates: elastic#40031
Collaborator
|
Pinging @elastic/es-security |
tvernum
reviewed
Aug 12, 2019
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/RBACEngine.java
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/RBACEngine.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
build failure due to |
Contributor
Author
|
hit a failure in MlDistributedFailureIT.testFullClusterRestart, issue already exists. |
albertzaharovits
approved these changes
Aug 13, 2019
Contributor
albertzaharovits
left a comment
There was a problem hiding this comment.
One comment, otherwise LGTM.
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/RBACEngine.java
Show resolved
Hide resolved
added 4 commits
August 14, 2019 10:55
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Unless the API key has
manage_api_keyprivilege, it cannot get itsown API key information when authenticating using an API key. There can
be a use case wherein we do not wish the user authenticating using an API
key to be able to invalidate or view any other API keys but only view information
about itself. This commit addresses this by allowing the request when
API key id from the
GetApiKeyRequestmatches the API key id present in theauthenticationmetadata.Relates: #40031