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

[Search] Return empty array when checking api keys for unauthorized user #173823

Conversation

sphilipse
Copy link
Member

@sphilipse sphilipse commented Dec 21, 2023

Summary

Instead of returning an obnoxious error on every Search page when fetching an unauthorized user's API keys, we just return an empty array.

@sphilipse sphilipse added release_note:skip Skip the PR/issue when compiling release notes Team:EnterpriseSearch v8.12.0 labels Dec 21, 2023
@sphilipse sphilipse requested a review from a team December 21, 2023 11:51
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

// Unfortunately the error response is not structured enough for us to filter those
// Always returning an empty array should also be fine, and deals with transient errors

return response.ok({ body: { api_keys: [] } });
Copy link
Member

Choose a reason for hiding this comment

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

This could be a little misleading if they don't have permissions and are say, using API keys elsewhere. But I think it's an OK workaround for now. Thanks for fixing!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it's not ideal. Thankfully security is working on a few utilities we can lean on going forward.

@sphilipse sphilipse merged commit 1a0dcf6 into elastic:main Dec 21, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 21, 2023
…ser (elastic#173823)

## Summary

Instead of returning an obnoxious error on every Search page when
fetching an unauthorized user's API keys, we just return an empty array.

(cherry picked from commit 1a0dcf6)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.12

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Dec 21, 2023
…rized user (#173823) (#173836)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Search] Return empty array when checking api keys for unauthorized
user (#173823)](#173823)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sander
Philipse","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-21T13:58:25Z","message":"[Search]
Return empty array when checking api keys for unauthorized user
(#173823)\n\n## Summary\r\n\r\nInstead of returning an obnoxious error
on every Search page when\r\nfetching an unauthorized user's API keys,
we just return an empty
array.","sha":"1a0dcf60fc3f2a8d498ae68f92db53a8de7fd112","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.12.0","v8.13.0"],"number":173823,"url":"https://github.com/elastic/kibana/pull/173823","mergeCommit":{"message":"[Search]
Return empty array when checking api keys for unauthorized user
(#173823)\n\n## Summary\r\n\r\nInstead of returning an obnoxious error
on every Search page when\r\nfetching an unauthorized user's API keys,
we just return an empty
array.","sha":"1a0dcf60fc3f2a8d498ae68f92db53a8de7fd112"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173823","number":173823,"mergeCommit":{"message":"[Search]
Return empty array when checking api keys for unauthorized user
(#173823)\n\n## Summary\r\n\r\nInstead of returning an obnoxious error
on every Search page when\r\nfetching an unauthorized user's API keys,
we just return an empty
array.","sha":"1a0dcf60fc3f2a8d498ae68f92db53a8de7fd112"}}]}]
BACKPORT-->

Co-authored-by: Sander Philipse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:EnterpriseSearch v8.12.0 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants