Skip to content
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 non super users to create API keys #40028

Merged
merged 1 commit into from
Mar 21, 2019

Conversation

bizybot
Copy link
Contributor

@bizybot bizybot commented Mar 14, 2019

When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with super_user role.

Closes #40029

When creating API keys we check for if API key with
same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of authenticated user. This caused the request to fail
in case of non super user trying to create API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be run with context of XPackSecurityUser.
Also fixed the Rest test to avoid using user with `super_user` role.
@bizybot bizybot added >bug v7.0.0 :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v6.7.0 v8.0.0 v7.2.0 labels Mar 14, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security

name: "admin_role"
body: >
{
"cluster": ["all"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add another set of tests for a user with a minimal set of privileges?
It doesn't need to cover the complete set of tests, just that it's possible to create an API key with a reasonable set of privileges...

But, I think that's going to highlight a problem because the minimal set of privileges is manage_security, which is too much. I'll raise a separate issue for that.

Copy link
Contributor Author

@bizybot bizybot Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Tim, I will address that as a separate issue.
#40031

@bizybot bizybot requested a review from jkakavas March 14, 2019 07:19
@bizybot
Copy link
Contributor Author

bizybot commented Mar 14, 2019

elasticsearch-ci/1 failed due to #40030

@elasticmachine run elasticsearch-ci/1

@bizybot bizybot marked this pull request as ready for review March 14, 2019 12:52
Copy link
Member

@jkakavas jkakavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bizybot
Copy link
Contributor Author

bizybot commented Mar 21, 2019

As the release for 6.7.0 is near, will merge this as this seems to be important functionality from API keys usage. I will handle the review comments if any from Tim in the next PRs. Thank you.

@bizybot bizybot merged commit 3c1d851 into elastic:master Mar 21, 2019
bizybot added a commit to bizybot/elasticsearch that referenced this pull request Mar 21, 2019
When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with `super_user` role.

Closes elastic#40029
bizybot added a commit to bizybot/elasticsearch that referenced this pull request Mar 21, 2019
When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with `super_user` role.

Closes elastic#40029
bizybot added a commit to bizybot/elasticsearch that referenced this pull request Mar 21, 2019
When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with `super_user` role.

Closes elastic#40029
bizybot added a commit that referenced this pull request Mar 21, 2019
When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with `super_user` role.

Closes #40029
bizybot added a commit that referenced this pull request Mar 21, 2019
When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with `super_user` role.

Closes #40029
bizybot added a commit that referenced this pull request Mar 21, 2019
When creating API keys we check for if API key with
the same key name already exists and fail the request if it does.
The check should have been performed with XPackSecurityUser
instead of the authenticated user. This caused the request to fail
in case of the non-super user trying to create an API key.
This commit fixes by executing search action with SECURITY_ORIGIN
so it can be executed with XPackSecurityUser.
Also fixed the Rest test to avoid using a user with `super_user` role.

Closes #40029
@bizybot bizybot added v6.7.1 and removed v6.7.0 labels Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v6.7.1 v7.0.0-rc1 v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow non super users to create API keys
6 participants