Commit graph

67521 commits

Author SHA1 Message Date
Julia Rechkunova
7fa04e92bc
[Kibana] New "Saved Query Management" privilege to allow saving queries across Kibana (#166937)
- Resolves https://github.com/elastic/kibana/issues/158173

Based on PoC https://github.com/elastic/kibana/pull/166260

## Summary

This PR adds a new "Saved Query Management" privilege with 2 options:
- `All` will override any per app privilege and will allow users to save
queries from any Kibana page
- `None` will default to per app privileges (backward-compatible option)

<img width="600" alt="Screenshot 2023-09-21 at 15 26 25"
src="6d53548e-5c5a-4d6d-a86a-1e639cb77202">

### Checklist

- [x] 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)
- [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: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2023-09-29 11:52:39 +02:00
Mykola Harmash
d0a0a1f9e6
[Infra IU] Disable Metrics Explorer for serverless (#167022)
Closes #163282 

## Summary

This PR:
* Adds a `featureFlags.metricsExplorerEnabled` property to the Infra
plugin config to enable and disable Metrics Explorer depending on the
offering type
* Prevents `MetricsExplorerViewsService` initialization for serveless
based on the feature flag
* Prevents creating Metrics Explorer frontend routes when in serverless
* Prevents registration of the MetricsExplorerViews saved object when in
serverless
* Prevents initialization of the `metrics_explorer_views` API routes
when in serverless

**Trying to access Metrics Explorer in serverless**
<img width="1829" alt="CleanShot 2023-09-22 at 12 59 35@2x"
src="2b039925-0f0b-4c07-be29-bbe910de7a34">

**Trying to access views API**
<img width="1829" alt="CleanShot 2023-09-22 at 13 00 00@2x"
src="15269ec2-becd-4ee3-9b5e-d916df28a7b8">

**`infra/metrics_explorer` API still works as per ticket requirements**
<img width="1829" alt="CleanShot 2023-09-22 at 13 00 06@2x"
src="fb23f912-c6fd-46c8-9084-c17c51e5b064">


## How to test
* Checkout locally
* Enable Infra in `serverless.oblt.yml`: `xpack.infra.enabled: true`
* Run Kibana in serverless mode
* Try accessing `/app/metrics/explorer` route and make sure it's not
available
* Make sure other Infra routes (`/app/metrics/inventory` and
`/app/metrics/hosts`) still load as expected
* In Kibana dev console make sure you get 404 for `GET
kbn:/api/infra/metrics_explorer_views`
* Also check that you don't see `metrics-explorer-view` saved object in
the response for `GET
kbn:/api/kibana/management/saved_objects/_allowed_types`
* Run Kibana in non-serverless mode and make sure Metrics Explorer is
accessible and works as usual

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-29 11:27:19 +02:00
Faisal Kanout
4c1ca7e92f
[AO][SERVERLESS] Fix Custom Threshold rule tests for Serverless (#166942)
## Summary

Fixes #165569
Fixes #166617
Fixes #166618
Fixes #166619
Fixes #166620
2023-09-29 11:24:51 +02:00
Stratoula Kalafateli
5b0ec2e92d
[Lens] Unskip failing tests (#167599)
## Summary

Closes https://github.com/elastic/kibana/issues/167561
Closes https://github.com/elastic/kibana/issues/167552

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

### 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-29 12:15:07 +03:00
Julia Bardi
474c8eaf52
[Fleet] Agent upgrade available should use latest agent version (#167410)
## Summary

Closes https://github.com/elastic/kibana/issues/167387

Replaced using kibana version when deciding if agent upgrade is
available (only in serverless, in stateful kibana version is still
returned as an available version).

To verify locally:
- [to test stateless] add this to `kibana.dev.yml`:
`xpack.fleet.internal.onlyAllowAgentUpgradeToKnownVersions: true`
- extract the `agent_versions_list.json` to local kibana folder
`~/kibana/x-pack/plugins/fleet/target`

[agent_versions_list.json.zip](12739519/agent_versions_list.json.zip)
- verify that upgrade available warnings still work if agent is < latest
agent version (8.10.2)
- when trying to upgrade agent, verify that the default version is the
latest agent version, and 8.11 is not in the list

Agent list:
<img width="1475" alt="image"
src="f06b7bc8-97e6-4ff9-b872-736ede5e969a">

Upgrade available filter - 1 agent on latest version, 9 upgradeable:
<img width="1314" alt="image"
src="4ff5ac02-903b-493b-94df-68b1b7ad6846">

Agent details:
<img width="1512" alt="image"
src="3ff6e1d5-2ccc-4814-83e5-c4760ad63722">

Agent on latest version has disable `Upgrade agent` action:
<img width="1322" alt="image"
src="f461dbf5-04e5-4bcc-8801-48c2b1a90225">

Bulk action with one agent that is not upgradeable (already on latest
version), expected error:
<img width="1597" alt="image"
src="8bfa46ae-6684-4748-9fca-e908c142b642">




### 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-29 11:07:44 +02:00
Konrad Szwarc
c7bb851ded
[Osquery][Defend Workflows] No responses for alert on flyout (#166916)
https://github.com/elastic/kibana/issues/166040

Inform user that there are no responses associated with and alert
instead of returning `null`.

![Screenshot 2023-09-21 at 11 55
08](7758f354-45f5-4ac1-9ea4-b650aca0c082)
2023-09-29 10:17:30 +02:00
Stratoula Kalafateli
280ba7786a
[ES|QL] Improves the parsing error message (#167598)
## Summary

I decided to remove the backticks suggestion as it was a copy paste from
SQL and is not going to solve ES|QL related errors. It also creates
confusion for many users.

<img width="1677" alt="image"
src="fe2a4fcb-c3e0-4d87-8568-32e7525f70d5">
2023-09-29 11:09:35 +03:00
christineweng
87aaef68aa
[Security Solution] Skip flaky test (#167591)
## Summary

This PR skips a flaky test that has been failing on main.
2023-09-29 10:02:04 +02:00
Kevin Qualters
8768b9d9c6
[Security Solution] [Alerts] Fix close alerts test looking for rendered but hidden element instead of non existant (#167594) 2023-09-29 09:10:24 +02:00
GitStart
788dae973a
[ML] Improves display for long descriptions in transforms (#165149)
Improves the display of long descriptions of transforms in the Transform
management page and when editing the description in the transform wizard
or edit flyout.

Previously If there was a long description, the text would not be
wrapped in the table on the management page, and it would not be
possible to view the full text in the text input when editing. This PR
adds line wrapping for the description column, and uses a text area for
editing the text.

Part of https://github.com/elastic/kibana/issues/163147
2023-09-29 08:10:27 +02:00
Stratoula Kalafateli
d797846108
[ES|QL] Resets selected columns when changing query (#167492)
## Summary

Fixes a bug in ES|QL mode where you:

- have a query of index pattern 1 and select some fields
- change the query by using a different index pattern
- the selected columns do not reset


**BUG**

![withbug](5f3fdf89-5d17-443d-b50b-f802e44482c3)

**NOW**

![now](0c1f8b05-0e22-4708-85e8-9387c9a5d5fa)


### 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-29 08:41:08 +03:00
Khristinin Nikita
98a81d1b5e
Risk score engine telemetry (#166787)
## Summary

Implement risk score engine telemetry

Here we use 2 types of telemetry:

Event base telemetry:
- Risk execution success. With parameters `scoresWritten`,
`taskCompletionTimeSeconds`, `isRunMoreThanInteval`
- Risk execution error

Usage telemetry:

- `unique_user_risk_score_total` and `unique_host_risk_score_total` -
Total amount from latest transform index for host and users
- `unique_user_risk_score_day` and `unique_host_risk_score_day` - Last
day amount from the latest transform index for host and users
- `all_host_risk_scores_total` and `all_user_risk_scores_total` - Total
amount from datastream for all risk executions for host and users
- `all_host_risk_scores_total_day` and `all_user_risk_scores_total_day`
- Last day amount from datastream for all risk executions for host and
users
- `all_risk_scores_index_size` and `unique_risk_scores_index_size` -
sizes of datastream of all risk scores and latest transform index

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-29 06:46:05 +02:00
Khristinin Nikita
7aee2e2d55
Limit available spaces to 1 for risk engine (#167110)
## Summary

Limit available spaces to 1 for risk engine

<img width="1483" alt="Screenshot 2023-09-25 at 08 15 47"
src="94c088fb-55f5-436c-8c39-428fbb8e1e8c">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-29 06:42:47 +02:00
Kibana Machine
785d640628
[api-docs] 2023-09-29 Daily api_docs build (#167593)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/475
2023-09-29 00:39:07 -04:00
Yara Tercero
e9d2e782b5
[DE][Exceptions] Allow numerous match_any values that differ in case (#167208)
## Summary

Updates the exceptions flyout UI `match_any` operator to accept numerous
duplicate values that differ in case. Prior to this change, a user could
not add a field value of `foo` and `FOO` - the UI would display that the
value is a duplicate. We now will allow this as exceptions are case
sensitive and this is a necessary use case for the current exceptions
behavior.

Cypress tests and FTR tests are added.
2023-09-28 17:52:39 -07:00
Alex Szabo
8a29a5e2ca
[Ops] Fix outstanding typescript issues / re-enable typecheck (#167392)
## Summary
This is hopefully the last batch of typescript issues to be fixed,
related to https://github.com/elastic/kibana/pull/166813.

It's also re-enabling full typecheck, with this, we should be back in a
clean, typechecked main branch.

Blocked by #167428

---------

Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
Co-authored-by: Brad White <brad.white@elastic.co>
Co-authored-by: Thomas Watson <watson@elastic.co>
Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 17:55:17 -06:00
Kibana Machine
905dcfae51 skip failing test suite (#150249) 2023-09-28 18:46:45 -04:00
Alex Szabo
e84742dfc6
[Osquery][Ops] Move Osquery/cypress configurations close to cypress (#167428)
## Summary
The osquery-cypress package was referring to configurations from a
parent folder. This caused difficulties with having to exclude/include
the same files in the `tsconfig.json`s, leading to hard-to-resolve
typescript issues.

This PR moves the configs in, and cleans up redundancies and type
errors.

chore(osquery): move osquery/cypress configs to cypress folder, fix type
errors

---------

Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
Co-authored-by: Brad White <brad.white@elastic.co>
2023-09-28 15:16:22 -07:00
Rickyanto Ang
8759b03474
[Cloud Security] [CIS GCP] GCP Organization option (#166983)
## Summary

This PR is for adding the GCP Organization option as well as updating
the Single option to include Project ID field. Still rough

Changes: 
- Added GCP Organization Option
- Project ID field now exist on Google Cloud Shell Single option as well
as Organization Option
- Organization ID field added to the form when user chose account_type :
GCP Organization
- Project ID are now optional (previously users aren't able to save the
integration without filling in the Project ID)
- Removed Beta tag for CIS GCP

TODO:
- Make sure previous installation using previous wont break because of
the new fields and requirement (migration)
- More tests
- Clean up

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 14:02:23 -07:00
Jason Rhodes
859ae9e50d
[Asset Manager] Creates baseline public asset client for use in public plugins (#167191)
Closes #167075 

## Summary

Adds a public asset client available in the `setup` lifecycle hook for
plugins that depend on this one. `getHosts` is the only method available
on this client for now.

TODO, before merge:
- [x] Add docs for the server client
- [x] Add docs for the public client
- [x] Remove REST docs from plugin docs, not needed
- [x] Add unit tests for public client


### Testing this PR

One way of testing this new client is to apply the attached
test-assets.patch file locally, adjust the date range in the getHosts
query that is added in the infra plugin, and then start Kibana and
navigate to the infra app. You should see print out in the browser
console.


[test-assets.patch](12718693/test-assets.patch)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 13:26:24 -07:00
Rachel Shen
424dec613f
[Accessibility] Loading indicator aria labels (#166391)
## Summary

Closes https://github.com/elastic/kibana/issues/153597
In full screen, the loading indicator fails a11y tests. By removing the
aria-label and aria-hidden attributes, this allows the validation to
pass.
https://github.com/elastic/kibana/issues/153597#issuecomment-1482805134

This PR also introduces optional props for max and value props on the
`EuiProgress` component to provide consumers of the component greater
ability to define how the component is being used.
[Information](https://eui.elastic.co/#/display/progress#progress-with-values)
on the max and value props can be found in the [EUI
docs](https://eui.elastic.co/#/display/progress#progress-with-values).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 12:54:56 -07:00
Kibana Machine
05a7d30072 skip failing test suite (#167561) 2023-09-28 15:40:51 -04:00
Gabriel Landau
460a84e4f9
[8.11.0] Promote Defend API events to Production (#167549)
## Summary

This PR supercedes https://github.com/elastic/kibana/pull/167107

Elastic Defend for Windows now collects ETW Threat Intelligence (ETW-TI)
events. Defend calls these API events. API events currently include the
existing Credential Access and ETW-TI. We will add more events under the
API umbrella in the future.

The Windows Events Policy `Credential Access` category has been renamed
to `API` in the UI and documentation - but it remains as
`credential_access` in the yaml for backwards compatibility. This new
category definition is a superset of the previous category.

Two new advanced options are added -
* `windows.advanced.events.api_disabled` - comma separated list
* `windows.advanced.events.api_verbose` - boolean

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

### 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-09-28 14:53:44 -04:00
Panagiota Mitsopoulou
4c3fe71821
[SLO] create SLO embeddable widget (#165949)
Resolves https://github.com/elastic/kibana/issues/165947
Resolves https://github.com/elastic/actionable-observability/issues/124

### Summary
This PR adds an Embeddable SLO Overview Widget to the Dashboard app. It
uses a [Metric
chart](https://elastic.github.io/elastic-charts/?path=/story/metric-alpha--basic)
component and displays an overview of the SLO health:
- name
- current sli value
- target
- status (background color)

### ✔️ Acceptance criteria 
- The SLO widget should display the basic information listed above
- The SLO widget should be clickable and lead to the slo detail page 
- The user should be able to select the SLO and filter to instanceId
- The tag "url.domain:mail.co" is the partition field and instanceId
value

<img width="1189" alt="Screenshot 2023-09-21 at 21 07 23"
src="03539b9d-23a5-45eb-aafb-df42e9421f77">


For more information regarding the key concepts and the usage of an
embeddable you can have a look at the Embeddable plugin
[README](https://github.com/elastic/kibana/tree/main/src/plugins/embeddable)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 20:39:37 +02:00
Alex Szabo
5a785e8a41
[Ops] ES Serverless image verification fixes (#167223)
## Summary
### Error 1: Strict mode throws an error on non-filled variables. I
forgot to add this when creating the script

```
.buildkite/scripts/steps/es_serverless/promote_es_serverless_image.sh: line 40: UPLOAD_MANIFEST: unbound variable
```

### Error 2: Uploading multi-arch images

https://elastic.slack.com/archives/C5UDAFZQU/p1695725623585409

We've noticed that the downloaded `latest-verified` images are slower to
start up than normal. After inspecting the manifests, it seems we were
getting `linux/amd64` on our arm devices as well.

The solution is to grab and upload both platform variants. (using this
blog:
https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/)
2023-09-28 11:35:32 -07:00
Kibana Machine
6804232663 skip failing test suite (#167552) 2023-09-28 14:26:09 -04:00
Jatin Kathuria
fbccec8fdd
[Security Solution] Discover-Timeline Integration saved search (#165596)
This PR is next step completing discover timeline integration. All
previous/nest steps have been defined here:
https://github.com/elastic/security-team/issues/6677

## Summary
This PR implements the integration between timeline State v/s Discover
State. The purpose of this PR is to add functionality related to the
persistence of saved search which will always be linked to the timeline
user is working in.

Below diagram shows briefly how saved search is working with timeline.


```mermaid
graph TD;
    DS(Discover State) -. user updates .-> SS(Saved Search);
    SS(Saved Search) -. updates savedSearchId .-> TS(Timeline State) ;
    TS(Timeline State) -. restores Saved Search to App state .->DS(Discover State);

```


Primarily, this PR implements below technical components:

1. `DiscoverInTimleineContext` : provides the ability across security
solution to manipulate discover state.
2. `useDiscoverInTimelineActions`: acts as a helper to provide
short-hand actions to manipulate discover state. For eg.
`resetDiscoverAppState` or `restoreAppStateFromSavedSearch`.



Here is the small demo video:





006465ba-19ce-4209-ac46-21dbb746508d

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
2023-09-28 11:20:47 -07:00
Philippe Oberti
d4defbd980
Prevalence details paywall (#165435) 2023-09-28 12:35:40 -05:00
Shahzad
4221e79ff9
[Uptime] Filter out run once documents (#166704) 2023-09-28 19:24:42 +02:00
Clint Andrew Hall
76b832e12e
[feature] Implement Setting Categories in Advanced Settings in serverless (#167447)
## Summary

This PR follows #166460 by adding Category panels to the Form.

<img width="1807" alt="Screenshot 2023-09-27 at 3 36 16 PM"
src="2abe8cf5-5822-473f-affd-148fb7949316">

## Notes
This PR is divided into several commits, the first few being
prerequisite codemods. I recommend reviewing each commit separately, as
the codemods might obscure the actual component work.

- [e78586f - Make SettingType pre-defined to clean up
references](e78586fe44)
- This makes the `SettingType` optional, to clean up areas where the
generic need not be specific.
- [80a9988 - [codemod] Make onFieldChange and onInputChange more
distinct](80a9988516)
- The `onChange` handlers weren't very clear as you work your way up the
component tree. This makes the implementation and usage easier to
understand, (and easier to [replace with state
management](https://github.com/elastic/kibana/issues/166579)).
- [5d0beff - [fix] Fix logged errors in form
tests](5d0beff00c)
- This fixes some logged errors in the Form from `Monaco` and from some
missing `act` and `waitFor` calls.
2023-09-28 10:24:15 -07:00
Jordan
1a8c2f3958
[Cloud Security] Fixed vuln dashboard counters (#167511) 2023-09-28 10:24:03 -07:00
Kibana Machine
bfd1a13076 skip failing test suite (#156941) 2023-09-28 13:11:49 -04:00
jennypavlova
549195ce4f
[Infra UI] Replace node details flyout with asset details flyout in the inventory page (#166965)
Closes #161754 
Closes #166807

To make the testing and review easier I merged the old components
[cleanup PR](https://github.com/jennypavlova/kibana/pull/5) into this
one

## Summary
This PR replaces the old node details view with the asset details flyout

### Old

![image](ffbead5b-6f89-4397-b1a4-2ade74f7f227)

### New 

![image](89fa52cd-a462-499e-900a-e26c70d17791)

### Testing

1. Go to inventory
2. Click on a host in the waffle map
3. Click on any **host**
- These changes are related only if a `Host` is selected- in the case of
a pod the view shouldn't be changed:

![image](d1b90b65-1bbf-4fbf-a0c6-6b95afe6162e)

4. Check the new flyout functionality 



3557821c-7964-466e-8514-84c2f81bc2fd

Note: the selected host should have a border like in the previous
version (this I fixed in the [last
commit](ff4753aa06))
so it should be added if there is a selected node:
<img width="1193" alt="image"
src="6646fe47-6333-435a-a5ec-248339402224">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 10:02:34 -07:00
Vadim Kibana
726f212d0c
[Tags] Prevent duplicates (#167072) 2023-09-28 09:53:31 -07:00
Davis Plumlee
6ac03d739a
[Security Solution] Coverage overview test plan (#165530) 2023-09-28 12:46:11 -04:00
Kevin Logan
9d6ec1a7cb
[Security Solution] Correct the license_uuid reference name in the Endpoint Policy (#167194)
## Summary

Correct the `license_uuid` field name in the Endpoint Policy. Before, it
was named `license_uid`, but the Endpoint expects `license_uuid`.

This PR in intended to be backported to `8.10.3` which brings up an
interesting problem since we already have a migration added to `main`
for the `8.11` release.

After talking with the kibana-core team, my approach is to add the
migration for this bug fix to this PR. Then, to keep the `modelVersions`
consistent, I will backport all `modelVersions` to `8.10.3` to keep the
migrations consistent. Keeping these consistent is important so that
both users upgrading from `8.10.x` in ESS and the Serverless line all
remain in sync. The end result is that the policies inside of of
`8.10.3` will have an extra field that will be unused until `8.11.0`

The following `8.10.3` backport for this will include the extra
migration and I will request reviews for it since it will be more than a
normal backport.

Policy:

![image](888e364b-e835-4a76-8ee3-68d8ed1f055b)

### 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 12:37:15 -04:00
Ryland Herrick
2edc13c2c1
[Security Solution][Entity Analytics] API Versioning for new EA Routes (#167365)
## Summary

* Adds API versioning to all routes involved in new Risk Engine, public
and private
* Adds missing PLI auth headers for some routes
* Updates API invocations to specify an appropriate version header
* Does NOT add header to legacy transform-based EA routes




### Checklist
- [x] Verify no API calls from the UI were missed

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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-28 11:30:27 -05:00
Paul Tavares
79c42be00c
[Security Solution][Endpoint] Add missing system_indices_superuser role to the Serverless role.yml override file (#167450)
## Summary

- Adds the missing `system_indices_superuser` role to the `role.yml`
file used when starting ES for serverless and using the security
solution override files for resources
2023-09-28 09:09:38 -07:00
Saarika Bhasi
7162634f3b
Add a Gated form for Workplace Search (#167315)
## Summary
This PR adds Gated form when user visit Workplace Search , when`
kibana_uis_enabled == false`. User will not be able to able to access
any other Workplace search routes other than Overview page.


**Note**: Form submission and API call be included in next PR 

Screen Recordings :


672a7b2e-3e5f-4fa1-8535-b5080b3a2dfc



7c8129cf-6f50-4039-9b50-b9a655361bd1



### 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)
- [ ] [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-28 21:30:35 +05:30
Quynh Nguyen (Quinn)
f5d223b253
[ML] Fix assertion for delete ingest pipelines api (#167451) 2023-09-28 10:54:37 -05:00
Jorge Sanz
274fe1e9d0
[Maps] Update map report image test threshold for new EMS styles (#167162)
Updated EMS Styles are waiting to be put into production. They are
already available in Elastic staging environment
([preview](maps-staging.elastic.co/?manifest=testing)). This PR is a
safe measure to ensure that this change do not break our CI tests.

The process has been as follows:

1. Momentarily replaces the EMS Tile Service `tileApiUrl` by our staging
server to force the use of the new styles and check which tests break
with the slightly different basemaps at
[12481c6](12481c6ada)
2. Look for related [broken
tests](https://buildkite.com/elastic/kibana-pull-request/builds/161870)
```
Error: expected 0.030813687704837327 to be below 0.03
```
4. Adjust the threshold for the dashboard report, since the new value
was slightly over the limit
[e655b84](e655b84569)
5. Wait for a green CI (this took a few days because of unrelated issues
with Kibana CI)
6. Revert the `tileApiUrl` change to its original value
[c0030bc](c0030bcff1)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 17:34:15 +02:00
Robert Oskamp
db58f44def
Add serverless FTR tests to staging quality gate (#167294)
## Summary

This PR adds the serverless FTR tests that we already have in the [QA
quality
gate](https://github.com/elastic/kibana/blob/main/.buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml#L18-L24)
to the staging quality gate.

### Details

We intentionally decided run the same set of FTR tests again in staging
for starters. We're accepting the over-testing here until we have enough
confidence and experience with our serverless product stability to
decide which set of tests to run in which environment.

This PR also explicitly sets the `EC_ENV` and `EC_REGION` environment
variables for QA and Staging. It worked fine for QA env so far without
setting the environment variable because it fell back on the QAF default
values. Setting these values explicitly, makes it more robust.
2023-09-28 17:26:34 +02:00
Jonathan Budzenski
07b206748f skip failing test suite (#167496) 2023-09-28 10:02:36 -05:00
Gergő Ábrahám
da2da33881
[fleet] Add OpenAPI definition for GET uninstall-tokens (#159188)
## Summary

Adds Open API definition for `GET /api/fleet/uninstall_tokens`, which is
hidden behind feature flag for now, but **planned to be enabled for
v8.11.0**.

This should be merged with:
- https://github.com/elastic/kibana/pull/166794
2023-09-28 16:37:53 +02:00
David Sánchez
cb214a792c
[Fleet][Agent tamper protection] Enables agent tamper protection feature flag (#166794)
## Summary

- Enables agent tamper protection feature flag.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 16:36:29 +02:00
Anton Dosov
6fd9909b5e
[CM] Soften response validation (#166919)
## Summary

Close https://github.com/elastic/kibana/issues/167152

Log a warning instead of throwing an error in
`saved_object_content_storage` when response validation failed.

We decided to do this as a precaution and as a follow up to an issue
found in saved search https://github.com/elastic/kibana/pull/166886
where storage started failing because of too strict validation.

As of this PR the saved_object_content_storage covers and this change
cover:

- `search`
- `index_pattern`
- `dashboard`
- `lens`
- `maps`

For other types we agreed with @dej611 that instead of applying the same
change for other types (visualization, graph, annotation) the team would
look into migrating their types to also use
`saved_object_content_storage`
https://github.com/elastic/kibana/issues/167421
2023-09-28 16:33:04 +02:00
Maxim Palenov
88b8b8c190
[Security Solution] Reenable rules table filtering serverless tests (#166771)
**Relates to:** https://github.com/elastic/kibana/issues/161540

## Summary

This PR unskips rules table filtering serverless tests.

Serverless [rules_table_filtering.cy.ts (100
runs)](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3205)
🟢
2023-09-28 07:19:13 -07:00
Patrick Mueller
e6e3e2d188
[ResponseOps] resolve conflicts when updating alert docs after rule execution (#166283)
resolves: #158403

When conflicts are detected while updating alert docs after a rule runs,
we'll try to resolve the conflict by `mget()`'ing the alert documents
again, to get the updated OCC info `_seq_no` and `_primary_term`. We'll
also get the current versions of "ad-hoc" updated fields (which caused
the conflict), like workflow status, case assignments, etc. And then
attempt to update the alert doc again, with that info, which should get
it back up-to-date.

Note that the rule registry was not touched here. During this PR's
development, I added the retry support to it, but then my function tests
were failing because there were never any conflicts happening. Turns out
rule registry mget's the alerts before it updates them, to get the
latest values. So they won't need this fix.

It's also not clear to me if this can be exercised in serverless, since
it requires the use of an alerting framework based AaD implementation
AND the ability to ad-hoc update alerts. I think this can only be done
with Elasticsearch Query and Index Threshold, and only when used in
metrics scope, so it will show up in the metrics UX, which is where you
can add the alerts to the case.

## manual testing

It's hard! I've seen the conflict messages before, but it's quite
difficult to get them to go off whenever you want. The basic idea is to
get a rule that uses alerting framework AAD (not rule registry, which is
not affected the same way with conflicts (they mget alerts right before
updating them), set it to run on a `1s` interval, and probably also
configure TM to run a `1s` interval, via the following configs:

```
xpack.alerting.rules.minimumScheduleInterval.value: "1s"
xpack.task_manager.poll_interval: 1000
```

You want to get the rule to execute often and generate a lot of alerts,
and run for as long as possible. Then while it's running, add the
generated alerts to cases. Here's the EQ rule definition I used:


![image](56c69d50-a76c-48d4-9a45-665a0008b248)

I selected the alerts from the o11y alerts page, since you can't add
alerts to cases from the stack page. Hmm. :-). Sort the alert list by
low-high duration, so the newest alerts will be at the top. Refresh,
select all the rules (set page to show 100), then add to case from the
`...` menu. If you force a conflict, you should see something like this
in the Kibana logs:

```
[ERROR] [plugins.alerting] Error writing alerts: 168 successful, 100 conflicts, 0 errors:
[INFO ] [plugins.alerting] Retrying bulk update of 100 conflicted alerts
[INFO ] [plugins.alerting] Retried bulk update of 100 conflicted alerts succeeded
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-09-28 09:47:17 -04:00
Dima Arnautov
3ad5addd89
[ML] Alerts as data integration for Anomaly Detection rule type (#166349)
## Summary

Part of #165958

Replaces usage of the deprecated `alertFactory` with the new alerts
client and adds alerts-as-data integration for Anomaly Detection
alerting rule type.

Alert instances are stored in
`.alerts-ml.anomaly-detection.alerts-default` index and extends the
common `AlertSchema`.

<details>
  <summary>Result mappings</summary>
  
  ```json
{
  ".internal.alerts-ml.anomaly-detection.alerts-default-000001": {
    "mappings": {
      "dynamic": "false",
      "_meta": {
        "namespace": "default",
        "kibana": {
          "version": "8.11.0"
        },
        "managed": true
      },
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "event": {
          "properties": {
            "action": {
              "type": "keyword"
            },
            "kind": {
              "type": "keyword"
            }
          }
        },
        "kibana": {
          "properties": {
            "alert": {
              "properties": {
                "action_group": {
                  "type": "keyword"
                },
                "anomaly_score": {
                  "type": "double"
                },
                "anomaly_timestamp": {
                  "type": "date"
                },
                "case_ids": {
                  "type": "keyword"
                },
                "duration": {
                  "properties": {
                    "us": {
                      "type": "long"
                    }
                  }
                },
                "end": {
                  "type": "date"
                },
                "flapping": {
                  "type": "boolean"
                },
                "flapping_history": {
                  "type": "boolean"
                },
                "instance": {
                  "properties": {
                    "id": {
                      "type": "keyword"
                    }
                  }
                },
                "is_interim": {
                  "type": "boolean"
                },
                "job_id": {
                  "type": "keyword"
                },
                "last_detected": {
                  "type": "date"
                },
                "maintenance_window_ids": {
                  "type": "keyword"
                },
                "reason": {
                  "type": "keyword"
                },
                "rule": {
                  "properties": {
                    "category": {
                      "type": "keyword"
                    },
                    "consumer": {
                      "type": "keyword"
                    },
                    "execution": {
                      "properties": {
                        "uuid": {
                          "type": "keyword"
                        }
                      }
                    },
                    "name": {
                      "type": "keyword"
                    },
                    "parameters": {
                      "type": "flattened",
                      "ignore_above": 4096
                    },
                    "producer": {
                      "type": "keyword"
                    },
                    "revision": {
                      "type": "long"
                    },
                    "rule_type_id": {
                      "type": "keyword"
                    },
                    "tags": {
                      "type": "keyword"
                    },
                    "uuid": {
                      "type": "keyword"
                    }
                  }
                },
                "start": {
                  "type": "date"
                },
                "status": {
                  "type": "keyword"
                },
                "time_range": {
                  "type": "date_range",
                  "format": "epoch_millis||strict_date_optional_time"
                },
                "top_influencers": {
                  "type": "nested",
                  "dynamic": "false",
                  "properties": {
                    "influencer_field_name": {
                      "type": "keyword"
                    },
                    "influencer_field_value": {
                      "type": "keyword"
                    },
                    "influencer_score": {
                      "type": "double"
                    },
                    "initial_influencer_score": {
                      "type": "double"
                    },
                    "is_interim": {
                      "type": "boolean"
                    },
                    "job_id": {
                      "type": "keyword"
                    },
                    "timestamp": {
                      "type": "date"
                    }
                  }
                },
                "top_records": {
                  "type": "nested",
                  "dynamic": "false",
                  "properties": {
                    "actual": {
                      "type": "double"
                    },
                    "by_field_name": {
                      "type": "keyword"
                    },
                    "by_field_value": {
                      "type": "keyword"
                    },
                    "detector_index": {
                      "type": "integer"
                    },
                    "field_name": {
                      "type": "keyword"
                    },
                    "function": {
                      "type": "keyword"
                    },
                    "initial_record_score": {
                      "type": "double"
                    },
                    "is_interim": {
                      "type": "boolean"
                    },
                    "job_id": {
                      "type": "keyword"
                    },
                    "over_field_name": {
                      "type": "keyword"
                    },
                    "over_field_value": {
                      "type": "keyword"
                    },
                    "partition_field_name": {
                      "type": "keyword"
                    },
                    "partition_field_value": {
                      "type": "keyword"
                    },
                    "record_score": {
                      "type": "double"
                    },
                    "timestamp": {
                      "type": "date"
                    },
                    "typical": {
                      "type": "double"
                    }
                  }
                },
                "url": {
                  "type": "keyword",
                  "index": false,
                  "ignore_above": 2048
                },
                "uuid": {
                  "type": "keyword"
                },
                "workflow_status": {
                  "type": "keyword"
                },
                "workflow_tags": {
                  "type": "keyword"
                }
              }
            },
            "space_ids": {
              "type": "keyword"
            },
            "version": {
              "type": "version"
            }
          }
        },
        "tags": {
          "type": "keyword"
        }
      }
    }
  }
}
  ```
</details>

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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-28 15:46:42 +02:00
Kibana Machine
67cc63affe skip failing test suite (#167496) 2023-09-28 09:26:55 -04:00