forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Using API auth for API calls in Serverless Cypres…
…s tests (elastic#190152) ### Context In our Cypress tests, we use API calls to set up the data needed to run the tests. Currently, we are using basic authentication for both ESS and serverless environments. However, for serverless, we should be using API key authentication, especially given that basic authentication will be deprecated soon. ### Challenges * Handling different authentication methods depending on whether the environment is serverless or ESS. * Allowing some tests to access or modify internal indexes. * Managing how the username is handled across different tests. ### Implentation To ensure the correct authentication is used based on the environment where the tests are executed, the `rootRequest` method is used to build the API request. Within this method, the appropriate authentication type is selected. All API calls will use an `admin` API key. The `admin` role is the least restrictive, which is appropriate for setting up data for tests rather than validating application behavior. This role minimizes the risk of issues during setup. A specific challenge arose when we needed to access or modify internal indexes, a capability restricted to the `system_indices_superuser` role for testing purposes. The issue stems from the API key generation method, which is tied to the user's role rather than the user itself. Since serverless currently lacks a role that permits access to internal indexes, we are, upon recommendation from the appex-qa team, using the Elasticsearch client directly with the `system_indices_superuser` role for these scenarios. For tests that assert the username, we made adjustments. Previously, the `system_indices_superuser` role was used universally, which is no longer the case for serverless. We now retrieve the username dynamically from user information instead of hardcoding the value. ### To be discussed When making modifications related to "username", it became apparent that we sometimes use "fullname" and, in other cases, "username," even though they seem intended to represent the same concept. Should we standardize on a single term across the solution? --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
6cf619c
commit f7a7d21
Showing
18 changed files
with
353 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.