Commit graph

186 commits

Author SHA1 Message Date
Larry Gregory
24f82ee808
[8.x] Additional prototype pollution protections (#206073) (#208742)
# Backport

This will backport the following commits from `main` to `8.x`:
- [Additional prototype pollution protections
(#206073)](https://github.com/elastic/kibana/pull/206073)

<!--- Backport version: 9.6.4 -->

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

<!--BACKPORT [{"author":{"name":"Larry
Gregory","email":"larry.gregory@elastic.co"},"sourceCommit":{"committedDate":"2025-01-28T22:00:43Z","message":"Additional
prototype pollution protections (#206073)\n\n## Summary\n\n1. Extends
the server-side prototype pollution protections introduced
in\nhttps://github.com/elastic/kibana/pull/190716 to
include\n`Array.prototype`.\n2. Applies the same prototype pollution
protections to the client-side.\n\n\n### Identify risks\n\nDoes this PR
introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ]
Sealing prototypes on the client can lead to failures in\nthird-party
dependencies. I'm relying on sufficient functional test\ncoverage to
detect issues here. As a result, these protections are\ndisabled by
default for now, and can be controlled via
setting\n`server.prototypeHardening:
true/false`\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"9ce2dd8df9f2bd6c0ba1d089b69ddfd7fc1f4a02","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","Feature:Hardening","v9.0.0","backport:prev-minor","ci:cloud-deploy","ci:project-deploy-elasticsearch","ci:all-gen-ai-suites"],"title":"Additional
prototype pollution
protections","number":206073,"url":"https://github.com/elastic/kibana/pull/206073","mergeCommit":{"message":"Additional
prototype pollution protections (#206073)\n\n## Summary\n\n1. Extends
the server-side prototype pollution protections introduced
in\nhttps://github.com/elastic/kibana/pull/190716 to
include\n`Array.prototype`.\n2. Applies the same prototype pollution
protections to the client-side.\n\n\n### Identify risks\n\nDoes this PR
introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ]
Sealing prototypes on the client can lead to failures in\nthird-party
dependencies. I'm relying on sufficient functional test\ncoverage to
detect issues here. As a result, these protections are\ndisabled by
default for now, and can be controlled via
setting\n`server.prototypeHardening:
true/false`\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"9ce2dd8df9f2bd6c0ba1d089b69ddfd7fc1f4a02"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206073","number":206073,"mergeCommit":{"message":"Additional
prototype pollution protections (#206073)\n\n## Summary\n\n1. Extends
the server-side prototype pollution protections introduced
in\nhttps://github.com/elastic/kibana/pull/190716 to
include\n`Array.prototype`.\n2. Applies the same prototype pollution
protections to the client-side.\n\n\n### Identify risks\n\nDoes this PR
introduce any risks? For example, consider risks like hard\nto test
bugs, performance regression, potential of data loss.\n\nDescribe the
risk, its severity, and mitigation for each identified\nrisk. Invite
stakeholders and evaluate how to proceed before merging.\n\n- [ ]
Sealing prototypes on the client can lead to failures in\nthird-party
dependencies. I'm relying on sufficient functional test\ncoverage to
detect issues here. As a result, these protections are\ndisabled by
default for now, and can be controlled via
setting\n`server.prototypeHardening:
true/false`\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"9ce2dd8df9f2bd6c0ba1d089b69ddfd7fc1f4a02"}}]}]
BACKPORT-->
2025-01-29 15:08:04 -05:00
Michael Dokolin
861c2de3e5
[8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-core (#201653) (#205563)
# Backport

This will backport the following commits from `main` to `8.x`:
- [Sustainable Kibana Architecture: Move modules owned by
`@elastic/kibana-core`
(#201653)](https://github.com/elastic/kibana/pull/201653)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-01-04T18:47:24Z","message":"Sustainable
Kibana Architecture: Move modules owned by `@elastic/kibana-core`
(#201653)\n\n## Summary\n\nStart relocating Kibana modules (packages and
plugins) to the new folder\nstructure, according to the _Kibana
Sustainable Architecture_\ninitiative.\n#### 16 plugin(s) are going to
be relocated:\n\n| Id | Target folder |\n| -- | ------------- |\n|
`@kbn/cloud-chat-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |\n|
`@kbn/cloud-experiments-plugin`
|\n`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments`
|\n| `@kbn/cloud-full-story-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story`
|\n| `@kbn/cloud-links-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |\n|
`@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |\n|
`@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |\n|
`@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |\n|
`@kbn/kibana-usage-collection-plugin`
|\n`src/platform/plugins/private/kibana_usage_collection` |\n|
`@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing`
|\n| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed`
|\n| `@kbn/saved-objects-management-plugin`
|\n`src/platform/plugins/shared/saved_objects_management` |\n|
`@kbn/telemetry-collection-manager-plugin`
|\n`src/platform/plugins/shared/telemetry_collection_manager` |\n|
`@kbn/telemetry-collection-xpack-plugin`
|\n`x-pack/platform/plugins/private/telemetry_collection_xpack` |\n|
`@kbn/telemetry-management-section-plugin`
|\n`src/platform/plugins/shared/telemetry_management_section` |\n|
`@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |\n|
`@kbn/usage-collection-plugin`
|\n`src/platform/plugins/shared/usage_collection` |\n\n#### 22
package(s) are going to be relocated:\n\n| Id | Target folder |\n| -- |
------------- |\n| `@kbn/analytics` |
`src/platform/packages/shared/kbn-analytics` |\n|
`@kbn/analytics-collection-utils`
|\n`src/platform/packages/private/analytics/utils/analytics_collection_utils`\n|\n|
`@kbn/apm-config-loader`
|\n`src/platform/packages/private/kbn-apm-config-loader` |\n|
`@kbn/cloud` | `src/platform/packages/shared/cloud` |\n| `@kbn/config` |
`src/platform/packages/shared/kbn-config` |\n| `@kbn/config-mocks` |
`src/platform/packages/private/kbn-config-mocks`\n|\n|
`@kbn/config-schema` |\n`src/platform/packages/shared/kbn-config-schema`
|\n| `@kbn/crypto-browser`
|\n`src/platform/packages/shared/kbn-crypto-browser` |\n|
`@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |\n|
`@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |\n|
`@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |\n|
`@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |\n|
`@kbn/health-gateway-server`
|\n`src/platform/packages/private/kbn-health-gateway-server` |\n|
`@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |\n|
`@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |\n|
`@kbn/logging` | `src/platform/packages/shared/kbn-logging` |\n|
`@kbn/logging-mocks` |\n`src/platform/packages/shared/kbn-logging-mocks`
|\n| `@kbn/router-to-openapispec`
|\n`src/platform/packages/shared/kbn-router-to-openapispec` |\n|
`@kbn/server-http-tools`
|\n`src/platform/packages/shared/kbn-server-http-tools` |\n| `@kbn/std`
| `src/platform/packages/shared/kbn-std` |\n| `@kbn/utility-types`
|\n`src/platform/packages/shared/kbn-utility-types` |\n| `@kbn/zod` |
`src/platform/packages/shared/kbn-zod` |\n\n---------\n\nCo-authored-by:
Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6049493e4a2372ea22986b231ad2bd59584fe9b8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","plugin
groups"],"number":201653,"url":"https://github.com/elastic/kibana/pull/201653","mergeCommit":{"message":"Sustainable
Kibana Architecture: Move modules owned by `@elastic/kibana-core`
(#201653)\n\n## Summary\n\nStart relocating Kibana modules (packages and
plugins) to the new folder\nstructure, according to the _Kibana
Sustainable Architecture_\ninitiative.\n#### 16 plugin(s) are going to
be relocated:\n\n| Id | Target folder |\n| -- | ------------- |\n|
`@kbn/cloud-chat-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |\n|
`@kbn/cloud-experiments-plugin`
|\n`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments`
|\n| `@kbn/cloud-full-story-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story`
|\n| `@kbn/cloud-links-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |\n|
`@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |\n|
`@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |\n|
`@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |\n|
`@kbn/kibana-usage-collection-plugin`
|\n`src/platform/plugins/private/kibana_usage_collection` |\n|
`@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing`
|\n| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed`
|\n| `@kbn/saved-objects-management-plugin`
|\n`src/platform/plugins/shared/saved_objects_management` |\n|
`@kbn/telemetry-collection-manager-plugin`
|\n`src/platform/plugins/shared/telemetry_collection_manager` |\n|
`@kbn/telemetry-collection-xpack-plugin`
|\n`x-pack/platform/plugins/private/telemetry_collection_xpack` |\n|
`@kbn/telemetry-management-section-plugin`
|\n`src/platform/plugins/shared/telemetry_management_section` |\n|
`@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |\n|
`@kbn/usage-collection-plugin`
|\n`src/platform/plugins/shared/usage_collection` |\n\n#### 22
package(s) are going to be relocated:\n\n| Id | Target folder |\n| -- |
------------- |\n| `@kbn/analytics` |
`src/platform/packages/shared/kbn-analytics` |\n|
`@kbn/analytics-collection-utils`
|\n`src/platform/packages/private/analytics/utils/analytics_collection_utils`\n|\n|
`@kbn/apm-config-loader`
|\n`src/platform/packages/private/kbn-apm-config-loader` |\n|
`@kbn/cloud` | `src/platform/packages/shared/cloud` |\n| `@kbn/config` |
`src/platform/packages/shared/kbn-config` |\n| `@kbn/config-mocks` |
`src/platform/packages/private/kbn-config-mocks`\n|\n|
`@kbn/config-schema` |\n`src/platform/packages/shared/kbn-config-schema`
|\n| `@kbn/crypto-browser`
|\n`src/platform/packages/shared/kbn-crypto-browser` |\n|
`@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |\n|
`@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |\n|
`@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |\n|
`@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |\n|
`@kbn/health-gateway-server`
|\n`src/platform/packages/private/kbn-health-gateway-server` |\n|
`@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |\n|
`@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |\n|
`@kbn/logging` | `src/platform/packages/shared/kbn-logging` |\n|
`@kbn/logging-mocks` |\n`src/platform/packages/shared/kbn-logging-mocks`
|\n| `@kbn/router-to-openapispec`
|\n`src/platform/packages/shared/kbn-router-to-openapispec` |\n|
`@kbn/server-http-tools`
|\n`src/platform/packages/shared/kbn-server-http-tools` |\n| `@kbn/std`
| `src/platform/packages/shared/kbn-std` |\n| `@kbn/utility-types`
|\n`src/platform/packages/shared/kbn-utility-types` |\n| `@kbn/zod` |
`src/platform/packages/shared/kbn-zod` |\n\n---------\n\nCo-authored-by:
Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6049493e4a2372ea22986b231ad2bd59584fe9b8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201653","number":201653,"mergeCommit":{"message":"Sustainable
Kibana Architecture: Move modules owned by `@elastic/kibana-core`
(#201653)\n\n## Summary\n\nStart relocating Kibana modules (packages and
plugins) to the new folder\nstructure, according to the _Kibana
Sustainable Architecture_\ninitiative.\n#### 16 plugin(s) are going to
be relocated:\n\n| Id | Target folder |\n| -- | ------------- |\n|
`@kbn/cloud-chat-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |\n|
`@kbn/cloud-experiments-plugin`
|\n`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments`
|\n| `@kbn/cloud-full-story-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story`
|\n| `@kbn/cloud-links-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |\n|
`@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |\n|
`@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |\n|
`@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |\n|
`@kbn/kibana-usage-collection-plugin`
|\n`src/platform/plugins/private/kibana_usage_collection` |\n|
`@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing`
|\n| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed`
|\n| `@kbn/saved-objects-management-plugin`
|\n`src/platform/plugins/shared/saved_objects_management` |\n|
`@kbn/telemetry-collection-manager-plugin`
|\n`src/platform/plugins/shared/telemetry_collection_manager` |\n|
`@kbn/telemetry-collection-xpack-plugin`
|\n`x-pack/platform/plugins/private/telemetry_collection_xpack` |\n|
`@kbn/telemetry-management-section-plugin`
|\n`src/platform/plugins/shared/telemetry_management_section` |\n|
`@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |\n|
`@kbn/usage-collection-plugin`
|\n`src/platform/plugins/shared/usage_collection` |\n\n#### 22
package(s) are going to be relocated:\n\n| Id | Target folder |\n| -- |
------------- |\n| `@kbn/analytics` |
`src/platform/packages/shared/kbn-analytics` |\n|
`@kbn/analytics-collection-utils`
|\n`src/platform/packages/private/analytics/utils/analytics_collection_utils`\n|\n|
`@kbn/apm-config-loader`
|\n`src/platform/packages/private/kbn-apm-config-loader` |\n|
`@kbn/cloud` | `src/platform/packages/shared/cloud` |\n| `@kbn/config` |
`src/platform/packages/shared/kbn-config` |\n| `@kbn/config-mocks` |
`src/platform/packages/private/kbn-config-mocks`\n|\n|
`@kbn/config-schema` |\n`src/platform/packages/shared/kbn-config-schema`
|\n| `@kbn/crypto-browser`
|\n`src/platform/packages/shared/kbn-crypto-browser` |\n|
`@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |\n|
`@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |\n|
`@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |\n|
`@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |\n|
`@kbn/health-gateway-server`
|\n`src/platform/packages/private/kbn-health-gateway-server` |\n|
`@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |\n|
`@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |\n|
`@kbn/logging` | `src/platform/packages/shared/kbn-logging` |\n|
`@kbn/logging-mocks` |\n`src/platform/packages/shared/kbn-logging-mocks`
|\n| `@kbn/router-to-openapispec`
|\n`src/platform/packages/shared/kbn-router-to-openapispec` |\n|
`@kbn/server-http-tools`
|\n`src/platform/packages/shared/kbn-server-http-tools` |\n| `@kbn/std`
| `src/platform/packages/shared/kbn-std` |\n| `@kbn/utility-types`
|\n`src/platform/packages/shared/kbn-utility-types` |\n| `@kbn/zod` |
`src/platform/packages/shared/kbn-zod` |\n\n---------\n\nCo-authored-by:
Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6049493e4a2372ea22986b231ad2bd59584fe9b8"}}]}]
BACKPORT-->

---------

Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
2025-01-05 16:32:00 +01:00
Kibana Machine
9a92bbae52
[8.x] Categorise Kibana plugins - Wave 2 (#199302) (#199461)
# Backport

This will backport the following commits from `main` to `8.x`:
- [Categorise Kibana plugins - Wave 2
(#199302)](https://github.com/elastic/kibana/pull/199302)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2024-11-08T11:45:20Z","message":"Categorise
Kibana plugins - Wave 2 (#199302)\n\n## Summary\r\n\r\nThe remaining
plugins are being categorised with the\r\nsupervision/approval of their
owners.","sha":"d06856157e0d1c2e2efd561c0388287a19ed4d8f","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability"],"title":"Categorise
Kibana plugins - Wave
2","number":199302,"url":"https://github.com/elastic/kibana/pull/199302","mergeCommit":{"message":"Categorise
Kibana plugins - Wave 2 (#199302)\n\n## Summary\r\n\r\nThe remaining
plugins are being categorised with the\r\nsupervision/approval of their
owners.","sha":"d06856157e0d1c2e2efd561c0388287a19ed4d8f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199302","number":199302,"mergeCommit":{"message":"Categorise
Kibana plugins - Wave 2 (#199302)\n\n## Summary\r\n\r\nThe remaining
plugins are being categorised with the\r\nsupervision/approval of their
owners.","sha":"d06856157e0d1c2e2efd561c0388287a19ed4d8f"}}]}]
BACKPORT-->

Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
2024-11-09 10:18:22 -06:00
Luke Elmers
b6287708f6
Adds AGPL 3.0 license (#192025)
Updates files outside of x-pack to be triple-licensed under Elastic
License 2.0, AGPL 3.0, or SSPL 1.0.
2024-09-06 19:02:41 -06:00
Tre
666ab3dcfb
[FTR] Refactor SuperTest provider to the kbn-ftr-common-functional-services pkg (#191999)
Move supertest from global folder to specific package.

Resolves: https://github.com/elastic/kibana/issues/191970
2024-09-05 20:05:45 +01:00
Tre
69665cecd0
[FTR] Refactor test/common/services/* -> packages/kbn-ftr-common-functional-[ui-]services/* (#191805)
## Summary

Moving common services to respective new homes.

This PR is revived from a previously
[merged](09a365850e)
and [reverted PR](https://github.com/elastic/kibana/pull/191765) as
[detailed
here](https://github.com/elastic/kibana/pull/189051#issuecomment-2318999361).
- This was due to "extra" tests being applied to
https://github.com/elastic/kibana/pull/191708
- These "extra" tests were applied as
https://github.com/elastic/kibana/pull/191708 changes files within
`x-pack/plugins/observability_solution/` as configured
[here](https://github.com/elastic/kibana/blob/main/.buildkite/scripts/pipelines/pull_request/pipeline.ts#L129)

### Why these failures were not caught in the original
[PR](https://github.com/elastic/kibana/pull/189051)
The pipeline is generated at runtime, and the original
[PR](https://github.com/elastic/kibana/pull/189051) had zero changes
under `x-pack/plugins/observability_solution/`
 
 ## Changes on top of original PR
 - Add `ci:all-cypress-suites` label to run extra tests
- Add `services` stanza to which contains the missing references by
spreading the services from `@kbn/ftr-common-functional-services` &&
`@kbn/ftr-common-functional-ui-services` into the stanza, for the
following:
   - `x-pack/plugins/observability_solution/synthetics/e2e/config.ts`
   - `x-pack/plugins/observability_solution/apm/ftr_e2e/ftr_config.ts` 
-
`x-pack/plugins/observability_solution/observability_onboarding/e2e/ftr_config.ts`
   - `x-pack/plugins/observability_solution/profiling/e2e/ftr_config.ts`
   - `x-pack/plugins/observability_solution/synthetics/e2e/config.ts`
   - `x-pack/plugins/observability_solution/uptime/e2e/config.ts`
 

 
 
Blocked by: https://github.com/elastic/kibana/issues/191961
Resolves: https://github.com/elastic/kibana/issues/188541

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-05 10:00:55 +01:00
Jon
9f70009d89
Revert "[FTR] Refactor test/common/services/* -> packages/kbn-ftr-com… (#191765)
Build failure


https://buildkite.com/elastic/kibana-pull-request/builds/230868#01919ed7-15d5-425c-9b8e-146ed5fe9daf
2024-08-29 16:05:53 -05:00
Tre
09a365850e
[FTR] Refactor test/common/services/* -> packages/kbn-ftr-common-functional-[ui-]services/* (#189051)
## Summary

Moving common services to respective new homes.

Resolves: https://github.com/elastic/kibana/issues/188541

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-29 14:46:35 +01:00
Nick Partridge
94b657e6c9
Add 5s minRefreshInterval to timefilter with validation (#188881)
Adds enforcement for the global time filter to limit the min refresh interval.
2024-08-23 11:21:52 -05:00
Dzmitry Lemechko
7df01e99c1
[FTR] support "deployment agnostic" api-integration tests (#189853)
## Summary

### This PR introduces a new type of API integration tests in FTR:
deployment-agnostic

![8zcgq0
(1)](https://github.com/user-attachments/assets/17c6d4ee-7848-4a4c-a006-7ae54e523243)

#### Test suite is considered deployment-agnostic when it fulfils the
following criteria:

**Functionality**: It tests Kibana APIs that are **logically identical
in both stateful and serverless environments** for the same SAML roles.

**Design**: The test design is **clean and does not require additional
logic** to execute in either stateful or serverless environments.

### How It Works
Most existing stateful tests use basic authentication for API testing.
In contrast, serverless tests use SAML authentication with
project-specific role mapping.

Since stateful deployments also support SAML, deployment-agnostic tests
**configure Elasticsearch and Kibana with SAML authentication in both
cases**. For roles, stateful deployments define 'viewer', 'editor', and
'admin' roles with serverless-alike privileges.

New `samlAuth` service has `AuthProvider` interface with 2 different
implementations: depending on environment context (serverless or
stateful) appropriate implementation is used. But it remains on service
level and hidden in test suite.

test example
```
export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
  const samlAuth = getService('samlAuth');
  const supertestWithoutAuth = getService('supertestWithoutAuth');
  let roleAuthc: RoleCredentials;
  let internalHeaders: InternalRequestHeader;

  describe('GET /api/console/api_server', () => {
    before(async () => {
      roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('admin');
      internalHeaders = samlAuth.getInternalRequestHeader();
    });
    after(async () => {
      await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc);
    });
    it('returns autocomplete definitions', async () => {
      const { body } = await supertestWithoutAuth
        .get('/api/console/api_server')
        .set(roleAuthc.apiKeyHeader)
        .set(internalHeaders)
        .set('kbn-xsrf', 'true')
        .expect(200);
      expect(body.es).to.be.ok();
      const {
        es: { name, globals, endpoints },
      } = body;
      expect(name).to.be.ok();
      expect(Object.keys(globals).length).to.be.above(0);
      expect(Object.keys(endpoints).length).to.be.above(0);
    });
  });
}
```

Please read
[readme](966822ac87/x-pack/test/api_integration/deployment_agnostic/README.md)
for more details and step-by-step guide. It should help migrating
existing serverless tests to deployment-agnostic, assuming requirements
are met.

### Examples

Deployment-agnostic tests:

```
x-pack/test/api_integration/deployment_agnostic/apis/console/spec_definitions.ts

x-pack/test/api_integration/deployment_agnostic/apis/core/compression.ts

x-pack/test/api_integration/deployment_agnostic/apis/painless_lab/painless_lab.ts
```

Configs to run it:

```
node scripts/functional_tests --config x-pack/test/api_integration/deployment_agnostic/oblt.serverless.config.ts
node scripts/functional_tests --config x-pack/test/api_integration/deployment_agnostic/search.serverless.config.ts
node scripts/functional_tests --config x-pack/test/api_integration/deployment_agnostic/security.serverless.config.ts

node scripts/functional_tests --config x-pack/test/api_integration/deployment_agnostic/stateful.config.ts
```





PR is a compact version of #188737 with reduced changes in existing
serverless tests.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: elena-shostak <165678770+elena-shostak@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
2024-08-07 10:34:52 -05:00
Angela Chuang
644e8187f7
[SecuritySolution] Remove duplicated serverless tests (#188855)
## Summary

1. Apply https://github.com/elastic/kibana/pull/185870 for Security
Solution Explore and Investigation tests.
2. Remove duplicated tests.
3. Investigation/timeline/serverless tests are skipped atm.

How to run the api integration tests (Use Investigation Timeline ESS as
an example)
```
cd x-pack

node scripts/functional_tests_server.js --config ./test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/configs/ess.config.ts

// After server is started, open another terminal

cd x-pack

node ../scripts/functional_test_runner --config=test/security_solution_api_integration/test_suites/investigation/timeline/trial_license_complete_tier/configs/ess.config.ts
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-06 12:59:50 +01:00
elena-shostak
d839b03027
FTR http2 configs for security tests (#186444)
## Summary

Added FTR configs over http2 for security tests.

- `security_api_integration/oidc.http2.config.ts`
- `security_api_integration/saml.http2.config.ts`
- `security_functional/oidc.http2.config.ts`
- `security_functional/saml.http2.config.ts`

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

__Fixes: https://github.com/elastic/kibana/issues/184769__

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-21 20:27:24 +02:00
Pierre Gayvallet
dea26c6450
Add http2 support for Kibana server (#183465)
## Summary

Part of https://github.com/elastic/kibana/issues/7104

Add support for `http2` to the Kibana server. `http2` can be enabled by
setting `server.protocol: http2` in the Kibana config file.

*Note: by default, enabling `http2` requires a valid `h2c`
configuration, meaning that it can only run over HTTPS with TLS1.2+*

```yaml
## kibana.yaml
server.protocol: http2
server.ssl.enabled: true
server.ssl.key: path/to/key
server.ssl.certificate: path/my/cerf
```

## What is this PR doing

### Add HTTP2 support for the Kibana server

#### - Plug http2 to the Kibana server 

Even if HAPI was never officially updated to really support HTTP2,
node's `http`/`https`/`http2` modules are compatible enough to be able
to just instantiate an http2 server/listener and provide it to HAPI "as
a plain https listener". There were some tweaks to do (mostly silencing
a few warnings that HAPI was causing by sending http2-illegal headers
such as `Connection`), but overall, it went smoothly.

#### - Add config validation

By default, Kibana will require a valid `h2c` configuration to accept
enabling `http2`. It means that TLS must be enabled and that TLS1.2+
should at least be in the list of supported SSL protocols
(`server.ssl.supportedProtocols`). Note that default value of this
setting includes TLS1.2 and 1.3.

#### - Add escape hatch to run `h2` without `h2c`

In some situations, it may be required to enable http2 without a valid
`h2c` configuration. Kibana supports it, by setting
`server.http2.allowUnsecure` to `true`.

(*Note, however, that if http2 is enabled without TLS, ALPN protocol
negotiation won't work, meaning that most http2 agents/clients will fail
connecting unless they're explictly configured to use http2.*)

### Add documentation about this new feature

#### - Update the user-facing doc about this new `server.protocol`
setting

Update the user-facing Kibana settings documentation to include this
`http.protocol` setting (and refer to `server.http2.allowUnsecure`)

**Note: this setting, and this feature, are considered as experimental**

### Adapt our dev tooling to support running Kibana with http2 enabled

#### - Add a `--http2` flag to the dev CLI

Enabling this flag will add the proper configuration settings to run
Kibana with `http2` enabled in an (almost) valid `h2c` configutation.

*Note: when using this flag, even if listening on the same port, the
Kibana server will be accessible over https, meaning that you need to
use https in your browser to access it. Aka `http://localhost:5601`
won't work, you need to use `https://localhost:5601`. Also, we're using
the self-signed dev certificates, meaning that you must go though the
scary warning of your browser*

#### - Implement an http2-compatible base-path proxy

The current base path proxy is based on `hapi` and `hapi/h2o2`. I tried
for a bunch hours trying to hack around to make it work with http2
proxying, but ultimately gave up and implemented a new version from
scratch.

Note that with some additional efforts, this new http2 basepath proxy
could probably fully replace the existing one and be used for both http1
and http2 traffic, but it's an optimization / refactoring that did not
feel required for this PR.

### Adapt the FTR to run suites against http2

#### - Add support to run FTR test suite against an h2c-enabled Kibana

Note that with ALPN, clients using http1 should be (and are) able to
communicate with http2 Kibana, given h2c/alpn allows protocol
negitiation. So adapting our FTR tooling was not really about making it
work with http2 (which worked out of the box), but making it work with
**the self signed certifcates we use for https on dev mode**

Note that I'm not a big fan of what I had to do, however, realistically
this was the only possible approach if we want to run arbitrary test
suites with TLS/HTTP2 enabled without massively changing our FTR setup.

Operations and QA, feel free to chime in there, as this is your
territory.

#### - Change some FTR test suites to run against an HTTP2-enabled
server

I added a quick `configureHTTP2` helper function to take any "final" FTR
suite config and mutate it to enable `http2`. I then enabled it on a few
suites locally, to make sure the suites were passing correctly.

I kept two suites running with http2 enabled:
- the `console` oss functional tests
- the `home` oss functional tests

We could possibly enable it for more, but we need to figure out what
kind of strategy we want on that matter (see below)

## What is this pull request NOT doing

#### - Making sure everything works when HTTP2 is enabled

I navigated the applications quite a bit, and did not see anything
broken, however I obviously wasn't able to do a full coverage. Also, the
self-signed certificate was a huge pain to detect issues really caused
by http2 compared to issues because the local setup isn't valid `h2c`.

In theory though (famous last words) anything not doing http/1.1
specific hacks such as bfetch should work fine with http2, given that
even if using non-http2 clients, ALPN should just allow to fallback to
http/1.x (this part was tested)

#### - Enabling HTTP2 by default

PR isn't doing it for obvious reasons. 

#### - Enabling HTTP2 for all FTR suites

First of all, it's not that easy, because it requires adapting various
parts of the config (and even some var env...), and we don't have any
proper way to override config "at the end". For instance, if you add the
http2 config on a top level config (e.g. the oss functional one that is
reuse by the whole world - learned the hard way), it won't work because
higher-level configs redefined (and override) the `browser` part of the
config, loosing the settings added to run the browser in insecure mode.

Secondly, I'm not sure we really need to run that many suites with http2
enabled. I learned working on that PR that we only have like one suite
where https is enabled for the Kibana server, and I feel like it could
be fine to have the same for http2. In theory it's just a protocol
change, unless parts of our apps (e.g. bfetch) are doing things that are
specific to http/1.1, switching to http2 should be an implementation
detail.

But I'd love to get @elastic/kibana-operations and @elastic/appex-qa
opinion on that one, given they have more expertise than I do on that
area.

- Running performances tests

We should absolutely run perf testing between http/1.1 over https and
http/2, to make sure that it goes into the right directly (at least in
term of user perceived speed), but I did not do it in the scope of this
PR (and @dmlemeshko is on PTO so... 😅)

## Release Note

Add support for `http2` to the Kibana server. `http2` can be enabled by
setting `server.protocol: http2` in the Kibana config file.

Note: by default, enabling `http2` requires a valid `h2c` configuration,
meaning that it can only run over HTTPS with TLS1.2+

Please refer to the Kibana config documentation for more details.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-06-03 09:34:13 +02:00
Pierre Gayvallet
148eeec0fe
Update supertest and superagent to latest version (#183587)
## Summary

Related to https://github.com/elastic/kibana/issues/7104

Update supertest, superagent, and the corresponding type package, to
their latest version.

(of course, types had some signature changes and we're massively using
supertest in all our FTR suites so the whole Kibana multiverse has to
review it)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-17 04:23:21 -07:00
Stratoula Kalafateli
807da63c61
[ES|QL] Fetch the query columns utils (#182338)
## Summary

Revives this https://github.com/elastic/kibana/pull/181969

To do so, I had to create a new package `search-types` and move the
types I need there.

The Discovery team can take it from here.

Note: It also does a cleanup on the types I move, some of them were
declared twice.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-06 10:51:40 +02:00
Tre
46707e46de
[FTR] Mv test subjs svc to shared location (#174048)
## Summary

Refactoring general ui service to a kbn package.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-01-09 11:43:39 +00:00
Dzmitry Lemechko
f9a4962b48
[ftr] abort retry on invalid webdriver session (#174092)
## Summary

Since many our e2e tests use Retry service, we might have a situation
with retry running for some time (**20,30, 120 seconds** ) before
reaching timeout while browser already crashed and Webdriver is not
functioning properly.

This PR updates Retry service with checking error name before retry
attempt: if it is the WebDriver critical error, retry is aborted and we
fail test fast.

It should help with long useless logging messages as well:

Before:

```
         │ debg --- retry.try error: no such window: target window already closed
         │      from unknown error: web view not found
         │        (Session info: chrome=120.0.6099.129)
         │ debg Find.findByCssSelector('[data-test-subj="canvasExpressionInput"]') with timeout=10000
         │ debg --- retry.try failed again with the same message...
         │ debg Find.findByCssSelector('[data-test-subj="canvasExpressionInput"]') with timeout=10000
         │ debg --- retry.try failed again with the same message...
         ...
         │ERROR Browser is closed, no artifacts were captured for the failure
         └- ✖ fail: Canvas Canvas app expression editor shows autocomplete when typing
         │      retry.try timeout: NoSuchWindowError: no such window: target window already closed
         │ from unknown error: web view not found
         │   (Session info: chrome=120.0.6099.129)
         │     at Object.throwDecodedError (/Users/dmle/github/kibana/node_modules/selenium-webdriver/lib/error.js:524:15)
         │     at parseHttpResponse (/Users/dmle/github/kibana/node_modules/selenium-webdriver/lib/http.js:601:13)
         │     at Executor.execute (/Users/dmle/github/kibana/node_modules/selenium-webdriver/lib/http.js:529:28)
         │     at processTicksAndRejections (node:internal/process/task_queues:95:5)
         │     at Task.exec (prevent_parallel_calls.ts:28:20)
         │   Error: retry.try timeout: NoSuchWindowError: no such window: target window already closed
         │   from unknown error: web view not found
         │     (Session info: chrome=120.0.6099.129)
         │       at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
         │       at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
         │       at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
         │       at processTicksAndRejections (node:internal/process/task_queues:95:5)
         │       at Task.exec (prevent_parallel_calls.ts:28:20)
         │       at onFailure (retry_for_success.ts:17:9)
         │       at retryForSuccess (retry_for_success.ts:59:13)
         │       at RetryService.try (retry.ts:31:12)
         │       at Proxy.clickByCssSelector (find.ts:417:5)
         │       at TestSubjects.click (test_subjects.ts:164:5)
         │       at Context.<anonymous> (expression.ts:92:7)
         │       at Object.apply (wrap_function.js:73:16)
         │
         │
       └-> "after all" hook for "shows autocomplete when typing"
         │ debg unloading docs from archive at /Users/dmle/github/kibana/x-pack/test/functional/fixtures/kbn_archiver/canvas/default.json
         │ info deleting 1 objects { space: undefined }
         │ succ 1 saved objects deleted
       └-> "after all" hook: afterTestSuite.trigger for "shows autocomplete when typing"
         │ERROR Browser window is already closed
``` 

After:

```
         │ debg --- retry.try error: no such window: target window already closed
         │      from unknown error: web view not found
         │        (Session info: chrome=120.0.6099.129)
         │ERROR Browser is closed, no artifacts were captured for the failure
         └- ✖ fail: Canvas Canvas app expression editor shows autocomplete when typing
         │      Error: WebDriver session is invalid, retry was aborted
         │       at retryForSuccess (retry_for_success.ts:64:13)
         │       at RetryService.try (retry.ts:31:12)
         │       at MonacoEditorService.getCodeEditorValue (monaco_editor.ts:25:5)
         │       at Context.<anonymous> (expression.ts:83:34)
         │       at Object.apply (wrap_function.js:73:16)
         │
         │
       └-> "after all" hook for "shows autocomplete when typing"
         │ debg unloading docs from archive at /Users/dmle/github/kibana/x-pack/test/functional/fixtures/kbn_archiver/canvas/default.json
         │ info deleting 1 objects { space: undefined }
         │ succ 1 saved objects deleted
       └-> "after all" hook: afterTestSuite.trigger for "shows autocomplete when typing"
         │ERROR Browser window is already closed
     └-> "after all" hook in "Canvas app"
       │ debg set roles = superuser
       │ debg creating user test_user
       │ debg created user test_user
     └-> "after all" hook: afterTestSuite.trigger in "Canvas app"
       │ERROR Browser window is already closed
   └-> "after all" hook: afterTestSuite.trigger in "Canvas"
     │ERROR Browser window is already closed

5 passing (17.0s)
1 failing

1)    Canvas
       Canvas app
         expression editor
           shows autocomplete when typing:

      Error: WebDriver session is invalid, retry was aborted
       at retryForSuccess (retry_for_success.ts:64:13)
       at RetryService.try (retry.ts:31:12)
       at MonacoEditorService.getCodeEditorValue (monaco_editor.ts:25:5)
       at Context.<anonymous> (expression.ts:83:34)
       at Object.apply (wrap_function.js:73:16)


```
2024-01-02 22:01:26 +01:00
Yulia Čech
a29b0f4573
[Console] Add api integration tests for serverless (#172306)
## Summary

This PR adds api integration test for Console routes: some were missing
on stateful and all are now enabled on serverless.
2023-12-05 10:26:51 +01:00
Alejandro Fernández Haro
fd09c26d15
async-import plugins in the server side (#170856)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-15 00:55:56 -07:00
Paul Bianciardi
c72d4d3372
Update new codeowners for Obs team changes (#170182)
Updates new teams as codeowners for Observability team changes.

Also took the opportunity to:
- Delete some paths that no longer exist
- Split infra code ownership between teams (from #168992)
2023-11-08 14:30:17 +00:00
Maxim Palenov
58adee01a0
[Security Solution] Support Serverless Cypress tests with different roles (#169017)
**Addresses:** https://github.com/elastic/kibana/issues/164451

## Summary

This PR allows to run role based reused between ESS and Serverless Cypress tests.

## Details

The main idea behind is to make environmental differences for tests unnoticeable. As Serverless env already has roles and users but ESS env allows to create any possible role and user we just need to create Serverless roles and corresponding users + specific ESS roles and corresponding users in ESS env before running any ESS tests. This way tests will run in a similar env and don't have to bother by roles/users creation in test suites. This is achieved by using separate Cypress support files (Cypress includes `support/e2e.js` by default) `ess_e2e.ts` and `serverless_e2e.ts` executed for corresponding environments. `ess_e2e.ts` contains logic to create mentioned above roles and users while `serverless_e2e.ts` doesn't contain such logic.

_Only one user created per role and user has the same name as its corresponding role with `changeme` password._

To have an ability to create roles we need to store their definitions somewhere. It's also convenient to have JSON definitions instead of YAML. Plus Serverless roles should be pulled from `project-controller` repo but it's not addressed in this PR. I've chosen the following locations

- Serverless Security roles in `packages/kbn-es/src/serverless_resources/security_roles.json`. While `@kbn/es` is a common package it has `serverless_resources` folder containing `roles.yml` with a mix of `https://github.com/elastic/project-controller/blob/main/internal/project/observability/config/roles.yml`, `https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/roles.yml` and `https://github.com/elastic/project-controller/blob/main/internal/project/security/config/roles.yml` copied from `project-controller` and used for ES data restore. As there is no automation yet it looks logical to keep Security roles subset next to ES Serverless resources.
- ESS Security specific roles in `x-pack/plugins/security_solution/common/test/ess_roles.json`

On top of that the following has been done

- `reader` role replaced  with `t1_analyst` where possible in tests (besides `e2e/explore/cases/attach_alert_to_case.cy.ts` but it's purely ESS test so it's fine) as `reader` is ESS specific and make harder to run the same tests in ESS and Serverless environments but both roles are almost equivalent
- `login()` helper function accepts all known roles (Serverless + ESS) but throws an exception if a custom ESS role is used under Serverless env
- `x-pack/plugins/security_solution/server/lib/detection_engine/scripts/roles_users` isn't necessary anymore as `security_roles.json` + `ess_roles.json` contain all the necessary data to create roles and users

### Does it enable role support for MKI environments?

No. This PR only enabling role support for Non-MKI Serverless environments. MKI env has predefined roles but not users. This will be addressed in a follow up PR.

## Flaky test runner

Two unskiped in this PR Serverless Cypress tests using non default role `detection_response/detection_alerts/missing_privileges_callout.cy.ts` and `detection_response/prebuilt_rules/prebuilt_rules_install_update_authorization.cy.ts`  [150 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3723) 🟢 (there is one env related failure but it doesn't look related to the changes in this PR)
2023-10-31 09:39:47 -07:00
Alejandro Fernández Haro
5bbae7f14e
Add meta to the FTR logs to make them more actionable (#169456) 2023-10-26 10:37:58 +02:00
Dzmitry Lemechko
ac8d73ac6d
[ftr] fix test users for serverless (#161280)
## Summary

This PR fixes few issues occurring while running FTR API tests against
actual serverless project.

How to run:
```
TEST_CLOUD=1 ES_SECURITY_ENABLED=1 NODE_TLS_REJECT_UNAUTHORIZED=0 TEST_ES_URL=<your_es_url_with_credentials> TEST_KIBANA_URL=<your_es_url_with_credentials> node  --no-warnings scripts/functional_test_runner --es-version=8.9.0 --config x-pack/test_serverless/api_integration/test_suites/search/config.ts --bail
```

The first error is faced during Elasticsearch version validation

```
ERROR Error: attempted to use the "es" service to fetch Elasticsearch version info but the request failed: ResponseError: {"ok":false,"message":"Unknown resource."}
          at SniffingTransport.request (/Users/dmle/github/kibana/node_modules/@elastic/transport/src/Transport.ts:535:17)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at Client.InfoApi [as info] (/Users/dmle/github/kibana/node_modules/@elastic/elasticsearch/src/api/api/info.ts:60:10)
          at FunctionalTestRunner.validateEsVersion (functional_test_runner.ts:129:16)
          at functional_test_runner.ts:64:11
          at FunctionalTestRunner.runHarness (functional_test_runner.ts:251:14)
          at FunctionalTestRunner.run (functional_test_runner.ts:48:12)
          at log.defaultLevel (cli.ts:112:32)
          at run.ts:70:7
          at withProcRunner (with_proc_runner.ts:29:5)
          at run (run.ts:69:5)
          at FunctionalTestRunner.validateEsVersion (functional_test_runner.ts:131:13)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
          at functional_test_runner.ts:64:11
          at FunctionalTestRunner.runHarness (functional_test_runner.ts:251:14)
          at FunctionalTestRunner.run (functional_test_runner.ts:48:12)
          at log.defaultLevel (cli.ts:112:32)
          at run.ts:70:7
          at withProcRunner (with_proc_runner.ts:29:5)
          at run (run.ts:69:5)
```

Since there is no version term in case of serverless, we can skip
version check by using newly added to FTR schema `serverless` property
(`false` by default). It is set to `true` in root FTR config
`/shared/config.base`.

The next error is related to ESArchiver relying on `ES` FTR service to
provide ESClient.

```
ResponseError: security_exception
   │ 	Root causes:
   │ 		security_exception: unable to authenticate user [system_indices_superuser] for REST request [/kibana_sample_data_flights]
```

It is fixed by using the default user (from host url) instead of
`system_indices_superuser` we use in stateful run.
2023-07-10 10:09:07 +02:00
Lukas Olson
4b7d18b5c3
[bfetch] Use versioned router (#161317)
## Summary

Part of https://github.com/elastic/kibana/issues/157095.

Uses the new versioned router capabilities for the bfetch plugin.

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 16:48:02 -07:00
Matthew Kime
26d4ba5c3e
[data views] Use versioned router for REST routes (#158608)
## Summary

Version alllll the data view routes.

Best viewed with whitespace hidden -
https://github.com/elastic/kibana/pull/158608/files?diff=unified&w=1

In this PR:
- All REST (public and internal) routes are versioned
- Internal routes are called with version specified
- Internal and public routes are now stored in directories labeled as
such
- All routes have a response schema
- All responses are typed with `response` types, separate from internal
api types. This is to help prevent unacknowledged changes to the api.
- Moves some functional tests from js => ts

For follow up PRs:
- Move to `internal` path for internal routes
- Proper typing and schema for `fields_for_wildcard` filter

Closes https://github.com/elastic/kibana/issues/157099
Closes https://github.com/elastic/kibana/issues/157100

---------

Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
2023-06-12 22:01:03 -05:00
Lukas Olson
34ada8a9a6
[data.search] Use versioned router (#158520)
## Summary

Step 1 of https://github.com/elastic/kibana/issues/157095.

Uses the new versioned router capabilities for the search routes (`POST`
and `DELETE`).

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
2023-06-07 10:33:39 +02:00
Rachel Shen
50a4fc4916
[Shared UX] Adoption of Shared UX Route component (#150357)
## Summary

This PR removes all imports of Route from react-router-dom and
'@kbn/kibana-react-plugin/public' and instead imports Route from
@kbn/shared-ux-router.

### Context
Based on
https://github.com/elastic/kibana/issues/132629#issue-1243243678 This PR
executes steps 2 - 4:

> 2. To make the transition easier, we want to re-export other
react-router-dom exports alongside the modified' Route'.
> 3. Solutions should start using that Route component in place of the
one from react-router-dom. I.e. replace all occurrences of import { ...
} from 'react-router-dom' with import { ... } from
'@kbn/shared-ux-router'.
> 4. All manual calls to useExecutionContext are not needed anymore and
should be removed.

### Future PR

Looks like this might be getting worked on in:
https://github.com/elastic/kibana/pull/145863 (thanks!)

> Introduce an ESlint rule that ensures that react-router-dom is not
used directly in Kibana and that imports go through the new
@kbn/shared-ux-router package.

This is tangentially accomplished through
https://github.com/elastic/kibana/pull/150340 but only addresses using
Route through @kbn/kibana-react-plugin/public'


### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
2023-02-14 19:25:04 +00:00
Spencer
1b85815402
[packages] migrate all plugins to packages (#148130)
Fixes https://github.com/elastic/kibana/issues/149344

This PR migrates all plugins to packages automatically. It does this
using `node scripts/lint_packages` to automatically migrate
`kibana.json` files to `kibana.jsonc` files. By doing this automatically
we can simplify many build and testing procedures to only support
packages, and not both "packages" and "synthetic packages" (basically
pointers to plugins).

The majority of changes are in operations related code, so we'll be
having operations review this before marking it ready for review. The
vast majority of the code owners are simply pinged because we deleted
all `kibana.json` files and replaced them with `kibana.jsonc` files, so
we plan on leaving the PR ready-for-review for about 24 hours before
merging (after feature freeze), assuming we don't have any blockers
(especially from @elastic/kibana-core since there are a few core
specific changes, though the majority were handled in #149370).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-08 21:06:50 -06:00
Thomas Watson
50444bbd59
Change default value of csp.disableUnsafeEval to 'true' (#150157)
This change ensures that the `unsafe-eval` source expression isn't included in
the Kibana Content Security Policy (CSP) by default.

Users can set `csp.disableUnsafeEval: false` to reintroduce `unsafe-eval`.
However, since this config option is deprecated as of this commit, it's
recommended to instead set `csp.script_src: ['unsafe-eval']`.

Closes #150156
2023-02-07 07:07:13 -05:00
Spencer
c8f83ed2eb
Move real plugins out of 'fixtures' dirs (#148756)
The location of plugins was previously somewhat irrelevant, but as we
move into packages it's more important that we can find all plugins in
the repository, and we would like to be able to do that without needing
to maintain a manifest somewhere to accomplish this. In order to make
this possible we plan to find any plugin/package by spotting all
kibana.json files which are not "fixtures". This allows plugin-like code
(but not actual plugin code) to exist for testing purposes, but it must
be within some form of "fixtures" directory, and any plugin that isn't
in a fixtures directory will be automatically pulled into the system
(though test plugins, examples, etc. will still only be loaded when the
plugin's path is passed via `--plugin-path`, the system will know about
them and use that knowledge for other things).

Since this is just a rename Operations will review and merge by EOD Jan
12th unless someone has a blocking concern.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-12 12:38:49 -07:00
Dzmitry Lemechko
bc2cb5dc61
[code coverage] removing instrumentation & plugin for functional tests (#148748)
## Summary

Quite awhile ago we decided to stop collecting code coverage for our
functional (e2e, api integration) FTR tests.
This is a cleanup PR to remove the code we no longer use.


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2023-01-12 16:44:48 +01:00
John Dorlus
20ebb175df
Added Rollups CCS Test (#144074)
* Removed comment of the issue that was referenced for the skip. But the tests were already skipped.

* Unskipping test as a fix has been made. 138510

* Made CCS test for rollups and made it conditional based on configuration.

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fixed issues in build.

* Added comment to rollups test and using super user until the perms issue is fixed.

Co-authored-by: cuffs <cuffs@cuffss-Office-MacBook-Pro.local>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-10-28 15:20:50 -04:00
Spencer
50b3b57d9e
[ftr] add first-class support for playwrite journeys (#140680)
* [ftr] add first-class support for playwrite journeys

* [CI] Auto-commit changed files from 'node scripts/generate codeowners'

* fix jest test

* remove ability to customize kibana server args, if we need it we can add it back

* remove dev dir that doesn't exist

* fix typo

* prevent duplicated array converstion logic by sharing flag reader

* remove destructuring of option

* fix scalability config and config_path import

* fix start_servers args and tests

* include simple readme

* fix jest tests and support build re-use when changes are just to jest tests

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-09-22 01:06:46 -07:00
Dzmitry Lemechko
7b0033f68c
[scalability testing] store relative path to kbnArchives/esArchives in dataset extractor output file (#139891)
* update journeys, save testData in output json

* fix config inheritance

Co-authored-by: spalger <spencer@elastic.co>
2022-09-01 18:34:40 +02:00
Tim Sullivan
160058a8c1
[search/public] expose showWarnings(inspector) method on search service (#138342)
* add showWarning to search service

* add comments

* add unit tests

* test foo

* cleanup

* add s to property name in test

* comments for api items

* use the warnings when calling showWarnings

* change showWarning to just show a single warning

* put handleWarnings on the request adapter

* comment

* simplify 1

* fix lens unit test

* remove underscoring for unused variables

* revert inspector changes, extract the response warnings in the search service

* fix bug

* remove console.log

* re-apply typescript fixes to app test code

* declutter

* add test, improve comments

* fix some unexported public api items

* include rawResponse in the warning structure

* fix lint

* tweak clean up example app

* SearchResponseWarnings and SearchResponseWarningNotification

* fix export bug

* not include shardStats if there are no warnings

* Update src/plugins/data/common/search/types.ts

* simplify SearchResponseWarnings interface

* remove array copying

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* comments for api_docs

* simplify per feedback

* Pass callback to handleResponse in showWarnings

* export more public types

* update example to make possible to show shard failure

* pr cleanup

* eslint fix

* allow example app to not show default warnings

* move extractWarning and related types to inspector plugin

* wip functional test of example app

* fix test references

* finish functional test

* relocate extractWarnings back to search/fetch

* fix test

* remove need for isTimeout, isShardFailure

* ts fix

* improve test

* Change showWarnings to accept the RequestAdapter

* use showWarnings in vis_types/timeseries

* more tests

* use handle_warning name

* fix ts

* add reason field to SearchResponseWarning

* fix component snapshot

* update comments

* test cleanup

* fix test

* ensure notification appears only once

* fix and cleanup

* fix ts

* fix response.json bug

* use top-level type, and lower-level reason.type

* cleanup

* fix shard failure warning in tsvb per feedback

cc @flash1293

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
2022-08-31 11:22:24 -07:00
Carlos Crespo
b58d07e05b
[Stack Monitoring] Add OpenTelemetry metrics to Monitoring Collection plugin (#135999)
* Add otel metrics to alerting plugin

* clean up otel poc

* Bump @opentelemetry/api-metrics and @opentelemetry/exporter-metrics-otlp-grpc versions to 0.30.0

* Add integration test for prometheus endpoint; improve reademe.md

* Fix tsconfig.base.json missing entries

* Bump @opentelemetry/sdk-metrics-base; clean up

* Rename PrometheusExporter properties

* Readme formatting tweaks

* Fix incorrect path

* Remove grpc dependency

* Add grpc back for handling auth headers

* Fix comment positioning

* Include authenticated OTLP in readme

* Extract dynamic route into a new file

* Enable otlp logging and compatibility with env vars

* Enable OTEL_EXPORTER_OTLP_ENDPOINT env var

Co-authored-by: Mat Schaffer <mat@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-14 13:29:09 +02:00
Spencer
f5688a68a5
[ftr] rework kibana arg parsing, extend loggers correctly (#135944) 2022-07-08 08:54:56 -05:00
Thomas Watson
dc9f2732a1
Add csp.disableUnsafeEval config option to remove the unsafe-eval CSP (#124484)
Adds a new experimental Kibana setting called `csp.disableUnsafeEval` which will default to `false`. When set to `true`, it will remove `unsafe-eval` from our CSP.

Also introduces a new module called `@kbn/handlebars` which is a replacement for the official `handlebars` module used in the frontend. This new module is necessary in order to avoid calling `eval`/`new Function` from within `handlebars` which is not allowed once `unsafe-eval` is removed from our CSP.

The `@kbn/handlebars` module is simply an extension of the main `handlebars` module which adds a new compile function called `compileAST` (as an alternative to the regular `compile` function). This new function will not use code-generation from strings to compile the template but will instead generate an AST and return a render function with the same API as the function returned by the regular `compile` function.

This is a little bit slower method, but since this is only meant to be used client-side, the slowdown should not be an issue.

The following limitations exists when using `@kbn/handlebars`:

The Inline partials handlebars template feature is not supported.

Only the following compile options will be supported:
- `knownHelpers`
- `knownHelpersOnly`
- `strict`
- `assumeObjects`
- `noEscape`
- `data`

Only the following runtime options will be supported:
- `helpers`
- `blockParams`
- `data`

Closes #36311
2022-05-23 11:01:56 -07:00
Spencer
f3d69b8197
[@kbn/dev-utils] break out more pieces (#132292)
* [@kbn/dev-utils] break out more pieces

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-05-17 11:19:20 -05:00
Dzmitry Lemechko
80427ea1ba
[scalability testing] extend FTR config with optional scalability configuration (#132047)
* [scalability testing] extend FTR config

* update schema with defaults for testData
2022-05-11 20:29:30 +02:00
Pierre Gayvallet
e4c11e3f39
Newsfeed: always use feeds.elastic.co (#131786)
* Newsfeed: always use `feeds.elastic.co`

* fix FTR test
2022-05-10 09:16:15 +02:00
Spencer
2a78f350e1
break out parts of @kbn/dev-utils (#130509)
* break out parts of @kbn/dev-utils

* autofix imports and kbn/pm dist

* update readme for @kbn/stdio-dev-helpers

* finish renames
2022-04-19 12:24:58 -05:00
spalger
3730dd0779 fix all violations 2022-04-16 01:37:30 -05:00
Dmitry Tomashevich
0427952e76
[Discover] Extend Elasticsearch query rule with search source based data fetching (#124534)
* [Discover] introduce .index-threshold rule

* [Discover] change filters in alert expression

* [Discover] fix cursor issue

* [Discover] add loading

* [Discover] separate validation params

* [Discover] add view alert route

* [Discover] enable "view in app" for alert created from discover

* [Discover] fix filter popover

* [Discover] fix linting, unit tests

* [Discover] fix remaining tests

* [Discover] add unit tests, add link back to stack management for es query

* Update src/plugins/discover/public/application/view_alert/view_alert_route.tsx

* [Discover] add tool tip for data view without time field

* [Discover] add info alert about possible document difference that triggered alert and displayed documents

* [Discover] update unit test

* [Discover] fix unit tests

* Update x-pack/plugins/stack_alerts/public/alert_types/es_query/expression/search_source_expression.tsx

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type/alert_type.ts

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type/alert_type.ts

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type/alert_type.ts

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update src/plugins/discover/public/application/main/components/top_nav/open_alerts_popover.tsx

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/stack_alerts/public/alert_types/es_query/expression/search_source_expression.tsx

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* [Discover] fix unit tests

* [Discover] fix security solution alerts

* [Discover] fix eslint errors

* [Discover] fix unit tests

* Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type/alert_type.ts

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type/alert_type.ts

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* [Discover] apply suggestions

* [Discover] fix tests

* Update x-pack/plugins/stack_alerts/server/alert_types/es_query/alert_type/alert_type.ts

* [Discover] remove close button in filters

* Improve code structure

* Fix missing name in fetchEsQuery

* Fix messages

* Fix messages, again

* Refactor

* Refactor, add tests + a bit more of documentation

* Move size field, change text

* Implement readonly callout

* change icon in callout

* add padding to popover

* Hide query and filter UI if there are no values to display

* [Discover] add unit test, improve comparator types

* [Discover] fix linting and unit test

* [Discover] add es query alert integration tests

* [Discover] fix linting

* [Discover] uncomment one expect

* [Discover] fix latesTimestamp for searchSource type, unify test logic

* Update x-pack/plugins/stack_alerts/public/alert_types/es_query/expression/search_source_expression.tsx

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* [Discover] apply suggestions

* [Discover] make searchType optional, adjust tests

* [Discover] remove updated translations

* [Discover] apply suggestions

* [Discover] fix unit test

* [Discover] close popover on alert rule creation

* [Discover] apply suggestions

* [Discover] add first functional test

* [Discover] implement tests

* Move functionals x-pack since ssl is needed

* Fix potential flakiness in functional test

* [Discover] remove timeout waiter

* Fix functional test

- adding permissions to fix the functional

* [Discover] add logger

* [Discover] add more log points

* [Discover] wait for indices creation finished

* Try to fix the functional flakiness
- by creating data views in a serial way
- lets see if that work

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: andreadelrio <andrea.delrio@elastic.co>
2022-04-01 14:57:57 +05:00
Spencer
0821c31fa5
[ftr] implement support for accessing ES through CCS (#126547)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-07 15:27:41 -07:00
Spencer
be1028c345
[functional/security/test-user] remove naked boolean (#126652)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-03 08:56:56 -07:00
Robert Oskamp
befefc3347
FTR - check ES security before creating system_indices_superuser (#124948)
This PR adds a check if ES security is enabled before creating the system_indices_superuser in the security service.
2022-02-08 16:32:10 +01:00
Robert Oskamp
8989ead2d6
Functional test runner creates system_indices_superuser (#124008)
This PR fixes the functional test runner for execution against cloud (and other existing deployments) by making sure the system_indices_superuser exists.
2022-02-04 11:23:47 +01:00
Matthew Kime
f3ff2291f5
less deprecated index pattern apis (#124313) 2022-02-02 10:39:59 -06:00
Alejandro Fernández Haro
7dedc8871c
[Fixtures/Newsfeed] Server-side importing public types (#123923) 2022-01-27 17:08:25 +01:00