-
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
Search and Pagination for API keys #71023
Comments
Pinging @elastic/es-security (Team:Security) |
As I understand the current `GetApiKey' api returns a single api key (or none if nothing matches). What we'll need for APM's use case is a "find" api that returns all API keys containing specific metadata. Thanks! |
I think the approach is already addressing your requirement.
|
Perfect, just wanted to be sure. |
This PR adds a new API for searching API keys. The API supports searching API keys with a controlled list of field names and a subset of Query DSL. It also provides a translation layer between the field names used in the REST layer and those in the index layer. This is to prevent tight coupling between the user facing request and index mappings so that they can evolve separately. Compared to the Get API key API, this new search API automatically applies calling user's security context similar to regular searches, e.g. if the user has only manage_own_api_key privilege, only keys owned by the user are returned in the search response. Relates: #71023
This PR adds a new API for searching API keys. The API supports searching API keys with a controlled list of field names and a subset of Query DSL. It also provides a translation layer between the field names used in the REST layer and those in the index layer. This is to prevent tight coupling between the user facing request and index mappings so that they can evolve separately. Compared to the Get API key API, this new search API automatically applies calling user's security context similar to regular searches, e.g. if the user has only manage_own_api_key privilege, only keys owned by the user are returned in the search response. Relates: elastic#71023
This PR adds a new API for searching API keys. The API supports searching API keys with a controlled list of field names and a subset of Query DSL. It also provides a translation layer between the field names used in the REST layer and those in the index layer. This is to prevent tight coupling between the user facing request and index mappings so that they can evolve separately. Compared to the Get API key API, this new search API automatically applies calling user's security context similar to regular searches, e.g. if the user has only manage_own_api_key privilege, only keys owned by the user are returned in the search response. Relates: #71023
This PR adds a new API for searching API keys. The API supports searching API keys with a controlled list of field names and a subset of Query DSL. It also provides a translation layer between the field names used in the REST layer and those in the index layer. This is to prevent tight coupling between the user facing request and index mappings so that they can evolve separately. Compared to the Get API key API, this new search API automatically applies calling user's security context similar to regular searches, e.g. if the user has only manage_own_api_key privilege, only keys owned by the user are returned in the search response. Relates: elastic#71023
This PR adds Rest API spec and related yaml tests for the new Query API key API. Relates: #71023
This PR adds Rest API spec and related yaml tests for the new Query API key API. Relates: elastic#71023
This PR adds HLRC for the new Query API key API added with elastic#75335 and elastic#76144 Relates: elastic#71023
This PR adds documentation for the new QueryApiKey API added in elastic#75335 and elastic#76144 Relates: elastic#71023
This PR adds documentation for the new QueryApiKey API added in elastic#75335 and elastic#76144 Relates: elastic#71023
Tasks for this issue are all completed. Hence closing the issue. |
Updated 2021-07-22
List of Tasks
To smooth the development and review processes, here is a proposed list of tasks, each rougly corrsponds to a PR:
from
,size
,sort
,search_after
(Add sort and pagination support for QueryApiKey API #76144)- [ ] Consistent data view, i.e. PIT support (optional?)The target release is 7.15 (except support for consistent data view) (edit: we decided to not support consistent data view)
Description
We need a new search API for API keys. It will be a separate one from the existing GetApiKey API because:
_security/api_key
. It is not possible to support GET with a request body (required for complex searches) while POST is used for a different purpose (creating API keys). There are tests actively forbid it.This new API should also support pagination so that it is possible to (1) retrieve a certain page of the search hits; (2) completely enumerate through all search hits especially when the total hit size is large; (3) (optionally) offer a consistent view of search results when necessary.
Examples of proposed request and response are as follows:
Request
Response
Note the usage of
from
,size
,sort
andsearch_after
. They work the same way as those for the regular search API.Note that the
total
field shows the exact total number of the API keys andcount
field shows the number of API keys returned in this response.Consistent Data View (Optional?)
PIT is needed to achieve a consistent view of the search results. But directly exposing PIT for this API is both inefficient and insecure. We propose to have an indirection of the actual
pit_id
and let the API handles it automatically. Sample APIs are as follows:The following content is original to the issue but now obsolete. It's kept here just for historical reference:
The text was updated successfully, but these errors were encountered: