Commit graph

31566 commits

Author SHA1 Message Date
Devin W. Hurley
e66cedc17e
Revert "Siem query rule - reduce field_caps usage (#184890)" (#186181)
This reverts commit 257ef7f69e.

## Summary

Summarize your PR. If it involves visual changes include a screenshot or
gif.


### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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—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—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)
2024-06-13 11:55:12 -04:00
Alexi Doak
4da9ae2f1d
[ResponseOps][Fix] Update the overdue metrics collector to filter to only claimable task types (#185894)
## Summary

This PR updates the overdue metrics collector to filter to only
claimable task types.
I borrowed the `OneOfTaskTypes` clause from
https://github.com/elastic/kibana/pull/180485
 ```
// a task type that's not excluded (may be removed or not)
    OneOfTaskTypes('task.taskType', searchedTypes),
```


### 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
2024-06-10 15:43:44 -04:00
Dario Gieselaar
5381dd714d
Consolidate react-hooks/exhaustive-deps lint rules for O11y (#184865)
Use one react-hooks/exhaustive-deps across our Obs plugins, for
consistency reasons.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
2024-06-08 09:59:25 +02:00
Nikita Indik
41c34e09c3
[Security Solution] DetectionRulesClient: various refactorings (#184954)
**Partially addresses: https://github.com/elastic/kibana/issues/184364**

## Summary
This PR contains various smaller-scale refactorings for the recently
added `DetectionsRuleClient`.

**Changes**:
- Renamed `DetectionRulesClient` containing directory from
`rule_management` to `detection_rules_client`
- Moved `DetectionRulesClient` methods into the
`detection_rules_client/methods` dir
- Moved the TS interface of `DetectionRulesClient` into a separate file
`detection_rules_client_interface.ts`
- Simplified `importRule` method parameters
- Added memoization to `getDetectionRulesClient`

---------

Co-authored-by: Georgii Gorbachev <banderror@gmail.com>
2024-06-08 01:21:58 +02:00
Nathan Reese
1a0b93aa9f
[embeddable rebuild] log stream react embeddable (#184247)
PR migrates log stream embeddable from the legacy class based system.

### test instructions
1. Run kibana on a system with o11y data and log streams
2. Create a new dashboard, click "Add panel" => "Log stream"
3. Verify panel behavior has not changed with legacy embeddable
4. Click panel context menu and select "Settings"
5. Set custom title, description and time range. Verify behavior has not
changed with legacy embeddable
6. Import dashboard with log stream panel. Verify behavior has not
changed with legacy embeddable

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-07 15:50:23 -06:00
Matthew Kime
257ef7f69e
Siem query rule - reduce field_caps usage (#184890)
## Summary

Previously, the siem query rule loaded the full set of fields for an
index pattern when running a query. This could load 5k fields or more.
Now it only loads the fields necessary for the query.

Changes as part of this PR
- The data plugin exports `queryToFields` which takes a query and
returns a list of the fields required to translate the query to ES DSL.
- `queryToFields` properly handles all filter types, previously expected
unified search bar provided filters.
- `createSecurityRuleTypeWrapper` has been modified to skip field
loading for the siem query rule
- `getFilter` takes an optional `loadFields` arguments which loads only
necessary fields
- `getQueryFilterLoadFields` was created - based on `getQueryFilter` but
also loads necessary fields
2024-06-07 16:44:44 -05:00
Ahmad Bamieh
ae1d883327
[i18n] Fix broken i18n messages (#185011) 2024-06-07 14:19:46 -06:00
Ignacio Rivas
1e197cf718
[Ingest Pipelines] Add unsaved changes prompt (#183699) 2024-06-07 20:35:56 +02:00
Joe McElroy
1ec9412e82
Disable import of langtrace (#185029)
## Summary

Disables the import for langtrace. When imported, it immediately
instruments openai lang client. This causes an issue where the
completion.create return is no longer a native ReadableStream and we
cannot tee off for pompt token counting
([here](https://github.com/elastic/kibana/blob/main/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts#L309))

Under @dgieselaar request, i've commented out the import for now.
2024-06-07 10:54:08 -07:00
Cee Chen
aefcfd03f0
[EuiCheckbox] Remove inList type checkboxes (#184881)
## Summary

The `type="inList"` prop is about to be deprecated shortly by EUI
(https://github.com/elastic/eui/pull/7814), so this is being removed
ahead of time. The same style already gets applied when no `label` prop
is passed, so no visual regressions should occur (hence the removal of
an unnecessary prop).

That being said, we would appreciate a quick smoke check of the affected
tables by CODEOWNERs to ensure your selection checkboxes look the same
as before/unbroken. Thank you!
2024-06-07 09:17:07 -07:00
elena-shostak
825efd0ef3
[Roles] Reordered sections in role management page (#184924)
## Summary

Reordered sections in role management page. [As
agreed](https://github.com/elastic/kibana/issues/182984#issuecomment-2149886052)
the order is the following:

- Cluster
- Remote Cluster
- Run As
- Index
- Remote Index

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

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

__Fixes: https://github.com/elastic/kibana/issues/182984__
2024-06-07 18:00:42 +02:00
Dario Gieselaar
1b8236375a
[Triggers Actions UI] hideBulkActions for AlertsTable (#184877)
I would like to be able to disable the bulk actions entirely for a new
Observability page. Maybe there's an existing or easier way but I
couldn't figure it out :) I also added the possibility to set the
`emptyStateHeight`.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-07 08:38:58 -07:00
Stratoula Kalafateli
ac1b9d0625
[Obs ai assistant] Hide the grid in case of errors (#184923)
## Summary

Small enhancements on the data grid support:

- Add the error message from ES in the errorMessages
- Hide the grid when there are error messages and display them to the
users

---------

Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
2024-06-07 17:36:05 +02:00
Vitalii Dmyterko
93c45874a3
[Security Solution][Detection Engine] removes suppression terms from alert id (#184453)
## Summary

- Removes suppression terms from list of properties alert id is
generated.
- As part of
[discussion](https://github.com/elastic/kibana/pull/181926#discussion_r1593337828)
we decided that alerts generated from suppression in memory do not need
to have suppression terms as part of id generation. This would prevent
creating duplicate alerts for different suppression configurations
- flaky tests
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6171
2024-06-07 15:50:42 +01:00
Kevin Delemme
cd64dc4165
chore(slo): improve operation rollback on create and update services (#183676) 2024-06-07 10:30:31 -04:00
Bena Kansara
00153fd70f
[Inventory/Metric/Custom threshold] Specify fields instead of '*' in fieldCaps request (#184968)
Resolves https://github.com/elastic/kibana/issues/184909
2024-06-07 15:39:37 +02:00
Maxim Palenov
2755b89429
[Security Solution] Support bundling ESS and Serverless OAS separately (#184348)
**Resolves: https://github.com/elastic/security-team/issues/9516**

## Summary

As a part of Serverless API reference documentation effort we need to have an ability to produce independent Serverless and ESS OpenAPI specification (OAS) bundles. This PR addresses this issue by adding a new custom property `x-labels` (applicable to OAS operation objects) representing an array of strings and bundling configuration option to exclude anything marked with specific labels.

## How does it work?

Added functionality allows to mark **OAS operation object** (objects defined under an API endpoint path as a HTTP method like `get`, `post` and etc) with arbitrary labels by using `x-labels` custom property like in an example below

```yaml
paths:
  /api/some_path:
    get:
      x-labels:
        - label1
        - label2
```

This labelling **DOESN'T** change produced bundle by itself. It's required to use bundler's `includeLabels` option to include API endpoint operation object(s). `includeLabels` accepts a list of labels. An operation object is included when it has a label matching labels passed to `includeLabels`. In mathematical terms operation object's labels set intersects with `includeLabels`.
 
## How to use it for producing separate Serverless and ESS bundles?

- Mark OAS operation objects (HTTP methods like `get` or `post`) with `x-labels` custom property.

An example below has all operation objects under `/api/some_path` path labeled with `ess` label as well as operation objects under `/api/another_path` path. On top of that `GET /api/another_path` has `serverless` label as well.

```yaml
...
paths:
  /api/some_path:
    get:
      x-labels: [ess]
      ...
    post:
      x-labels: [ess]
      ...
  /api/another_path:
    get:
      x-labels: [ess, serverless]
      ...
    post:
      x-labels: [ess]
      ...
...
```

- Configure bundler with bundling options to include specific labels. `options.includeLabels` is responsible for including document nodes labeled with specific labels. You need two bundler invocations with different `options.includeLabels` values like below

```js
bundle({ // (1)
  ...
  options: {
    includeLabels: ['serverless'],
  },
});

bundle({ // (2)
  ...
  options: {
    includeLabels: ['ess'],
  },
});
```

It will produce two following bundles

(1) for Serverless

```yaml
...
paths:
  /api/another_path:
    get:
      ...
...
```

and (2) for ESS
```yaml
...
paths:
  /api/some_path:
    get:
      ...
    post:
      ...
  /api/another_path:
    get:
      ...
    post:
      ...
...
```

You may notice (2) has everything included since each operation object is labeled with `ess` label.
2024-06-07 15:14:21 +02:00
Dario Gieselaar
15b6ba9bd8
[Investigate] Create plugin (#184908)
Create the Investigate plugin (naming TBD). Part of
https://github.com/elastic/kibana/pull/183293, splitting up the work in
several PRs.

The investigate plugin is mostly a registry to allow plugins to register
their widgets without creating dependency issues.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-06-07 15:05:36 +02:00
Pablo Machado
90ae0f22e3
[SecuritySolution] Remove transform delay time + add unattended setting (#184797)
## Summary

* Refresh risk score index after persisting risk score
* Schedule the risk score transform after calculating the risk score for
a single entity
* Update transform config 
  * Add `delay: 0s`
  * Add `managed` and `managed_by` metadata 
  * Add `version` metadata (used by the migration)
  * Add `unattended: true`
* Create a transform migration


## How to test it?
### Migration
1. Install risk engine on an old version
2. Upgrade version
3. Add new alerts with new host and user
4. Run the risk engine (you can wait or force it to run by switching the
flag on/off)
5. Open the explore page (user|host)/risk-tab and check if the new
user|host is present

### New installation
1. Install risk engine on an empty cluster
3. Add new alerts with new host and user
4. Run the risk engine (you can wait or force it to run by switching the
flag on/off)
5. Open the explore page (user|host)/risk-tab and check if the new
user|host is present






### 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
2024-06-07 05:34:01 -07:00
Gergő Ábrahám
0ebc1a0340
[EDR Workflows][MKI test] Skip Policy Details cy test on MKI due to feature flags (#184996)
## Summary

Skip Policy Details cy test on MKI due to feature flags are not
supported.
2024-06-07 05:23:36 -07:00
Shahzad
f3fdb0f398
[SLO Form] Use saved Data view id , handle runtime mappings (#176662)
## Summary

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


Use saved data view id instead of index pattern where it's available.
Inject runtime mappings from the dataview into transform.

- [ ] Go to Discover and add a runtime field to the data view (this is
only available in Discover)
- [ ] Make sure filtering works based on the data view

We are not supporting "scripted fields" from the Index Management
DataView editor.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-07 14:17:21 +02:00
Ignacio Rivas
ab151751ff
[Ingest Pipelines] Add new two columns detail layout to pipeline details page (#181003) 2024-06-07 12:42:54 +02:00
Marco Antonio Ghiani
83021ed254
[Logs Explorer] Move table control actions column to the left (#184817)
## 📓 Summary

Closes #184735 

These changes move the control actions on the Logs Explorer data grid
rows to the left for more visual consistency with Discover.

<img width="2394" alt="Screenshot 2024-06-05 at 12 53 45"
src="80c36bce-739e-4dbd-89de-fda58095da89">

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
2024-06-07 11:12:24 +02:00
Marco Antonio Ghiani
bdb722ff20
[Logs Shared] Reduce load bundle size (#184925)
## 📓 Summary

I found a couple of heavy components which could be dynamically exported
and reduce the load bundle for the plugin by ~50kb.

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
2024-06-07 09:40:44 +02:00
Søren Louv-Jansen
e5ea1d43ce
[Obs AI Assistant] Rename knowledgeBaseInstructions to userInstructions (#184918)
Minor change to rename `knowledgeBaseInstructions` to
`userInstructions`. The fact that userinstructions are currently stored
in knowledge base is an implementation details and shouldn't leak
through.
2024-06-07 08:50:03 +02:00
Tiago Costa
7935b04371
skip flaky suite (#180852) 2024-06-06 20:13:17 +01:00
honeyn303
1ff87eb551
Gemini connector integration (#183668) 2024-06-06 11:52:35 -06:00
Philippe Oberti
9a4ceaf59d
[Security Solution][Alert details] - fix timeline osquery flyout showm behind (#184951) 2024-06-06 12:50:41 -05:00
Sébastien Loix
667a9d3691
[Stateful sidenav] Add cloud yml setting for onboarding default solution (#184808) 2024-06-06 10:06:21 -07:00
Søren Louv-Jansen
5743aa09cf
[Obs AI Assistant] Use const for function names (#184830)
Some of the AI Assistant functions have very generic names. One example
is the `context` function. When stumbling upon code like

```
const contextRequest = functionClient.hasFunction('context')
```

... it is quite difficult to navigate to the context function
implementation without knowing it's exact location. Searching for
`context` is futile since it's a term used for many different things.

Using a constant to refer to a function makes it much easier to navigate
to where the function is registered. It also avoids typos but that's a
side-effect, not the main motivation for this.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-06-06 09:55:40 -07:00
Cristina Amico
966736e4b4
[Fleet] Add rate limiting to install by upload endpoint (#184036)
Fixes https://github.com/elastic/ingest-dev/issues/3217

## Summary

Add rate limiting to "install by upload" endpoint. 
Implemented with a cache that is set with the timestamp of each install
by upload, independently from the package name/version. If the time
elapsed since the last timestamp it's less than retry time (10s), the
endpoint will return `429 Too many requests`.

### Testing
- Upload a package with 
```
curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/YOUR_PATH/api/fleet/epm/packages -u elastic:changeme --data-binary @PACKAGE_NAME.zip
```
- Upload another package shortly after. It can be the same one or
another one, as the rate limiting is applied across all uploads, no
matter the package name.
- If the second upload happens <10s after the first one, should return
error `429 Too Many Requests. Please wait 10s before uploading again.`

### 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-06 17:13:52 +02:00
Rodney Norris
c3c5744f3d
[EntSearch] standardize side nav header to search for all apps (#184773)
## Summary

Fix to ensure the solution nav name is consistent for all Search pages.
2024-06-06 10:10:55 -05:00
renovate[bot]
202b9eea37
Update dependency @elastic/elasticsearch to ^8.13.1 (main) (#184863) 2024-06-06 08:08:40 -07:00
Justin Kambic
7897e42016
[Observability Onboarding] Update copy to be stateful/serverless agnostic (#184867)
## Summary

Resolves #183469.

Simple change to update the copy so it will work for both Stateful and
Serverless versions of Kibana.
2024-06-06 07:46:14 -07:00
Carlos Crespo
620359f893
[APM] Trace sample performance improvements (#183802)
Fixes #178985 
## Summary

This PR changes the frontend logic to render the trace waterfall
component. Instead of recursively rendering transactions/spans and their
child transactions/spans, which causes high memory usage depending on
the amount of data/how complex the trace to be rendered is, it now uses
tree data structure and BFS/DFS algorithms.

Besides that, the trace sample component can render a very long list. To
avoid rendering too many elements in the DOM, this PR changes it to use
a virtual list


### Memory consumption

15-minutes worth of data

| before | after |
|-------|-------|
|<img width="590" alt="image"
src="45746f12-3119-4641-9d68-a725a1fff6ac">|<img
width="590" alt="image"
src="64e7e5f2-8dda-40eb-8abc-f1974aeb7072">|


30-minutes worth of data

| before | after |
|-------|-------|
|<img width="590" alt="image"
src="a0b32774-4bb9-4d8c-a088-b4baea0c204a">|<img
width="590" alt="image"
src="b09188e3-2fa9-4d38-b344-f3dd3656bde8">|


1-hour worth of data
| before | after |
|-------|-------|
|<img width="590" alt="image"
src="c33f61ff-e7f8-4f1c-ac49-28bb4c819303">|<img
width="590" alt="image"
src="ad5299cd-7a72-43e1-aa4a-407c99acb107">|

### Extra

Sticky header fix


632485ee-80c5-486d-aaa2-c34047b9c11e

### How to test

The best way to test is to connect to an oblt cluster
- Navigate to APM > Dependencies
- Go into `cartService`
- Click on `Operations` tab and click on `POST /nodejs/addToCart`
operation.
- Select different date ranges and services

### For reviewers

There is a problem with positioning the trace elements in the grid when
rendering data for large date ranges
https://github.com/elastic/kibana/issues/178985#issuecomment-2137480777.
This won't be addressed in this PR

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-06 16:36:02 +02:00
elena-shostak
15424370e1
[Spaces] Support for query params in next route when entering space (#184858)
## Summary

Added support for query params in next route when entering space.

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

__Fixes: https://github.com/elastic/kibana/issues/184857__
2024-06-06 16:23:56 +02:00
Jill Guyonnet
318f153290
[IUI] Add unprivilieged agent install instruction (#184845)
## Summary

Closes https://github.com/elastic/ingest-dev/issues/3356

This PR adds a sentence to the `Add agent` flyout to instruct how to
install an unprivileged Elastic Agent.

<img width="957" alt="Screenshot 2024-06-05 at 16 53 13"
src="48475ec8-f392-4128-971e-ef2d1e40eb8b">
2024-06-06 16:18:29 +02:00
Nick Partridge
556531b333
Fix sort field error message for last value (#184883)
This PR fixes a minor bug on the **Last Value** editor config in which the **Sort by date field** was always considered invalid.
2024-06-06 06:56:33 -07:00
Aleh Zasypkin
53b445833f
Add support for a declarative (via configuration) way to specify Kibana feature overrides (#180362)
## Summary

This PR extends the features plugin to accept feature definition
overrides via Kibana configuration. The functionality is limited to the
Serverless offering only. Additionally, the PR updates Kibana serverless
configurations to include overrides based on the "simplified feature
toggles" proposals discussed with the solution teams.

The configuration might look like this:

```yaml
## Fine-tune the feature privileges.
xpack.features.overrides:
  dashboard:
    privileges:
      ### Dashboard's `All` feature privilege should implicitly
      ### grant `All` access to Maps and Visualize features.
      all.composedOf:
        - feature: "maps"
          privileges: [ "all" ]
        - feature: "visualize"
          privileges: [ "all" ]
    ### All Dashboard sub-feature privileges should be hidden: 
    ### reporting capabilities will be granted via dedicated
    ### Reporting feature and short URL sub-feature privilege
    ### should be granted for both `All` and `Read`.
    subFeatures.privileges:
      download_csv_report.disabled: true
      url_create:
        disabled: true
        includeIn: "read"
  ### Maps feature is disabled since it's automatically granted by Dashboard feature.
  maps.disabled: true
```


## How to test

Log in as the `admin` using SAML and navigate to the `Custom roles`
management section to edit role and see tuned role management UX:

<p align="center">
<img
src="ad6e4b07-53bd-4f5a-ae91-66d6534c711a"
/>
<img
src="8ab4d5a3-f719-42d5-a278-3aee87603c33"
/>
</p>


![image](5e27a49b-4382-4a91-bb85-eca929a27961)

### Search project
```bash
yarn es serverless --projectType=es --ssl -E xpack.security.authc.native_roles.enabled=true
yarn start --serverless=es --ssl --xpack.security.roleManagementEnabled=true
```

Refer to the proposal document, `config/serverless.yml`, and
`config/serverless.es.yml` in this PR to see the specific changes made
for your project type:


![image](9f9d0341-32a1-4258-be3b-d3a809f5bacc)

Create a custom `custom-search` role and re-login as the user with this
role to test your project type (you need to manually type role name if
the role selector):

<p align="center">
<img
src="5088320b-3cc8-4de9-984c-d70fc6277659"
/>
</p>

### Observability project
```bash
yarn es serverless --projectType=oblt --ssl -E xpack.security.authc.native_roles.enabled=true
yarn start --serverless=oblt --ssl --xpack.security.roleManagementEnabled=true
```

Refer to the proposal document, `config/serverless.yml`, and
`config/serverless.oblt.yml` in this PR to see the specific changes made
for your project type:


![image](1d2b360a-24ab-47f7-ac9b-8ad944949c32)

Create a custom `custom-o11y` role and re-login as the user with this
role to test your project type (you need to manually type role name if
the role selector):

<p align="center">
<img
src="110572b1-f08a-4427-a687-5c2e0240a36b"
/>
</p>

### Security project
```bash
yarn es serverless --projectType=security --ssl -E xpack.security.authc.native_roles.enabled=true
yarn start --serverless=security --ssl --xpack.security.roleManagementEnabled=true
```

Refer to the proposal document, `config/serverless.yml`, and
`config/serverless.security.yml` in this PR to see the specific changes
made for your project type:


![image](2dbca002-59f1-44f0-9ab2-1dd205e48da8)

Create a custom `custom-security` role and re-login as the user with
this role to test your project type (you need to manually type role name
if the role selector):

<p align="center">
<img
src="2bec6ae2-8d19-4142-a479-9a81bc1fca14"
/>
</p>

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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-06 15:55:19 +02:00
Jean-Louis Leysens
dd1864b876
[OAS] Refactor description -> summary (#184651)
## Summary

Per [the OAS docs](https://swagger.io/specification/), they have an info
object with a `summary` and `description` field. This PR refactors the
existing router `description` field to to OAS `summary` (that is how it
has been used) and introduces a "new" `description` field that will be
used for the longer form descriptions.

## Resources
* https://swagger.io/specification/

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
2024-06-06 06:49:41 -07:00
Rachel Shen
1c255c611a
[Fix] Add isLoading state to Global Search (#183866)
## Summary

This is a clean up PR for the global search. This PR keeps the height of
the svg until it loads. This PR sets up the `isLoading` prop provided by
EUI.
2024-06-06 07:31:24 -06:00
Justin Kambic
5f2e0c613a
[Observability Onboarding] Update links for integration buttons in observability solutions (#184477)
## Summary

Continuation of https://github.com/elastic/kibana/pull/184164.

Changes the integration links for metrics and logs to link to the new
onboarding flow.
2024-06-06 09:13:23 -04:00
Nikita Indik
4ddec38be0
[Security Solution] DetectionRulesClient: move public methods out and add APM spans (#184820)
**Partially addresses: https://github.com/elastic/kibana/issues/184364**

## Summary
This PR is second step in refactoring our newly added
`detectionRulesClient`.

Changes in this PR:
 - every public method was extracted into its own file for readability
- `_createRule`, `_updateRule`, `_patchRule` and
`_upgradePrebuiltRuleWithTypeChange` private methods were removed, their
code inlined into the public methods
- `toggleRuleEnabledOnUpdate`, `validateMlAuth` and `ClientError` were
moved to `utils.ts`
- methods are now wrapped in `withSecuritySpan` to report perf stats to
APM
- renamed `*.rules_management_client.test.ts` ->
`*.detection_rules_client.test.ts`
- now using the whole `detectionRulesClient` in tests, not just separate
methods
- simplified parameters of `createDetectionRulesClient`. Now 2
parameters are needed instead of 5,

**DetectionRulesClient method showing up in APM**
<img width="918" alt="Scherm­afbeelding 2024-06-05 om 14 00 36"
src="c8b469f7-9d0b-4534-a1c9-f35327ec2c4c">

**Extracted methods**
Upon reviewing the private methods in `detection_rules_client.ts`, it
became apparent that extracting these methods into separate files may
not be the most effective approach to improve readability. The primary
reason is that these private methods do not provide clear abstractions,
making them difficult to name appropriately.

Take `_updateRule` as an example. This method combines an existing rule
with a rule update to create an InternalRuleUpdate object, which is then
passed to `rulesClient.update`. If we were to extract this into a
separate file, we would need to import it for use in the public
`updateRule` method. This would result in an `updateRule` method that
calls `_updateRule`, creating confusion about what the inner
`_updateRule` does.

Also, extracting only private methods does not significantly improve
readability, as these methods do not contain a large amount of code.

So I ended up inlining the code from most of these private methods
directly into the public methods.
2024-06-06 15:10:15 +02:00
Rickyanto Ang
78b31bbeaf
[Cloud Security][Quick Wins] Fix for Rules Flyout (#184050)
## Summary

Part of Quick Wins, fix for Rules Flyout closing when user clicks on
Toaster/Pop up


a0d2e7ed-daff-46fd-973e-c268b950e72f
2024-06-06 05:52:30 -07:00
Pablo Machado
b4561e7c3e
[Security Solution] Change risk scoring sum max and simplify risk score calculations (#184638)
## Summary

* Update the `RISK_SCORING_SUM_MAX` to the appropriate value based
10.000 alerts (read more on the original issue)
* The following risk scoring engine lines can be simplified by no longer
multiplying by 100, and instead using the value above directly. I also
renamed the constants to improve reliability,


I rounded `2.592375848672986` up to `2.5924` so the calculated score
won't go above `100`.

For `10.000` alerts with a risk score of `100` each the calculated risk
score is `99.99906837960884`

Risk score calculation for 10_00 alerts with 100 risk score
![Screenshot 2024-06-03 at 11 56
48](00c876ea-388b-4322-b8f8-19fc65f9f833)

Risk score calculation for 1_000 alerts with 100 risk score
![Screenshot 2024-06-03 at 11 57
29](929746c2-19e9-4da1-b4b1-c6e56edfc77c)



### User Impact
The entity's calculated risk score will slightly increase because we
update the normalisation divisor from 261.2 to 2.5924.




### 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
2024-06-06 14:30:38 +02:00
Miriam
22155aefdc
[ObsUX] [Infra] Add missing metrics to Docker container view (#184245)
Closes https://github.com/elastic/kibana/issues/183354

Metric section

![image](0d85da8b-a651-4557-ac09-e3eee2573c42)

How to test
- The feature is under a FF, on inventory page go to settings and enable
Container view
- In containers inventory, select a docker container, you find one,
filter by any `docker.` field. Click on a container.
- Container details page should be shown Network and DiskIO charts, as
well as CPU and Memory, on Metrics section
2024-06-06 12:59:29 +01:00
Ido Cohen
a03f3bce7d
[Cloud Security] FTRs for Accessing Pages with Custom Roles (#184622) 2024-06-06 13:06:39 +03:00
Luke G
dd999bbd29
[Security Solution] Toggle new sourcerer implementation with local storage switch (#184822)
## Summary

Add `localStorage` based mechanism to toggle between the future
experiemental sourcerer implementation and the stable one in
**runtime**.

Also moved the hook for pulling in the data from the sourcerer to
appropriately named file.
2024-06-06 11:55:11 +02:00
elena-shostak
2a56861b49
[Roles] ComboBox overflow fix (#184722)
## Summary

Fixed `ComboBox` overflow with large chips. Applies to the following
fields:
- Indices.
- Remote indices.
- Remote clusters.


<img width="1242" alt="Screenshot 2024-06-04 at 11 43 39"
src="ee6dc3e3-0c6b-449b-85a7-7d82acb51b8e">



f6bbc325-a957-4c3e-bc88-721b77dc8ff0

Options considered:

1. **Flex with specific grow attribute set**. 
This will not stop the `ComboBox` from growing after it reaches 50%
point of available space.
    ```
        <EuiFlexGroup>
          <EuiFlexItem grow={5}>...</EuiFlexItem>
          <EuiFlexItem grow={5}>...</EuiFlexItem>
        </EuiFlexGroup>
    ```
2. **Grid with columns.**
    ```
      <EuiFlexGrid columns={2}>
        <EuiFlexItem>...</EuiFlexItem>
        <EuiFlexItem>...</EuiFlexItem>
      </EuiFlexGrid>
    ```
    CSS is the following. 
    ```
    grid-template-columns: repeat(2, 1fr);
    ```
The problem is that `1fr` is about the distribution of available space,
as soon as content of `ComboBox` becomes bigger it breaks.

3. **Combobox props.**
We have `fullWidth` attribute set that we need for stretching to
available column space, so the content doesn't wrap unless there is the
`maxWidth` set for column. Alternative is to remove `fullWidth` which
wraps chips correctly, but then doesn't satisfy the design.
4. **`maxWidth` for `EuiFlexItem`.**
```
    <EuiFlexGroup>
      <EuiFlexItem style={{ maxWidth: '50%' }}>...</EuiFlexItem>
      <EuiFlexItem style={{ maxWidth: '50%' }}>...</EuiFlexItem>
    </EuiFlexGroup>
```
That option works, but since we have the same form for index privileges
and remote index privileges, we would need to justify it for 2 columns
(maxWidth: '50%' ), 3 columns (maxWidth: '33%' ) and mobile accordingly
(maxWidth: '100%' ).
Can be less scalable.

4. Leverage grid `minmax`.
```
grid-template-columns: repeat(N, minmax(0, 1fr));
```
It allows to create columns as large as `1fr` and not exceed it, so
`ComboBox` will nicely fit.

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

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

### Release note
Fixed `ComboBox` overflow with large chips.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-06-06 11:41:32 +02:00
Jedr Blaszyk
678ffa0bfe
[Connectors] Use Connector API to create a connector (#183398)
## Summary

Use [Connector API
endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/master/create-connector-api.html)
in the create connectors action. Note:
https://github.com/elastic/elasticsearch/pull/109248 was merged into ES
very recently, you might need to pull latest ES image to get this
working.

Note: some crawler features also utilise connector index, since it was
agreed not to support those features in the Connector API I'm leaving
crawler related logic unchanged

### Validation
- Add unit tests
- Test locally with stack
- Test locally with serverless
2024-06-06 10:43:37 +02:00