[Security] Quality Gate multi Organization for projects#181027
Merged
[Security] Quality Gate multi Organization for projects#181027
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
…a into sec-quality-gate-multi-org
…a into sec-quality-gate-multi-org
…a into sec-quality-gate-multi-org
2eac833 to
82a8d2f
Compare
…a into sec-quality-gate-multi-org
Contributor
Files by Code OwnerMadameSheema
banderror
elastic/appex-qa
elastic/kibana-operations
elastic/security-detections-response
elastic/security-engineering-productivity
elastic/security-solution
elastic/security-threat-hunting
maximpn
oatkiller
patrykkopycinski
|
patrykkopycinski
approved these changes
Apr 24, 2024
MadameSheema
approved these changes
Apr 25, 2024
delanni
approved these changes
Apr 25, 2024
logeekal
approved these changes
Apr 25, 2024
Contributor
logeekal
left a comment
There was a problem hiding this comment.
Security Solution changes look good. But since there so much ts code, it must have accompanying unit tests.
Could you please add those unit tests in current or follow up PR? Thanks.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
History
To update your PR or re-run it, just comment with: cc @dkirchan |
kpatticha
pushed a commit
to kpatticha/kibana
that referenced
this pull request
Apr 26, 2024
## Summary In order to run the tests concurrently we needed the ability to handle more than one organizations and rotation of api keys in order to create a project. This effort is covered by the job done for the cloud-handler (@elastic/security-engineering-productivity). The cloud-handler is a Python FastAPI service connected onto a Postgres Database, which handles the muiltiple organizations for the needs of the Security Kibana Quality Gate Testing - including the periodic pipeline and the future efforts to be able to run the tests from Devs against a real MKI. ## Description All the logic is pretty much handled in the `parallel_serverless.ts` script. [At this point](https://github.com/elastic/kibana/pull/181027/files#diff-a05c7d7d8448c53e20bbd60881deb4786bfffa3cdf654447732aed02e12b3867R223) we are getting the combination of PROXY_URL, PROXY_CLIENT_ID and PROXY_SECRET. All of these three should be defined as the first defines the URL of the proxy service and the latter define the authentication with the service. If all the three of the above mentioned variables are available, plus if the healthcheck for the service to be up and running is successful ([runs in this line](https://github.com/elastic/kibana/pull/181027/files#diff-a05c7d7d8448c53e20bbd60881deb4786bfffa3cdf654447732aed02e12b3867R255)) then the script starts creating environments through the proxy handler. Otherwise it goes back to the default single org execution (with the problems we have faced and tackling with this effort). If the flow procceeds with the proxy service then it creates the environment (the create environment request body is not changed at all so no change needs to be done in the test codebase) and then a response is returned indicating in the response body the organization-name that is being used. e.g.: ``` { "alias": "local-gizmo-tests-e2ebcd", "cloud_id": "local-gizmo-tests:ZXUtd2VzdC0xLmF3cy5xYS5lbGFzdGljLmNsb3VkJGUyZWJjZGZmMzY0YTRmYjliMjRmOGVkMGM0MjI2NThlLmVzJGUyZWJjZGZmMzY0YTRmYjliMjRmOGVkMGM0MjI2NThlLmti", "project_id": "e2ebcdff364a4fb9b24f8ed0c422658e", "name": "local-gizmo-tests", "region_id": "aws-eu-west-1", "project_type": "security", "admin_features_package": "standard", "creds_password": "f6RoNM84wQ4tBml3p13069uJ", "creds_username": "admin", "elasticsearch_endpoint": "https://local-gizmo-tests-e2ebcd.es.eu-west-1.aws.qa.elastic.cloud", "kibana_endpoint": "https://local-gizmo-tests-e2ebcd.kb.eu-west-1.aws.qa.elastic.cloud", "created_at": "2024-04-22T15:05:28.970745", "id": 1856, "organization_id": 16, **"organization_name": "sec-sol-auto-01"** } ``` Then this organization name is used to define the file with the roles which the saml authentication will be using in order to authenticate the users. This change is implemented in the following parts: - [The PROXY_ORG Cypress env var](https://github.com/elastic/kibana/pull/181027/files#diff-a05c7d7d8448c53e20bbd60881deb4786bfffa3cdf654447732aed02e12b3867R475) is defined. - [A roles filename is created](https://github.com/elastic/kibana/pull/181027/files#diff-5537ddd27eb2b8d7a4809e1bd9a28a4e6c23f3caa6a9b504b9c94ee037070315R34) if only the PROXY_ORG is defined and handed over to the SamlSessionManager. - [If the roles filename is provided,](https://github.com/elastic/kibana/pull/181027/files#diff-f63bfdabc35b838460de6b7e758d1bc168b54ba6ff418a8ad936d716c88af964R51) then it respects it, otherwise it uses the default `role_users.json` ## Relevant successful executions: - https://buildkite.com/elastic/security-serverless-quality-gate-kibana-periodic/builds/202 - https://buildkite.com/elastic/security-serverless-quality-gate-kibana-periodic/builds/203 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co>
4 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In order to run the tests concurrently we needed the ability to handle more than one organizations and rotation of api keys in order to create a project.
This effort is covered by the job done for the cloud-handler (@elastic/security-engineering-productivity). The cloud-handler is a Python FastAPI service connected onto a Postgres Database, which handles the muiltiple organizations for the needs of the Security Kibana Quality Gate Testing - including the periodic pipeline and the future efforts to be able to run the tests from Devs against a real MKI.
Description
All the logic is pretty much handled in the
parallel_serverless.tsscript.At this point we are getting the combination of PROXY_URL, PROXY_CLIENT_ID and PROXY_SECRET. All of these three should be defined as the first defines the URL of the proxy service and the latter define the authentication with the service.
If all the three of the above mentioned variables are available, plus if the healthcheck for the service to be up and running is successful (runs in this line) then the script starts creating environments through the proxy handler. Otherwise it goes back to the default single org execution (with the problems we have faced and tackling with this effort).
If the flow procceeds with the proxy service then it creates the environment (the create environment request body is not changed at all so no change needs to be done in the test codebase) and then a response is returned indicating in the response body the organization-name that is being used.
e.g.:
Then this organization name is used to define the file with the roles which the saml authentication will be using in order to authenticate the users. This change is implemented in the following parts:
role_users.jsonRelevant successful executions: