-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Support viewing API key privileges #89058
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
Labels
>enhancement
:Security/Security
Security issues without another label
Team:Security
Meta label for security team
Comments
Pinging @elastic/es-security (Team:Security) |
elasticsearchmachine
pushed a commit
that referenced
this issue
Aug 9, 2022
This PR adds a new `role_descriptors` field in the API key entity returned by both GetApiKey and QueryApiKey APIs. The field value is the map of the role descriptors that are assigned to an API key when creating or updating the key. If the key has no assigned role descriptors, i.e. it inherits the owner user's privileges, an empty object is returned in place. Relates: #89058
This was referenced Aug 9, 2022
elasticsearchmachine
pushed a commit
that referenced
this issue
Aug 12, 2022
An API key's effective permission is an intersection between its assigned role descriptors and a snapshot of its owner user's role descriptors (limited-by role descriptors). In #89166, the assigned role descriptors are now returned by default in Get/Query API key responses. This PR further adds support to optionally return limited-by role descriptors in the responses. Unlike assign role descriptors, an API key cannot view any limited-by role descriptors unless it has manage_api_key or higher privileges. Relates: #89058
elasticsearchmachine
pushed a commit
that referenced
this issue
Aug 17, 2022
elasticsearchmachine
pushed a commit
that referenced
this issue
Aug 18, 2022
The GetUserPrivileges API returns a 500 error when it is called with an API key that has assigned role descriptors. This is because the underlying LimitedRole class that represents the API key's effective privileges does not support building a simple view of the privileges. This PR changes the code to return 400 error instead of 500 along with a better error message that suggests the GetApiKey API as an alternative. Relates: #89058
ywangd
added a commit
that referenced
this issue
Aug 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
>enhancement
:Security/Security
Security issues without another label
Team:Security
Meta label for security team
Uh oh!
There was an error while loading. Please reload this page.
Today the privileges of an API key cannot be viewed after its creation1. The alternative is to check its privileges with the HasPrivileges API. This is useful for authorization purpose but not helpful in terms of management and audit etc. API keys are now updatable (since #88186). Since each update can potentially alter both the key's assigned descriptors (
role_descriptors
) and the captured owner user's permissions (limited_by_role_descriptors
). It has become even harder to accurately know about an API key's privileges at any point of time. Hence the recommendation is to add support for viewing API key privileges with relevant APIs. The proposed work items are as the follows:role_descriptors
by default in GetApiKey API. (no change to the privilege model around it)limited_by_role_descriptors
in GetApiKey API when (1) alimited_by
query parameter is specified and (2) the authenticating subject is the owner of the API or hasmanage_api_key
(or higher) privilege.role_descriptors
andlimited_by_role_descriptors
.Footnotes
It is possible to retrieving the backing document of an API key by directly reading the security index. But directly accessing security index is generally discouraged. ↩
The text was updated successfully, but these errors were encountered: