Commit graph

67455 commits

Author SHA1 Message Date
natasha-moore-elastic
62e087a8a8
[DOCS] Makes shards optional in Create pack API (#166639)
## Summary

* Resolves https://github.com/elastic/security-docs/issues/3822.  

* Updates the `shards` object in Create pack API to optional for 8.10.1
and 8.11.0 onwards, per https://github.com/elastic/kibana/pull/166178

* Related to changes made in
https://github.com/elastic/kibana/pull/166363.
2023-09-25 11:38:41 +01:00
Kibana Machine
e44362feae skip failing test suite (#151854) 2023-09-25 06:24:07 -04:00
Cauê Marcondes
9cbd597ebb
[Profiling] Fix set up process (#167067)
So clients reported that they got stuck in the set up screen In the
Universal Profling UI. And when the set up button was clicked an error
happened:

```
An integration policy with the name elastic-universal-profiling-collector already exists. Please rename it or choose a different name.
```

This happens because when we were checking if the Collector and
Symbolizer integrations were installed we weren't taking into
consideration that the Fleet API is paginated. So if neither integration
was available on the first page we just assumed the Profiling wasn't set
up.

This PR fixes it by adding a kuery filter in the Fleet API call to only
look for out integrations. So we don't need to worry about paginating.
2023-09-25 10:51:03 +01:00
Maxim Kholod
e6cbe509a0
[Cloud Security][Fleet] fix broken k8s manifest link (#167059)
## Summary

fixes:
- https://github.com/elastic/kibana/issues/166931

The issue was introduced in
https://github.com/elastic/kibana/pull/165127/files#diff-276f84c47e09954d668b83d633d87edc09406b69603dac7e63964b70e2342af1R120

### 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
2023-09-25 11:17:10 +02:00
Alex Szabo
d601747e3a
fix: Fix hash on changed sha key (#167116)
## Summary
Infra updated the GPG keys for elastic, so we need to adjust the hash of
the gpg key.

more context:
https://elastic.slack.com/archives/C0D8P2XK5/p1695621791855459
2023-09-25 11:16:45 +02:00
Dmitrii Shevchenko
38e6b76640
[Security Solution] Extract OpenAPI codegen to a package (#166269) 2023-09-25 10:51:40 +02:00
Maxim Kholod
c7f49c200c
[Cloud Security] fix ingest pipeline for benchmark scores index (#166966)
## Summary

during the [ILM fix](https://github.com/elastic/kibana/pull/165317) for
serverless the default pipeline for the scores index was also changed by
mistake. Reverting this change


### Checklist

- [ ] [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
2023-09-25 09:46:51 +02:00
Ido Cohen
48d293f29a
[Cloud Security] Fix wrong fleet url in cloudFormation (#166130)
solves:
- https://github.com/elastic/security-team/issues/7482

choose the correct Fleet URL in case there is more than one fleet
server.

---------

Co-authored-by: Maxim Kholod <maxim.kholod@elastic.co>
2023-09-25 09:44:55 +02:00
Stratoula Kalafateli
14e4987ae6
[ES|QL] Fixes words wrapping (#167025)
## Summary

Fixes https://github.com/elastic/kibana/issues/166648

<img width="2083" alt="image"
src="0374c577-dc52-4453-b220-a6dfc12d79e3">
2023-09-25 00:38:46 -07:00
Gerard Soldevila
b98b6d08cd
Fix flakiness on custom time range saved searches (#165454)
A bunch of tests on dashboards are customising some of the panels
settings and providing custom time ranges:

<img width="409" alt="image"
src="c869c1a3-f7db-4ccd-ad00-c5403f2b4201">

Currently, the logic is not waiting for the quick toggle animation to
complete, before proceeding to select a time range.
This can cause a flaky behavior if the logic tries to customize the
range before the button is actually available, as seen on [this failed
test](018a4c46-0e7a-4b69-9a3d-9c54c27165b0_4fcbc47e71644919129e320eea8bb3bc.html?response-content-type=text%2Fhtml&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQPCP3C7LZWZ5UB5F%2F20230901%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230901T094837Z&X-Amz-Expires=600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEB0aCXVzLWVhc3QtMSJGMEQCIGCyKcVLGPUawZubNzZdt5oZNb5v0saiIuPqXwI7rmwlAiAsOj%2Fiep94v%2BYZJtLY3Gw0m%2FmK5mJw2IcIBdNKFXgK%2BCr6Awjm%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDAzMjM3OTcwNTMwMyIMXOd1Hm6ks%2FNE37V0Ks4DgMUso7syv87hnPcC%2BB1soxvFFnj4JnNZc6ZgkLUe93z99iPFBUsqH%2BRbUTfSbjVOEJYBKGYuvp32xvSWsYNVPXKmcej18LC0yNi%2BBzoG2X%2Bj80g%2BbGMm6YfTncjPhOE0CHHqOWXts9nQ8WpDy8XOl0zfMtuiPjzOXHo9lvw2mgYDZIJIMV72FYB9JGg8FPbLQtD3rysLGNE0VDKgl5LCnYwhY1pwRCRHnVW41QfV0pwK%2FbjNf9HjdK31LQvMY%2FGPuB3M6O2CUZLsvLGfWBeGYHtkqb0hrL9ijO1Uo28ZSS1FytPftEdF0e1kAC9C5zD56HtYm55aktOWtaaC0XPWLdWWGUq%2FKQzhxSCiXK6ovATU3zI3yPNoZs92YBYmIPMOpEI40dCCpksjPwAMCiQd%2F9gMNKP5Qp5CbYd2Khy%2FeXaT8J7HOZCueN63O0j%2FtX1tbwfznhbr74lAcRQjueRYmwboZaGSDZUQ33lSSmyZk1V9WF9eJyt88oHvIx0q9bIjvOlW05DiNKfEFWYwfBywdGuvRU6eGMs1QcDNu33Lb%2BhymudM2JZmQKIjZOcb2l3Fzctp614owH4JcRlmF4%2BIa4xHeBdRlTMysS8bTIsgMK7axacGOqYBzIpC1wgZWJ1kZ0agLWCNaMIdUl%2B4xrr7w%2Fz0843WWMhRrvbJhDTHqk5UclF%2FSROAMe0FH2XEXiQ65ILyUPlrUMels5tfQ3Pp%2FJWPi9NsQJUQ1n9uLN%2BFPDOoMo8Uxg4%2FkG2O7yTkrIdArfA6pWN9I21gFMW%2BFZy9BMYltt5T65ZKOyYAIFGpLhgfBySIBCUMgwR1kusfDhf1%2FRTvtDKD2sJKN5a0IA%3D%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=35fabe908aa7514e4a92de0ed12973af85ccfb439984fc3bdd7ef3bb8fe3419b).
(part of this [failed CI
build](https://buildkite.com/elastic/kibana-pull-request/builds/155285#018a4c46-0e7a-4b69-9a3d-9c54c27165b0))

The goal of this PR is to add a small waiting period, to make sure the
toggle animation has completed, and that the time range controls are
visible and clickable.

I used the opportunity to cleanup some "await delay millis" calls,
reusing existing logic instead.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-25 09:32:57 +02:00
Kibana Machine
823a1d542b
[api-docs] 2023-09-25 Daily api_docs build (#167109)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/471
2023-09-25 00:54:39 -04:00
Kibana Machine
780e05b7a9
[api-docs] 2023-09-24 Daily api_docs build (#167103)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/470
2023-09-24 00:52:01 -04:00
Kibana Machine
a940b28461
[api-docs] 2023-09-23 Daily api_docs build (#167102)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/469
2023-09-23 00:52:35 -04:00
Kibana Machine
79e1508e7c skip failing test suite (#167094) 2023-09-22 19:52:26 -04:00
Kibana Machine
ae90171637 skip failing test suite (#167090) 2023-09-22 17:06:40 -04:00
Lola
1f9f572219
[Cloud Posture]remove cnvm from benchmarks (#162337)
## Summary

Remove CNVM  package policies from  the benchmarks rules page 
[Quick Win]()
<img width="1380" alt="Screen Shot 2023-07-20 at 11 17 04 AM"
src="e8d2d161-3c77-4fdb-ae0a-dcf7512e5a10">
2023-09-22 13:08:53 -07:00
Kibana Machine
180a823b7c skip failing test suite (#167081) 2023-09-22 15:53:37 -04:00
Hannah Mudge
bafb23580b
[Controls] Use new panelMinWidth prop in popovers (#165397)
Closes https://github.com/elastic/kibana/issues/164375

## Summary

This PR wraps up https://github.com/elastic/kibana/pull/162651 by fully
migrating to the `EuiInputPopover` for all controls - specifically, this
is made possible by the new `panelMinWidth` prop, which makes it so that
the popover can now extend past the size of the input **while
maintaining** the expected positioning.

| Before | After |
|--------|--------|
| The popover was centered underneath the control on the smallest
size:<br><br>![image](e2814ee2-6df6-47d6-925e-9f97cb8be2a5)
| The popover is left-aligned with the start of the input and expands to
the
right:<br><br>![image](7c698ef0-1534-43b6-ac95-9ae95f1c7613)
|
| The range slider popover could not extend past the control width,
regardless of how small that
was:<br><br>![image](12e33967-b616-4f0a-9ded-4374d65a51b2)
| The range slider popover now also has a minimum width, which makes it
more useable on the smallest
size:<br><br>![image](2fb844db-8f5d-44d8-a6dc-c9cb95d5a4ea)
|

### 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
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-22 13:02:48 -06:00
Maxim Palenov
5c7b57c88a
[Security Solution] Refactor Cypress tests navigation utilities (#166201)
**Relates to:** https://github.com/elastic/kibana/issues/153645

## Summary

This PR makes refactoring of navigation utilities and constants to make it transparent and be able to specify correct ownership later on.

## Motivation

Engineers need to add new tests and maintain the older ones. Base building blocks of this are constants and utility functions in particular URL constants and `visit()` and `visitWithoutDataRange()` functions. It turned out a simple `visit()` helper function also passes `timerange` as a query param while only some tests need it. Having it as a base utility function (as the name suggests) it also gets used in the new code while `visitWithoutDateRange()` should be preferred. On top of that URL constants are combined in one file without clear ownership and contain a mix of legacy and new urls with some parts looking outdated as navigating to the url causes redirecting to a specific page.

Having only relevant URL constants in a common file will help to reduce confusion. As the next step constants should be split into files/folders with clear ownership.

Also having `visit()` adding no extra params (besides common for ALL the tests) will make the intention clear. Whenever a time range is needed `visitWithTimeRange()` can be used (ideally accepting a time range defined in a test). And the same stays true for any other pages, e.g. rule details page can have a utility `visitRuleDetailsPage(id: string)` containing some general waiting logic so the following actions operate on a loaded page.

## Details

As a step towards clearness and transparent ownership this PR performs refactoring of `x-pack/test/security_solution_cypress/cypress/urls/navigation.ts` and `x-pack/test/security_solution_cypress/cypress/tasks/login.ts` files. The following has been done

- all url constants in `x-pack/test/security_solution_cypress/cypress/urls/navigation.ts` were checked and updated to remove duplications, avoid redirections and grouped
- legacy urls were moved to the only one test using them to test compatibility (`x-pack/test/security_solution_cypress/cypress/e2e/urls/compatibility.cy.ts`)
- `visit()` was renamed to `visitWithTimeRange()`
- `visitWithoutDateRange()` was renamed to `visit()`
- `visit()` was refactored to accept a query string

## Next steps

It's expected teams decompose `x-pack/test/security_solution_cypress/cypress/urls/navigation.ts` into feature specific file(s)/folder(s) with assigned owners.

There is no 100% chance a generic wait for a page to be loaded helper function meet requirements for each page. It makes sense to consider adding per feature `visitFeatureAPage()` helper function containing assertions for the page to be loaded. `visitRuleDetailsPage(id: string)` was added for this purpose while waiting for page to be loaded functionality is omitted in this PR to reduce a number of changes.
2023-09-22 12:01:00 -07:00
Kibana Machine
13b37aaa47 skip failing test suite (#167076) 2023-09-22 13:51:15 -04:00
Kibana Machine
d16abe3e44 skip failing test suite (#167073) 2023-09-22 12:42:10 -04:00
Gloria Hornero
1f74f23940
[Security Solution] Preparing Cypress to be able to execute on a real serverless environment (#166905)
Co-authored-by: YulNaumenko <jo.naumenko@gmail.com>
Co-authored-by: Sergi Massaneda <sergi.massaneda@gmail.com>
2023-09-22 18:26:21 +02:00
GitStart
101bd8d835
[Search Profiler] Migrate all usages of EuiPage*_Deprecated (#163131) 2023-09-22 11:55:34 -04:00
Yulia Čech
213ef5686b
[Index Management] Fix encoding issue on index details page (#166882)
## Summary
Fixes https://github.com/elastic/kibana/issues/166100

This PR adds a workaround fix for the new index details page when
opening for index names with special characters, for example
`test_index%`. Because of how encoding/decoding works, we can't use the
index name as a part of the url like `/indices/${indexName}` (see for
more details). Instead we have to pass the index name in a query
parameter like `/indices/index_details?indexName=${indexName}. The
downside of this workaround is that the url semantics doesn't reflect
that the index name is mandatory for the page to work. Once
https://github.com/elastic/kibana/issues/132600 is resolved, we should
revert this workaround and use the index name as a url segment again.

Note for reviewers: The jest tests for this fix are part of
https://github.com/elastic/kibana/pull/165705

### How to test
1. Add `xpack.index_management.dev.enableIndexDetailsPage: true` to the
file `config/kibana.dev.yml` to enable the new index details page
2. Navigate to Index Management and use the "create index" button 
3. Type a name with special characters, for example `test%`
4. Click the new index name in the list and check that the details page
and all tabs work
5. Also reload the page completely and check that the page still loads
correctly

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
2023-09-22 08:19:02 -07:00
Walter Rafelsberger
cdaa3d3851
[ML] Transforms: Enable SLO transforms installer on CI (#165470)
## Summary

This enables the installer for SLO transforms on CI.

- For the `many_fields_transform` performance journey, it will then look
for the "Create transform" on top of the table instead of the "Create
your first transform" button. Command to test the performance journey:
`node scripts/run_performance.js --journey-path
x-pack/performance/journeys/many_fields_transform.ts --skip-warmup`
- For the functional tests that assert the empty transform list, this
adds a command to delete all transforms before running those tests.
2023-09-22 17:13:38 +02:00
Maxim Palenov
f52ca02a3d
[Security Solution] Unskip related integrations Cypress tests in ESS (#166659)
**Related to: https://github.com/elastic/kibana/issues/165359**
**Resolves: https://github.com/elastic/kibana/issues/165504**

## Summary

This PR unskips skipped rule integrations ESS tests.

## Details

Besides just unskipping ESS tests this PR simplifies the test by fetching alert data from the ES directly instead of using multiple steps in UI to validate an expected field has an expected value.

## Flaky test runner

ESS [related_integrations.cy.ts 100 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3199) 🟢
2023-09-22 06:42:41 -07:00
Stratoula Kalafateli
884bcb2625
[ES|QL] Fixes error in new metric when breakdown is a number (#167018)
## Summary

In ES|QL we don't have field formatters. We just have the type of the
field (number/date etc).

If you are in Discover and write a query which returns only one
column/row then the new metric is suggested.

<img width="1990" alt="image"
src="79650d4b-f0c9-476b-b050-617653ccc993">

If for whatever reason the user goes to breakdown and selects the same
number variable (try_new) the chart will fail to render and you will see
in the console an error.

This happens because EC wait the title to be string but here as we don't
have field formatters this is number and fails.
2023-09-22 15:59:59 +03:00
Alex Szabo
e2a7157071
[RAM] Correct renamed function after a race-condition merge (#167026)
## Summary
There was an accidental race-condition on a variable re-name and usage
between https://github.com/elastic/kibana/pull/166032 &
https://github.com/elastic/kibana/pull/166603.

This PR intends to correct that.
2023-09-22 14:21:01 +02:00
Yngrid Coello
2091870c5d
[Logs onboarding] Getting elastic-agent version from fleet (#166920)
Closes https://github.com/elastic/kibana/issues/165657.

In https://github.com/elastic/kibana/pull/166811 we exposed the value of
latest agent version available, with this PR we are aiming to use that
value as the `elastic-agent` version used in the installation script of
onboarding flow.

### How to test
1. Enter [System logs
onboarding](https://yngrdyn-deploy-kiban-pr166920.kb.us-west2.gcp.elastic-cloud.com/app/observabilityOnboarding/systemLogs)
2. Verify the elastic agent version in the installation script
<img width="870" alt="image"
src="c2d99244-6e5a-4d2e-a3fd-eea6041636d2">

3. Go to the
[console](https://yngrdyn-deploy-kiban-pr166920.kb.us-west2.gcp.elastic-cloud.com/app/dev_tools#/console)
4. Execute `GET /`
5. Verify Kibana version

As you can see the kibana version is an snapshot but the elastic agent
version proposed is the latest one released `8.10.1` allowing us to
construct a valid download url like
https://artifacts.elastic.co/downloads/beats/elastic-agent/8.10.1-linux-x86_64.tar.gz
2023-09-22 03:42:19 -07:00
Shahzad
f5ab4979a9
[Synthetics] Fix confusing labels for status alert toggle (#166918)
## Summary

 Fix confusing labels for status alert toggle

removed the Disabled wording from toggle 

<img width="1473" alt="image"
src="811cea3f-b3bd-4e65-bd48-317d259c8696">
2023-09-22 12:24:39 +02:00
Carlos Crespo
7eb34b2f38
[Infra UI] Fix redirection to Node Details page from Inventory UI (#166821)
fixes https://github.com/elastic/kibana/issues/166818
fixes https://github.com/elastic/kibana/issues/164164

## Summary

This PR fixes the redirection to Node Details page from the Inventory UI



38fcc79c-12e4-42ed-8230-712227815731

flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3202

### How to test
- Setup a local Kibana instance, pointing to a oblt cluster
- Navigate to `Infrastructure`
- Change the node type to `Kubernetes Pods`
- Click on a pod and from the context menu, click on `Kubernetes Pod
metrics`
2023-09-22 10:57:27 +02:00
Luke G
d52c5a15fd
[Security Solution] Fix missing hash in sync to url (#166847)
## Summary

This PR fixes the root cause for
https://github.com/elastic/kibana/issues/166686 and
https://github.com/elastic/kibana/issues/166774

@angorayc @machadoum 


### 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
2023-09-22 10:23:50 +02:00
Julia Bardi
3ff82f2c17
[Fleet] fix index template from datastream name (#166941)
## Summary

Resolve https://github.com/elastic/kibana/issues/164269

Some context why I picked this up now:
https://github.com/elastic/kibana/issues/162772#issuecomment-1728031080

To verify:
- Make sure 8.8+ apm package is installed
- Create data stream `PUT _data_stream/metrics-apm.app.default-default`
- Reinstall apm package from API or UI
- Check kibana info logs, expect to not see simulate template error and
rollover like below

```
[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Mappings update for metrics-apm.app.default-default failed due to ResponseError: illegal_argument_exception
        Root causes:
                illegal_argument_exception: unable to simulate template [metrics-apm.app.default] that does not exist
[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Triggering a rollover for metrics-apm.app.default-default
```


### 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
2023-09-22 10:20:05 +02:00
Cauê Marcondes
98d2766de8
[Profiling-APM] Removing Profiling dependency from APM (#166253)
This PR removes the Profiling dependency from APM, introduced on `8.10`.

- Exposes a new service in profiling-data-access plugin
- Create a new APM API that calls the new service and checks if
Profiling is initialized
- Move Locators from the Profiling plugin to the Observability-shared
plugin
- Move logic to check Profiling status (has_setup/has_data...) from
Profiling server to profiling-data-access plugin
- Create API tests, testing the status services based on different
scenarios:
  - When profiling hasn't been initialized and there's no data
  - When profiling is initialized but has no data
  - When collector integration is not installed
  - When symbolized integration is not installed
  - When APM server integration is not found

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-22 09:16:48 +01:00
Umberto Pepato
0eda41a46d
[RAM] Add missing privilege to alerting read operations (#166603)
Closes #158957

## Summary

Adds the missing `getActionErrorLog` privilege. With the updated
privileges, users with a custom Role including full access to "Actions
and Connectors", "Rule Settings" and "Stack Rules" can successfully
inspect errored actions' logs:

![Errored actions
logs](0d34f6a3-d586-4fe7-b987-a829de0d852d)

## To Test

- Create a Role with `All` privileges granted in `Actions and
Connectors`, `Rules Settings`, `Stack Rules` (under Kibana > Management)
and assign it to a user
- Log in with that user
- Create a rule with a failing action (i.e. an Email Connector with
wrong addresses)
- Wait for the rule to execute (or execute it manually)
- In the rule page, under `History` click the number under `Errored
actions` in one of the rows of the logs table
- Check that error logs are visible in the flyout
2023-09-22 09:23:13 +02:00
Philippe Oberti
416dabf505
[Security Solution] expandable flyout - increase line-height for session preview (#166932) 2023-09-22 08:47:33 +02:00
Philippe Oberti
b4d8f6ef51
[Security Solution] expandable flyout - add tooltip to correlations table cells (#166913) 2023-09-22 08:46:50 +02:00
Philippe Oberti
e7c4a84cb6
[Security Solution] expandable flyout - add tooltip to expandable panel link titles (#166737) 2023-09-22 08:46:13 +02:00
Philippe Oberti
db2e9d0a50
[Security Solution] expandable flyout - prevalence details datepicker displayed in full width (#166714) 2023-09-22 08:45:46 +02:00
Kibana Machine
45a962fca0
[api-docs] 2023-09-22 Daily api_docs build (#166998)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/468
2023-09-22 00:54:18 -04:00
Ying Mao
31c366222a
[Response Ops][Alerting] Skip settings and mapping updates on partial alerts indices. (#165896)
Resolves https://github.com/elastic/kibana/issues/162630

## Summary

Adds checks for invalid alert index names in two places:
- before updating the underlying settings/mappings of a concrete index;
attempting these updates would typically throw an error and prevent
alert resource installation from successfully completing, causing
subsequent writes to fail; in this PR ,we check for unexpected index
names and log a warning
- before updating an alert document; there is a scenario where an
existing active alert document could be in a partial or restored alert
index and trying to update that alert document would fail. to prevent
these failures, we skip the update and log a warning. we expect this
case to be more rare as most times frozen indices only contain old
alerts so the likelihood of it containing a currently active alert
should be low.

## To Verify
- Run ES with these options: `yarn es snapshot --license trial --ssl -E
path.data=../data_partial_alerts -E path.repo=<snaphot folder>-E
xpack.searchable.snapshot.shared_cache.size=100b -E
indices.lifecycle.poll_interval=1m`
- Start Kibana
- Create a snapshot repository here:
https://localhost:5601/app/management/data/snapshot_restore/add_repository.
Use `Shared File System` and use the same path as you used for
`path.repo` when running ES
- Modify the `.alerts-ilm-policy` to roll over in the hot phase with max
age of 3 minutes. Add a frozen phase that moves data into the frozen
phase after 5 minutes.
- Create some rules that generate alerts. I did both metric threshold
(uses lifecycle executor) and index threshold (uses framework).
- Wait for ILM to run and move indices to frozen. This will take a few
ILM cycles but eventually you should be able to do a `GET
.internal.alerts-stack.alerts-default-*/_alias/.alerts-stack.alerts-default`
and see a partial index name in the results
- Restart Kibana. You should see warnings logged related to the partial
indices but Kibana should successfully start and rule execution should
succeed.

## Notes

I tested what would happen if we added a bunch of new fields to a
component template and increased the total fields limit in the presence
of partial indices. Here, it works in our favor that we only allow
additive changes to our mappings, so the existing partial indices keep
the old mappings and don't need a field limit update because their
mappings don't change. Searching against both the alerts alias (that
targets partial and normal indices) works as expected and searching
directly against the partial index works as expected.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-21 20:44:23 -04:00
Jeramy Soucy
4eb1e34a46
Fixes serverless avatar tests (#166665)
Closes #165694 

Fixes serverless avatar tests by leveraging svlCommonPage login/logout
functions.

Flaky runners (as I ran the full suites, these show flakiness in other
tests, but not the avatar test):
- Search:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3200
- Security:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3198
- Observability:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3208
2023-09-21 20:09:58 -04:00
Xavier Mouligneau
e0e0a26b43
[RAM] .es-query and .observability.rules.threshold RBAC (#166032)
## Summary

This PR is updating Discover's rule to be created under the
`stackAlerts` consumer and we created an [breaking change
issue](https://github.com/elastic/dev/issues/2344) to explain the
consequences of this update.

We also fix the rule's consumer for all rule types created under the
observability rule management to use their producer instead of `alerts`.
Also, we add the ability for the ES Query and new Generic Threshold
rules type to pick the consumer associated to the rule. The
`ensureAuthorized` and the `filter` functions have modified and
simplified to support this use case please check the newest unit test
added in
`x-pack/plugins/alerting/server/authorization/alerting_authorization.test.ts`.

There is now a dropdown in the rule form to prompt the user when
creating ES Query/Generic threshold rules to select the consumer based
on their authorized consumers (we can no longer use `alerts` for these).
If there is only 1 option, then the dropdown will not be shown and the
option will be chosen automatically.

Generic threshold rules will have the following possible consumers:
 - infrastructure
 - logs

ES query rules will have the following possible consumers:
 - infrastructure
 - logs
 - stackAlerts (only from the stack management rule page)

## To Test:
### Single Consumer:
1. Create a user with only `logs` feature enabled (ensuring
`stackAlerts` is not enabled).
2. Navigate to the O11Y rule management page
3. Click the create rule button
4. Assert that both ES query and generic threshold rules are available
5. Click ES query and fill out the relevant information and create the
rule
6. Assert that the rule created has `logs` set in the `consumer` field
7. Repeat 5-6 for the generic threshold rule
8. Repeat 2-7 but on the Stack Management rules page  
9. Repeat 1-8 for the `infrastructure` feature. 

### Multiple Consumers:
1. Create a user with `logs`, `infrastructure` and `apm` features
enabled (ensuring `stackAlerts` is not enabled).
2. Navigate to the O11Y rule management page
3. Click the create rule button
4. Assert that both ES query and generic threshold rules are available
5. Click ES query and fill out the relevant information and create the
rule
6. A dropdown should prompt the user to select between 1 of the 3
consumers, select 1
7. Assert that the rule was created with the selected consumer
8. Repeat 5-7 for the generic threshold rule
9. Repeat 2-8 but on the Stack Management rules page

![Screenshot from 2023-08-08
16-45-43](8c5b644a-8bab-4c1b-93b0-acfa956af19c)

![consumer_dropdown_open](a03b7e97-e90e-4bbc-bed0-94a6c677d31d)


### 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

---------

Co-authored-by: Jiawei Wu <74562234+JiaweiWu@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-21 15:10:28 -07:00
Steph Milovic
a679ab5370
[Security solution] Skip flakey explore tests (#166992)
## Summary

Skipping flakey tests as determined by the following runs of the flakey
test runner:

-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3135
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3150
-
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3162

Tracked in security-team repo
2023-09-21 15:04:10 -07:00
Paul Tavares
de712c4d64
[Security Solution][Endpoint] Update the agents.queue setting for Defend Workflow buildkite jobs (#166981)
## Summary

- sets the `agents.queue` for Defend Workflows jobs to `n2-4-virt`,
since these jobs need to create and run VMs using Vagrant
- Should address failures seen in:
https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs
2023-09-21 14:01:55 -07:00
Alexi Doak
18a95deaea
[ResponseOps] [Alerting] race condition at startup accessing AaD documents (#166980)
Resolves https://github.com/elastic/kibana/issues/166418

## Summary

Change from `warn` to `debug`. Was able to replicate this error when
migrating an es query rule from 8.9 to 8.10 where es query uses AAD.
2023-09-21 13:21:36 -07:00
Melissa Alvarez
840e1216b0
[ML] Trained model testing: only show indices with supported fields (#166490)
## Summary

Related comment in issue:
https://github.com/elastic/kibana/pull/159150#discussion_r1288694083

This PR adds a `supportedFields` property to the inferrer class and,
when creating the index options, filters to those containing supported
fields.

For now, the supported fields default to 'text' as all inferrer types
require that.

### 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
2023-09-21 13:35:06 -06:00
Kibana Machine
30e2f2d459 skip failing test suite (#166900) 2023-09-21 15:05:27 -04:00
Jiawei Wu
6cd0643097
[RAM][HTTP versioning] Version Maintenance Window Endpoints (#162446)
## Summary
Resolves: https://github.com/elastic/kibana/issues/162179
Parent Issue: https://github.com/elastic/kibana/issues/157883

Versions the 
- `create`
- `active`
- `bulk_get`
- `find`
- `finish`
- `archive`
- `delete`
- `get`
- `update`

`/rules/maintenance_window` maintenance window endpoint. Also adds
schema validation to the I/O of each method.

### 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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-21 11:57:01 -07:00
Kevin Delemme
45c9cd04be
fix(slo): search bar (#166945) 2023-09-21 14:55:42 -04:00