-
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
Allow API key to retrieve its own information with no API key privilege #45433
Allow API key to retrieve its own information with no API key privilege #45433
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
Pinging @elastic/es-security |
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
build failure due to |
hit a failure in MlDistributedFailureIT.testFullClusterRestart, issue already exists. |
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.
One comment, otherwise LGTM.
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/RBACEngine.java
Show resolved
Hide resolved
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.
LGTM
Unless the API key has
manage_api_key
privilege, 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
GetApiKeyRequest
matches the API key id present in theauthentication
metadata.Relates: #40031