-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Support updates of API key attributes [REST and transport layer] #88186
Support updates of API key attributes [REST and transport layer] #88186
Conversation
Pinging @elastic/es-security (Team:Security) |
Hi @n1v0lg, I've updated the changelog YAML for you. |
…v0lg/elasticsearch into update-api-keys-rest-transport-layers
...rc/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestUpdateApiKeyAction.java
Show resolved
Hide resolved
@elasticmachine run elasticsearch-ci/part-2-fips plz |
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
No major comments. But I appreciate if you could address them before merging. Thanks!
...a/org/elasticsearch/xpack/core/security/authz/privilege/ManageOwnApiKeyClusterPrivilege.java
Outdated
Show resolved
Hide resolved
.../test/java/org/elasticsearch/xpack/core/security/action/apikey/UpdateApiKeyRequestTests.java
Outdated
Show resolved
Hide resolved
.../elasticsearch/xpack/core/security/authz/privilege/ManageOwnApiKeyClusterPrivilegeTests.java
Outdated
Show resolved
Hide resolved
.../elasticsearch/xpack/core/security/authz/privilege/ManageOwnApiKeyClusterPrivilegeTests.java
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ApiKeyService.java
Show resolved
Hide resolved
...rc/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestUpdateApiKeyAction.java
Show resolved
Hide resolved
...st/java/org/elasticsearch/xpack/security/rest/action/apikey/RestUpdateApiKeyActionTests.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/elasticsearch/xpack/security/rest/action/apikey/RestUpdateApiKeyAction.java
Outdated
Show resolved
Hide resolved
...ty/src/internalClusterTest/java/org/elasticsearch/xpack/security/authc/ApiKeyIntegTests.java
Show resolved
Hide resolved
...ty/src/internalClusterTest/java/org/elasticsearch/xpack/security/authc/ApiKeyIntegTests.java
Outdated
Show resolved
Hide resolved
Hi @n1v0lg, I've updated the changelog YAML for you. |
We got this error when using this API, on version 7.17.6
|
This API is for version 8.4.0 and later. You must have confused it with some other APIs. Also, this appears to be a user question, and we'd like to direct these kinds of things to the Elasticsearch forum. If you can stop by there, we'd appreciate it. This allows us to use GitHub for verified bug reports, feature requests, and pull requests. There's an active community in the forum that should be able to help get an answer to your question. |
REST and transport layer implementation to add support for updating
attributes of existing API keys. This allows end-users to modify
privileges and metadata associated with API keys dynamically, without
requiring rolling out new API keys every time there is a change.
The new route supports updates to one API key, given its ID:
PUT /_security/api_key/{id}
The request body consists of optional fields
role_descriptors
andmetadata
. If a request field is absent, the existing value of thefield on the given API key is retained. If a request field is set to
{}
it replaces the existing value with{}
. Explicit null-values forrequest fields are not allowed and will produce a 400.
limited_by_role_descriptors
,creator
, andversion
areautomatically updated on every call. Attributes a replaced, not merged.
Only the owner user of an API key can update it. API keys cannot update
themselves, nor can other users (even users with
all
ormanage_security
cluster privileges).Relates: #87870