Commit graph

46297 commits

Author SHA1 Message Date
Philippe Oberti
dd471d10b2
[Security Solution][Expandable flyout] show last open in the history (#210286)
## Summary

This PR makes a small UI addition to the expandable flyout package
history functionality [merged not long
ago](https://github.com/elastic/kibana/pull/184970).

We are snow saving the time at which a panel was opened, along side the
panel's information. This allows us to show when previous flyout panels
were opened, making it users easier for users to know which
host/user/network/alerts/event document they recently looked at.

The primary logic change happens in the expandable flyout package. Most
of the other code changes are in Security Solution unit tests.

#### Before

![Screenshot 2025-02-07 at 5 07
48 PM](https://github.com/user-attachments/assets/8f0b79b7-a3db-4d01-8d3c-a4a9b632e9cf)

#### After

![Screenshot 2025-02-13 at 11 03
31 AM](https://github.com/user-attachments/assets/64cd5df2-a0b6-4eee-8555-53aedda1db8f)

You'll notice in the screenshot above that another small improvement was
added: we're limiting the width of the text rendered and show an
ellipsis. This will prevent really long texts to have the popover really
wide or to be rendered over multiple lines

### 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/src/platform/packages/shared/kbn-i18n/README.md)
- [x]
[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
2025-02-18 19:40:34 -06:00
Nicolas Chaulet
0180301e37
[Fleet] Make status runtime query more robust (#211639) 2025-02-19 00:04:57 +01:00
Nathan Reese
f84ea79fa5
[canvas] remove usage of EmbeddableInput type (#211512)
Part of effort to remove legacy EmbeddableInput type.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 15:48:40 -07:00
Georgii Gorbachev
786df79f37
[Security Solution] Refactor prebuilt rule customization test plans, part 2 (#211472)
**Epic:** https://github.com/elastic/kibana/issues/174168
**Partially addresses:**
https://github.com/elastic/kibana/issues/202068,
https://github.com/elastic/kibana/issues/202078,
https://github.com/elastic/kibana/issues/202079
**Follow-up to:** https://github.com/elastic/kibana/pull/211300

## Summary

We're cleaning up and refactoring our existing test plans for prebuilt
rule customization, upgrade, and export/import workflows.

Specifically, this PR:

- Creates an "entrypoint" file that should help navigate all the test
plans for prebuilt rules.
- Creates a file for keeping common information about prebuilt rules
that can be shared between the test plans.
- Extracts duplicated terminology to the file with common information.
- Extracts duplicated assumptions to the file with common information.
- Extracts duplicated non-functional requirements to the file with
common information.
- Adds user stories to each test plan.
- Updates links to tickets in every test plan.

No "functional" changes have been made to any test plans, such as
adding, removing, or updating any scenarios.

This refactoring prepares the test plans for being "functionally"
changed and improved in follow-up PRs. For example, we're going to cover
the logic described in https://github.com/elastic/kibana/issues/210358
and address any other gaps in coverage.

## Review tip

It might be easier to review this PR commit-by-commit as each of them
contains logically cohesive changes.
2025-02-18 20:34:15 +00:00
Jon
8a55fdfe93
Fix octokit types (#211643)
Related to https://github.com/elastic/kibana/pull/211450
2025-02-18 14:33:27 -06:00
Andrew Macri
05ae2b1cf8
[Security Solution] [Attack discovery] Fixes alerts filtering issues (#211371)
### [Security Solution] [Attack discovery] Fixes alerts filtering issues

This PR resolves the following Attack discovery alerts filtering issues:

- [[Security Solution] [Bug] A few filters show error 'Unexpected error from Elasticsearch' for the alerts flyout #208481](https://github.com/elastic/kibana/issues/208481)
- [[Security Solution] [Bug] Lucene not updated as the space holder when we apply Lucene as the filtering language #208170](https://github.com/elastic/kibana/issues/208170)
- Connector selection resets in non-default spaces
- Saving a filter edited via `Edit Query DSL` with an unknown `user.name` value results in a `filter value is invalid or incomplete` filter
- Local field Reset clears the preview dropdowns when they are in an error state
- Updates the formatting of `Up to _n_ alerts` for Borealis

#### Feature flag required for testing

The following feature flag is required to test this PR:

```yaml
xpack.securitySolution.enableExperimental:
  - 'attackDiscoveryAlertFiltering'
```

The following sections provide details and desk testing steps for the alerts filtering issues fixed by this PR.

### [Security Solution] [Bug] A few filters show error 'Unexpected error from Elasticsearch' for the alerts flyout #208481

To resolve [[Security Solution] [Bug] A few filters show error 'Unexpected error from Elasticsearch' for the alerts flyout #208481](https://github.com/elastic/kibana/issues/208481):

- The `_ignored` metadata field was added to the [METADATA](https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-metadata-fields.html) keyword in the `ES|QL` queries that power the `Alert summary` and `Alerts preview` tabs

- The `Alert summary` and `Alerts preview` tabs dropdowns are now filtered to only display fields in the alerts index
  - Example: Previously, if the `dll.Ext.load_index` field was in a `logs-*` index, but not the alerts index, it would still appear in the `Alerts summary` dropdown, and result in an error if selected. After the fix in this PR, this (example) field would not appear in the dropdown.

#### Desk testing

To desk test this fix:

- See issue <https://github.com/elastic/kibana/issues/208481>

- In addition to the steps in [issue #208481](https://github.com/elastic/kibana/issues/208481), verify the `Alert summary` and `Alerts preview` dropdowns
  - Do NOT display an error when the `_ignored` field is selected
  - Identify a field that is present in a `logs-*` index, but not the alerts index, for example `dll.Ext.load_index`. Verify this field is NOT displayed in the dropdown

### [Security Solution] [Bug] Lucene not updated as the space holder when we apply Lucene as the filtering language #208170

To resolve [[Security Solution] [Bug] Lucene not updated as the space holder when we apply Lucene as the filtering language #208170](https://github.com/elastic/kibana/issues/208170), the custom placeholder was removed, as illustrated by the _before_ and _after_ screenshots below:

**Before**

![settings before](https://github.com/user-attachments/assets/4bab48bd-e0b5-42eb-93fe-3faefdfc58bf)

**After**

![settings after](https://github.com/user-attachments/assets/b499dab0-0ee1-464a-8bda-cdbf5236b0d3)

#### Desk testing

To desk test this fix, see <https://github.com/elastic/kibana/issues/208170>

### Connector selection resets in non-default spaces

This PR fixes an issue where the last selected connector would reset in non-default spaces when all of the following were true:

- The user is in a non-default space
- Two or more generative AI connectors are configured

This issue occurred in non-default spaces because:

- `spaceId` loads asynchronously
- Kibana's `package.json` references an older version of `react-use`, with a known bug in the `useLocalStorage` hook, which is fixed by <https://github.com/streamich/react-use/pull/1944>
- I verified (locally) the fix from <https://github.com/streamich/react-use/pull/1944> would work if Kibana's version of `react-use` was updated in `package.json`, however that effort appears to be on hold: <https://github.com/elastic/kibana/pull/179268> . For now (to minimize changes), `spaceId` has been removed from all Attack discovery local storage keys.

#### Desk testing

1. Create a new space (if you only have the default space)

2. Configure two or more Gen AI connectors

3. Select the newly created space

4. Navigate to Security > Attack discovery

5. Select a connector, for example `Claude 3.5 Sonnet`

6. Now select a _different_ connector, for example `Gemini 1.5 Pro 002`

7. Navigate to a different page in the Security solution, for example Security > Alerts

9. Once again, navigate to Security > Attack discovery

**Expected result**

- The previously selected connector, e.g. `Gemini 1.5 Pro 002` is still selected

### Saving a filter edited via `Edit Query DSL` with an unknown `user.name` value results in a `filter value is invalid or incomplete` filter

This PR fixes an issue where editing a previously created non-Query DSL filter via `Edit Query DSL`, and then entering an unknown `user.name`, resulted in a filter with text that reads: `filter value is invalid or incomplete`, as illustrated by the screenshot below:

![filter value is invalid](https://github.com/user-attachments/assets/39493dba-bf1d-4ce7-8480-15ee2ed599ea)

Generating attack discoveries with a filter like the one shown in the screenshot above would also result in errors.

This issue was resolved by adding a `FilterManager` to manage the local state of the filters in the settings panel.

#### Desk testing

1. Navigate to Security > Attack discovery

2. Click the settings gear

3. Click the `+` button to open the `Add filter` popover

4. In the popover, configure a `user.name` `is` `Administrator` filter

  Note: replace `Administrator` with a real `user.name`  value if your alerts index doesn't have the value ``Administrator``

5. Click `Add filter` to close the popover

**Expected result**

- The `user.name: Administrator` filter appears below the query bar

6. Click the `user.name: Administrator` filter, and choose `Edit filter` from the popover

7. Click the `Edit as Query DSL` button (in the upper right hand corner)

8. In the `Edit filter` Elasticsearch Query DSL editor, edit the Query DSL such that it has a value that does NOT exist in the index, like the following example:

```json
{
  "match_phrase": {
    "user.name": "Admasdfinistrator"
  }
}
```

9. Click `Update filter`

**Expected results**

- The `user.name: Admasdfinistrator` filter, which references a value that does not exist in the alerts index, appears below the query bar
- The updated filter does NOT have the text `filter value is invalid or incomplete`, as illustrated by the the screenshot in the description of this issue above.

### Local field Reset clears the preview dropdowns when they are in an error state

This PR fixes an issue where the local (to the preview tab) reset button did not clear the preview dropdowns if they were in an error state.

The issue is fixed by calling `clearSearchValue()` to reset the stack by field when it's in an error state (i.e. because an invalid field was entered)

Note: The "local" (to the tab) `Reset` button shown in the screenshot below is fixed by this PR:

![local_reset](https://github.com/user-attachments/assets/0a2d040f-c31a-40b0-8c16-04b7d333f73e)

, however the `Reset` button at the bottom of the flyout will NOT clear the dropdown if it's in an error state. (For now, this is the expected behavior.) The workaround is to manually select a valid value in the dropdown, or click `Save` or `Cancel`. (The preview dropdown does not effect the Attack discovery query, is not saved, and automatically resets to the default every time the flyout is opened.)

#### Desk testing

1. Navigate to Security > Attack discovery

2. Click the settings gear

3. In the `Alert summary` tab, focus the dropdown and delete the text until it reads:

```
kibana.alert.rule.na
```

4. Blur the dropdown by clicking outside it

**Expected results**

- The dropdown is highlighted red
- The `Reset` button appears below the text `Select a field`

5. Click the `Reset` button below the text `Select a field`

**Expected results**

- The dropdown is NOT highlighted red (the error state is cleared)
- The dropdown text is reset to the (valid) default value: `kibana.alert.rule.name`

### Updates the formatting of `Up to _n_ alerts` for Borealis

This PR updates the formatting of the `Up to n alerts` text in Borealis, as illustrated by the before and after screenshots below:

**Before**
![01-up_to_100_alerts_before](https://github.com/user-attachments/assets/4143e847-5220-463b-8fb0-da5215d16b24)

**After**
![02-up_to_100_alerts_after](https://github.com/user-attachments/assets/835bd3fb-1e63-4192-b694-4595e8fa9309)

#### Desk testing

To desk test this fix:

1. Configure Kibana to use the `dark` theme

2. Navigate to Security > Attack discovery

3. In the connector selector, choose `+ Add new Connector...`

4. Click in the `Select a connector` dialog, click `OpenAI`

4. Enter a throwaway configuration for the connector (note: you won't actually use it), and click `Save`

**Expected results**

- The animated `Up to 100 alerts will be analyzed` message will appear
- The color of the animated numeric text, e.g. `100` matches the color of the `Up to` text that precedes it
- The extra whitespace trailing the `100`, shown in the _Before_ image (above) does NOT appear. The trailing whitespace after the `100` looks like the _After_ image (also above).
2025-02-18 15:21:59 -05:00
Eyo O. Eyo
ff0470fb42
Consolidate all language definitions used in monaco within the @kbn/monaco package (#208950)
## Summary

This PR was created in response to
https://github.com/elastic/kibana/pull/208858, it migrates all existing
language definitions within the `@kbn/code-editor` package into the
`@kbn/monaco` package to provide a separation of concern for logic that
doesn't particularly relate to the configurations for the code editor
UI.

With this change, all supported languages are ingested from the
`@kbn/monaco` package where they will be domiciled from henceforth, and
in turn fix the issue that was discovered relating to the way the
language definitions within `@kbn/code-editor` get registered as a side
effect.

With this change, to add support for a new language, said language
should be defined within `@kbn/monaco`, and registered in
`languages/index.ts`.

<!--
### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 19:27:36 +01:00
Nathan Reese
a67154c6a7
unskip Failing test: X-Pack API Integration Tests.x-pack/test/api_integration/apis/maps/search·ts (#211304)
Closes https://github.com/elastic/kibana/issues/208138

ES|QL response updated with `is_partial` key.
x-pack/test/api_integration/apis/maps/search.ts tests where skipped to
unblock ES-snapshot promotion. This PR unskips the tests and updates the
expects for the new response shape

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-18 10:17:32 -07:00
Paul Tavares
b6f0cc7857
[Security Solution][Endpoint] Add the space ID to endpoint artifacts when creating or updating them (#210698)
## Summary

Changes in this PR are in associated with Endpoint Management support
for spaces:

- When creating an endpoint artifact (Trusted Apps, Event Filters,
Blocklists, Host Isolation Exceptions, Endpoint Exceptions), the API
will ensure a new `tag` is dded to each item created that identifies the
space ID from where it was crated
- This functionality is behind the following feature flag:
`endpointManagementSpaceAwarenessEnabled`
- The tag that will be automatically added has a format of:
`ownerSpaceId:<space_id_here>`
- Likewise, when updating an artifact, the API will ensure that at least
1 owner space id tag is present on the item, and if not, it will add one
to it.
2025-02-18 11:46:44 -05:00
Joe Reuter
bc3f77238d
Move useAbortController and useAbortableAsync hook into central package (#211295)
The useAbortController and useAbortableAsync hooks are very generic
hooks that are useful beyond observability. This PR moves them into
`react-hooks` which already houses other similar hooks.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 13:00:16 -03:00
Julia Bardi
519d1c2b5d
[Fleet] Added warning icon next to auto upgrade agents badge (#211551)
## Summary

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

Added warning icon to Agent policy details, next to Auto upgrade agents
badge if there are failures in agents upgrade.

UX Design:
<img width="1421" alt="image"
src="https://github.com/user-attachments/assets/a2c54fef-0100-48ed-9461-eb9f8c704a3d"
/>

UI:
<img width="1571" alt="image"
src="https://github.com/user-attachments/assets/ee061feb-c489-4637-b684-f489c822aab9"
/>
2025-02-18 16:49:05 +01:00
Kibana Machine
44a06206bb skip failing test suite (#210245) 2025-02-19 02:34:54 +11:00
Meghan Murphy
8f3a45fb2c
[Search Connectors] : Unregister Kibana background task (#211091)
## Summary

Since Agentless Connectors will not be released in 9.0 anymore, this PR
should unregister and stop the background kibana task from creating new
policies for elastic-managed connectors.

### Closes https://github.com/elastic/search-team/issues/9283

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-18 10:22:51 -05:00
Ido Cohen
f5c9529e37
Deprecate universal entity 2025-02-18 16:49:32 +02:00
Kevin Delemme
729287f0e0
chore(slo): link to SLO details page from create and update toast (#211475) 2025-02-18 09:47:56 -05:00
Samiul Monir
169230eb44
[Search] Adding tech preview for sprinkles model (#211519)
## Summary

Adding `Tech Preview` for `rainbow sprinkles` model


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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
2025-02-18 09:21:09 -05:00
Nicolas Chaulet
e6709dd78f
[Fleet] Fix flaky agent status field (#211453)
## Summary

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

It seems with ES > 9 that runtime field is sometimes failing, while I am
not sure why, that PR make it more robust and should avoid test
flakyness.

---------

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-18 08:57:08 -05:00
Nicolas Chaulet
aa96382c71
[Fleet] Add UI to add additional datastreams permissions (#210935) 2025-02-18 08:56:38 -05:00
Alex Prozorov
dac36902f2
10973 migrate flaky e2e tests to jest 2 (#211363)
## Summary

This PR tries to fix the following issues - which are flaky FTR tests:

- https://github.com/elastic/kibana/issues/209529
- https://github.com/elastic/kibana/issues/201686
- https://github.com/elastic/kibana/issues/203680
- https://github.com/elastic/kibana/issues/178413 - test is still
skipped, added unit tests for rules table, header and counter
components.
- https://github.com/elastic/kibana/issues/193073
- https://github.com/elastic/kibana/issues/193616
- https://github.com/elastic/kibana/issues/191604
- https://github.com/elastic/kibana/issues/191593
- https://github.com/elastic/kibana/issues/191511
- https://github.com/elastic/kibana/issues/191474
- https://github.com/elastic/kibana/issues/191322
- https://github.com/elastic/kibana/issues/191128
- https://github.com/elastic/kibana/issues/191144
- https://github.com/elastic/kibana/issues/191027
- https://github.com/elastic/kibana/issues/190831
- https://github.com/elastic/kibana/issues/190779



There will be an RFC document which is going to be released to help us
better understand and decide which tests are more suitable to make as
E2E tests and which as unit tests.

### 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] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### Closes
this PR closes the above mentioned issues in relation for this ticket -
https://github.com/elastic/security-team/issues/10973
2025-02-18 15:14:24 +02:00
Joe Reuter
2673b9b93b
🌊 Move kbn-streams-schema to platform (#211230)
First part of moving streams into the platform. This PR moves the
package only, will stack PRs on top of this.
2025-02-18 14:12:36 +01:00
Marta Bondyra
91a19c0969
[Lens] Remove scss from annotations plugin, visualization-ui-components and gauge expression (#208891)
## Summary

part of https://github.com/elastic/kibana/issues/208908

Replaces scss to css-in-js. I've tested all the changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 13:31:09 +01:00
Efe Gürkan YALAMAN
148d47ced1
[Fix]Removes synonyms read-only permission. (#211471)
## Summary

Kibana permission for read-only is removed. This is not a breaking
change while the feature is not yet released.
Cluster requirements make it obsolete.
Also fixed warnings on permission names.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2025-02-18 12:59:27 +01:00
Krzysztof Kowalczyk
46132d8c3e
[Spaces] Show callout on spaces permission tab when security is disabled (#210961)
## Summary

This PR updates the behavior of `Permissions` tab in `Space Management`
when `xpack.security.enabled` is set to `false` to show a callout with a
meaningful explanation.
![Screenshot 2025-02-17 at 12 42
58](https://github.com/user-attachments/assets/881d0bbe-e30b-41b4-8c0a-5b8e127786ab)


Closes: #210241

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 12:53:27 +01:00
Søren Louv-Jansen
4cd9ef318b
[Obs AI Assistant] Defer KB migration until index assets have been updated (#211523)
Follow-up to https://github.com/elastic/kibana/pull/210386
Closes: https://github.com/elastic/kibana/issues/211525

This ensures that we don't start executing the knowledge base migration
until index assets have been updated
2025-02-18 12:50:01 +01:00
Umberto Pepato
e5bd422f6e
[ResponseOps][Observability][Alerts] Fix missing alert grouping controls in o11y alerts page (#211160)
## Summary

Adds back the additional alerts table toolbar controls to edit the
grouping configuration. Adds test cases to check the correctness of the
Observability alerts table configurations.

## To verify

1. Create one or more rules that fire alerts in Observability
2. Navigate to Observability > Alerts
3. Verify that the grouping toggle shows and works correctly in the
table toolbar (`Group by: ...`)
2025-02-18 11:40:34 +01:00
Julia Bardi
dca5f18b7e
[Fleet] show auto upgrade agent status (#210866)
## Summary

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

Added API to query agents per each version enrolled to an agent policy,
including the count of agents that failed to upgrade to the target
version.
This API is used on the UI to calculate the status of auto upgrade
status.
- Complete status: agent count reaches or exceeds target percentage
without upgrade failures
- Not started status: 0 agents on target percentage
- In progress status: agent count doesn't reach target percentage
- Failed status: there is at least one agent in failed upgrade status on
the target version

Added click handler to navigate from the status to agent list.

[UI
Design](https://www.figma.com/design/ZH58ySPR1nhI3lRHrkds1t/%5BFleet%5D-Automatic-target-agent-version?node-id=2128-4286&p=f&t=3GvdUYkqdCAJj99q-0)



```
GET kbn:/api/fleet/agent_policies/{agentPolicyId}/auto_upgrade_agents_status

{
  "currentVersions": [
    {
      "version": "8.16.2",
      "agents": 1,
      "failedAgents": 0
    },
    {
      "version": "8.16.3",
      "agents": 0,
      "failedAgents": 1
    }
  ],
  "totalAgents": 1
}
```

<img width="985" alt="image"
src="https://github.com/user-attachments/assets/c4a40872-2fe7-48e9-ade5-fe2b36d06a0e"
/>
<img width="811" alt="image"
src="https://github.com/user-attachments/assets/1cbbebb9-2c7b-4cb5-a57d-7a0388fd437e"
/>
<img width="805" alt="image"
src="https://github.com/user-attachments/assets/be716b87-9b0f-4f16-ad05-a463169bee25"
/>
<img width="989" alt="image"
src="https://github.com/user-attachments/assets/09745005-d5ed-4a80-8e7a-7c2df427d4ad"
/>
<img width="906" alt="image"
src="https://github.com/user-attachments/assets/162d43aa-1bce-4dda-a5dd-91cb59636740"
/>


### 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/src/platform/packages/shared/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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 11:09:01 +01:00
Elena Shostak
38439bb7e1
Upgraded octokit to 21.1.1 (#211450)
## Summary

Upgraded octokit to `21.1.1`
2025-02-18 16:46:38 +07:00
Sid
e0886ba73f
[Session cleanup] Update session index cleanup to check for missing shards (#205744)
Closes https://github.com/elastic/kibana/issues/205146

## Summary
We run a session clean up task that opens a point in time query to try
and delete any older sessions in the session index. We've noticed that
this task fails quite often with the same error
`no_shard_available_action_exception`. On investigating, it's possible
that the point in time query is opened when there are no shards
available for that index. This PR fixes that by checking if the PIT
query fails with 503 bails if it throws the error - allowing the task to
be tried again in the next run of the task manager. We allow for up to
10 failures of the clean up task in succession before logging an error.


### Testing
Unfortunately, there's no reliable way to simulate missing shards
locally. I've added a new integration test config here:

```
node scripts/functional_tests_server.js --config x-pack/test/security_api_integration/session_shard_missing.config.ts
```

This overrides the ES function to return 503 when opening PIT query and
then attempts to assert the result from the task manager.

### Release note
Updates session cleanup mechanism to account for potential missing
shards in Session index.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.


- [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] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
[kibana-flaky-test-suite-runner#7836](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7836)
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-18 10:26:30 +01:00
Jill Guyonnet
e3fc4e23fc
[Fleet] Update instructions for installing Fleet Server (#211495)
## Summary

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

Before:
![Screenshot 2025-02-17 at 18 06
06](https://github.com/user-attachments/assets/7dee41ff-d2c1-44ba-80f5-f2a8d61e4149)

After:
![Screenshot 2025-02-17 at 18 06
49](https://github.com/user-attachments/assets/5384a063-c7b1-475f-96f3-ce06f82b8a1c)
2025-02-18 10:07:11 +01:00
Georgiana-Andreea Onoleață
71254c8ee5
[ResponseOps][Rules] Move the params of es query and index threshold rule types (#210197)
Connected with https://github.com/elastic/kibana/issues/195188

## Summary

- Moved params of es query rule type to
`@kbn/response-ops-rule-params/es_query` package
- Moved params of index threshold rule type to
`@kbn/response-ops-rule-params/index_threshold` package

The following constants for the es query rule type have been duplicated:
    - MAX_SELECTABLE_SOURCE_FIELDS
    - MAX_SELECTABLE_GROUP_BY_TERMS
    - ES_QUERY_MAX_HITS_PER_EXECUTION
2025-02-18 09:58:37 +02:00
Tiago Costa
040accf49e
skip flaky suite (#203607) 2025-02-17 20:45:45 +00:00
Cauê Marcondes
929cd7de4f
[Profiling] Improve finding a function (#210437)
closes https://github.com/elastic/prodfiler/issues/4534

TopN functions:


https://github.com/user-attachments/assets/1b62a50f-3c6f-4cd5-8971-019ca403893c

Diff TopN functions:


https://github.com/user-attachments/assets/0c598317-9423-44b4-9d3f-079d22a0194c
2025-02-17 19:22:58 +01:00
Søren Louv-Jansen
df67a09afa
[Obs AI Assistant] Add KB re-indexing when encountering semantic_text bug (#210386)
Closes https://github.com/elastic/kibana/issues/210204

This will automatically re-index the knowledge base if upon adding a KB
entry there is this error:

> The [sparse_vector] field type is not supported on indices created on
versions 8.0 to 8.10

That error means that semantic_text is not supported in the given index,
and it should therefore be re-indexed.

**How to test this PR:**

**8.10**
- `git checkout -B 8.10 origin/8.10`
- Start Kibana:
  - `nvm use && yarn kbn bootstrap && yarn start`
- Start ES
- `nvm use && yarn es snapshot --license trial --E
path.data="/Users/sorenlouv/elastic/kbn_es_data/upgrade_testing"`

**8.19**
- `git checkout -B 8.19 origin/8.x`
- Start Kibana:
  - `nvm use && yarn kbn bootstrap && yarn start`
- Start ES
- `nvm use && yarn es snapshot --license trial --E
path.data="/Users/sorenlouv/elastic/kbn_es_data/upgrade_testing"`
- Install Knowledge base
- Try adding an item to KB (it should fail ️)

**9.1.0**
- `gh pr checkout 210386`
- Start Kibana:
  - `nvm use && yarn kbn bootstrap && yarn start`
- Start ES
- `nvm use && yarn es snapshot --license trial --E
path.data="/Users/sorenlouv/elastic/kbn_es_data/upgrade_testing"`
- Try adding an item to KB (it should succeed ️)

**TODO:**

- Add an upgrade test that covers this flow

---------

Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>
2025-02-17 18:20:50 +01:00
James Gowdy
24dbf7ecfd
[ML] File upload: Adding link to full file upload tool (#211443)
Adds a link to the original file upload page from file upload lite help
text.


![image](https://github.com/user-attachments/assets/12c9799f-95e6-4fa4-81f3-d997a689677a)
2025-02-17 16:38:05 +00:00
José Luis González
cbaddbe2b2
[Search] Consuming plugs and web EUI icons and removing custom ones (#211416)
## Summary

`plugs` and `web` new icons are available since `EUI 99.2.0` . As agreed
removing the custom temporary instances and consuming them from EUI
instead.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-17 16:56:16 +01:00
Jedr Blaszyk
aa681551b0
[Integration] Hide elastic_connectors package (#211419)
## Summary

Hide `elastic_conenctors` package by default. This excludes the package
from:
- integration page
- search results

#### Verification

Without the change package shows up as the integration, and search
results. With the change it's correctly excluded.
2025-02-17 16:48:34 +01:00
Charlotte Alexandra Wilson
745784f32a
Delete 'ServiceEntityStoreEnabled' Flag usages (#211066)
## Summary

This PR deletes all usages of ServiceEntityStoreEnabled feature flag.
The feature flag itself has been left in `experimental_features.ts`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-17 14:19:09 +00:00
Dzmitry Lemechko
08400b1f42
[kbn-scout][maps] waitForRenderComplete (#211265)
## Summary

This PR add a method to wait for map to be loaded to replace generic
`renderable.waitForRender()`.

While investigating the recent test failure on CI I found out that for
maps case we can simplify the logic with few facts:
- before start waiting for render to complete, we need to wait for main
container `#maps-plugin` to be in DOM. It takes 2-3 seconds.
- there is always a single div block with `data-render-complete`
attribute, and there is a comment in source code stating `See if the
"data-render-complete" attribute is "true". If so we're done!` which
means we can simply wait for
`div[data-dom-id][data-render-complete="true"]`


6de2ef0e6d/x-pack/platform/plugins/shared/maps/public/connected_components/map_container/map_container.tsx (L103-L116)

`renderable.waitForRender()` is a good waiter, but probably for
dashboard with multiple panels.
2025-02-17 14:46:44 +01:00
José Luis González
0c69f75a37
[Search] Providing all connectors to the search results (#211213)
## Summary

All search connectors are provided to the top global search bar from the
Enterprise Search plugin. Taking users to the connectors creation flow
in Search where only self-managed will be the option available and
preselected by default tackled in this another PR
https://github.com/elastic/kibana/pull/211206

Additionally we should not provide the same connectors coming from
Integrations in order to avoid duplicated listed connectors as displayed
in the screenshot, this should be done in this related issue:
https://github.com/elastic/search-team/issues/9287

![CleanShot 2025-02-14 at 13 14
08@2x](https://github.com/user-attachments/assets/ef34867a-49fe-47ca-9dda-02e76e20d792)


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-17 14:03:11 +01:00
Vitalii Dmyterko
82f7aa3b19
[Security Solution][Detection Engine] removes flaky comment from FTR test (#211209)
## Summary
- addresses https://github.com/elastic/kibana/issues/179693
- no failures for a very long time
- likely cause of flakiness was fixed earlier
https://github.com/elastic/kibana/issues/179704#issuecomment-2659128455

Not failures reported in
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5888
flaky runner too
2025-02-17 12:56:05 +00:00
Anton Dosov
79dfa2e764
Favorite a dashboard from within (#201596)
- Adds "stardust" effect suggested by @andreadelrio here
https://github.com/elastic/kibana/issues/200315#issuecomment-2599109888
both to Dashboard And ESQL star


https://github.com/user-attachments/assets/96babced-7ffd-446b-a94a-e9681c627e44


https://github.com/user-attachments/assets/44273f8b-6ff6-4753-9ccf-d62a0feca12d


- Adds favorite button to dashboard page next to the breadcrumb (should
look good for both old and new nav)

![Screenshot 2025-02-10 at 15 31
15](https://github.com/user-attachments/assets/6639d97d-34d3-459f-acc1-4b726f76d6a2)
![Screenshot 2025-02-10 at 15 31
21](https://github.com/user-attachments/assets/669c248c-af64-4189-95d9-84ed91ec58a4)
![Screenshot 2025-02-10 at 15 32
42](https://github.com/user-attachments/assets/433a634c-c050-4e7b-a612-8ce3bc5ebc26)
![Screenshot 2025-02-10 at 15 32
46](https://github.com/user-attachments/assets/eb205f38-9d7a-47d4-90c3-de04d2930c69)
2025-02-17 13:53:03 +01:00
Kevin Lacabane
95b3f6e14d
[streams] lifecycle - ingestion and total docs metadata (#210301)
Adds avg ingestion per day, total doc count and ingestion rate graph to
the lifecycle view.

We use the dataset quality plugin to compute these values. I've added a
query string to optionally retrieve the creation date of a data stream
in the `data_streams/stats` endpoint.

![Screenshot 2025-02-11 at 17 39
13](https://github.com/user-attachments/assets/9242ecbc-ebee-43da-b742-fbc0d0997bc2)

-----

@elastic/obs-ux-logs-team the change in dataset quality involves the
optional retrieval of the data streams creation date in the `/stats`
endpoint. There are other ways in dataset quality to get these
informations but they rely on queries to compute the data. In our case
these queries will always be unbounded and using the `/stats` would be
more efficient as it relies on cluster state.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-17 13:35:20 +01:00
Ievgen Sorokopud
0adce7a3db
[Rules migration][Integration test] Get Prebuilt Rules APIs (#11232) (#211403)
## Summary

[Internal link](https://github.com/elastic/security-team/issues/10820)
to the feature details

Part of https://github.com/elastic/security-team/issues/11232

This PR covers SIEM Migrations Get prebuilt rules API (route: `GET
/internal/siem_migrations/rules/{migration_id}/prebuilt_rules`)
integration test:
* get all prebuilt rules matched by migration rules
* return empty response when migration rules did not match prebuilt
rules
2025-02-17 13:31:30 +01:00
Gerard Soldevila
171dd6b075
SKA: Fix kebab-case issues in obs-ux-management packages (#211312)
## Summary

This PR aims at relocating some of the Kibana modules (plugins and
packages) into a new folder structure, according to the _Sustainable
Kibana Architecture_ initiative.

> [!IMPORTANT]
> * We kindly ask you to:
> * Manually fix the errors in the error section below (if there are
any).
> * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the
source code (Babel and Eslint config files), and update them
appropriately.
> * Manually review
`.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that
any CI pipeline customizations continue to be correctly applied after
the changed path names
> * Review all of the updated files, specially the `.ts` and `.js` files
listed in the sections below, as some of them contain relative paths
that have been updated.
> * Think of potential impact of the move, including tooling and
configuration files that can be pointing to the relocated modules. E.g.:
>     * customised eslint rules
>     * docs pointing to source code

> [!NOTE]
> * This PR has been auto-generated.
> * Any manual contributions will be lost if the 'relocate' script is
re-run.
> * Try to obtain the missing reviews / approvals before applying manual
fixes, and/or keep your changes in a .patch / git stash.
> * Please use
[#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E)
Slack channel for feedback.

Are you trying to rebase this PR to solve merge conflicts? Please follow
the steps describe
[here](https://elastic.slack.com/archives/C07TCKTA22E/p1734019532879269?thread_ts=1734019339.935419&cid=C07TCKTA22E).

#### 4 packages(s) are going to be relocated:

| Id | Target folder |
| -- | ------------- |
| `@kbn/alerting-rule-utils` |
`x-pack/platform/packages/shared/alerting-rule-utils` |
| `@kbn/observability-alert-details` |
`x-pack/solutions/observability/packages/alert-details` |
| `@kbn/observability-alerting-test-data` |
`x-pack/solutions/observability/packages/alerting-test-data` |
| `@kbn/observability-get-padded-alert-time-range-util` |
`x-pack/solutions/observability/packages/get-padded-alert-time-range-util`
|


<details >
<summary>Updated references</summary>

```
./.i18nrc.json
./package.json
./packages/kbn-ts-projects/config-paths.json
./src/platform/packages/private/kbn-repo-packages/package-map.json
./tsconfig.base.json
./x-pack/platform/packages/shared/alerting-rule-utils/jest.config.js
./x-pack/solutions/observability/packages/alert-details/jest.config.js
./x-pack/solutions/observability/packages/alerting-test-data/jest.config.js
./x-pack/solutions/observability/packages/get-padded-alert-time-range-util/jest.config.js
./yarn.lock
.github/CODEOWNERS
```

</details><details >
<summary>Updated relative paths</summary>

```
x-pack/platform/packages/shared/alerting-rule-utils/jest.config.js:10
x-pack/platform/packages/shared/alerting-rule-utils/tsconfig.json:2
x-pack/solutions/observability/packages/alert-details/jest.config.js:10
x-pack/solutions/observability/packages/alert-details/tsconfig.json:2
x-pack/solutions/observability/packages/alerting-test-data/jest.config.js:10
x-pack/solutions/observability/packages/alerting-test-data/tsconfig.json:2
x-pack/solutions/observability/packages/get-padded-alert-time-range-util/jest.config.js:10
x-pack/solutions/observability/packages/get-padded-alert-time-range-util/tsconfig.json:2
```

</details>
2025-02-17 12:36:43 +01:00
José Luis González
55f451fe9e
[Search] Offer self-managed connector as only option (#211206)
## Summary

Removing Set up clock. Making Self-managed the only way to create a
connector for ECH 9.0

![CleanShot 2025-02-17 at 10 52
39@2x](https://github.com/user-attachments/assets/f37d989e-cfeb-4657-a480-faa8443e0543)


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] 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/src/platform/packages/shared/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
- [ ] 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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-17 11:59:55 +01:00
Ievgen Sorokopud
cd502acea1
[Rules migration][Integration test] Install APIs (#11232) (#211339)
## Summary

[Internal link](https://github.com/elastic/security-team/issues/10820)
to the feature details

Part of https://github.com/elastic/security-team/issues/11232

This PR covers SIEM Migrations Install API (route: `POST
/internal/siem_migrations/rules/{migration_id}/install`) integration
test:
* install all installable custom migration rules
* install all installable migration rules matched with prebuilt rules
* install and enable all installable migration rules
* install migration rules by ids
* install rules of non-existing migration - nothing should be installed
* Error handling: an error if body payload is not passed
2025-02-17 11:25:33 +01:00
Arturo Lidueña
0ae28aa8bc
[Obs Ai Assistant] Add system message (#209773)
Fix: System Message Missing in Inference Plugin
Closes #209548
## Summary

A regression was introduced in 8.18
([#199286](https://github.com/elastic/kibana/pull/199286)), where the
system message is no longer passed to the inference plugin and,
consequently, the LLM.

Currently, only user messages are being sent, which impacts conversation
guidance and guardrails. The system message is crucial for steering
responses and maintaining contextual integrity.

The filtering of the system message happens here:

771a080ffa/x-pack/platform/plugins/shared/observability_ai_assistant/server/service/client/index.ts (L510-L512)

Fix Approach
- Ensure the `system` message is included as a parameter in
`inferenceClient.chatComplete.`
```typescript
const options = {
      connectorId,
      system,
      messages: convertMessagesForInference(messages),
      toolChoice,
      tools,
      functionCalling: (simulateFunctionCalling ? 'simulated' : 'native') as FunctionCallingMode,
    };
    if (stream) {
      return defer(() =>
        this.dependencies.inferenceClient.chatComplete({
          ...options,
          stream: true,
        })
      ).pipe(
        convertInferenceEventsToStreamingEvents(),
        instrumentAndCountTokens(name),
        failOnNonExistingFunctionCall({ functions }),
        tap((event) => {
          if (
            event.type === StreamingChatResponseEventType.ChatCompletionChunk &&
            this.dependencies.logger.isLevelEnabled('trace')
          ) {
            this.dependencies.logger.trace(`Received chunk: ${JSON.stringify(event.message)}`);
          }
        }),
        shareReplay()
      ) as TStream extends true
        ? Observable<ChatCompletionChunkEvent | TokenCountEvent | ChatCompletionMessageEvent>
        : never;
    } else {
      return this.dependencies.inferenceClient.chatComplete({
        ...options,
        stream: false,
      }) as TStream extends true ? never : Promise<ChatCompleteResponse>;
    }
  }
 ```
- Add an API test to verify that the system message is correctly passed to the LLM.
2025-02-17 11:12:56 +01:00
Abhishek Bhatia
24b75740fd
[Security Solution][Entity Analytics][Risk Score]Changes for the confirmation message after RiskScore SO is updated (#211372)
## Summary

### **What has changed?**  
This PR updates the text in the `toast` message when the Risk Score
Saved Object configuration is modified by the user.

### **Reason for the change:**  
The update ensures compliance with the toast message guidelines: [EUI
Toast Guidelines](https://eui.elastic.co/#/display/toast/guidelines).

### **Screenshots:**

**Before:**


![image](https://github.com/user-attachments/assets/c7259b86-cd0f-44c7-a952-fa029baf11d1)


**Now:**

![Screenshot 2025-02-17 at 12 02
55 PM](https://github.com/user-attachments/assets/c2421d1e-ad20-4d60-a861-68caf2b631a5)


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2025-02-17 15:31:39 +05:30
Abhishek Bhatia
5fbbcf97a1
[Entity Analytics] [Asset Criticality] Add "unassigned" as an asset criticality level for bulk_upload (#208884)
This pull request introduces the new `unassigned` criticality level for
the asset criticality's `bulk_upload` .

### Key Changes:

#### Schema and Configuration Updates:
* Added `unassigned` to the list of criticality levels in multiple
schema files (`kibana.serverless.yaml`, `kibana.yaml`,
`common.schema.yaml`,
`ess/security_solution_entity_analytics_api_2023_10_31.bundled.schema.yaml`,
`serverless/security_solution_entity_analytics_api_2023_10_31.bundled.schema.yaml`).

#### TypeScript and Constants:
* Updated `AssetCriticalityLevel` enum in `common.gen.ts` to include
`unassigned`.
* Added `UNASSIGNED` to `CriticalityLevels` enum and
`CriticalityModifiers` in `constants.ts`.


#### Tests:
* Updated test cases to include `unassigned` as a valid criticality
level in `parse_asset_criticality_csv_row.test.ts`,
`validations.test.ts`, `asset_criticality_data_client.test.ts`, and
`asset_criticality_csv_upload.ts`.

#### Backend Logic:
* Modified `AssetCriticalityDataClient` to handle `unassigned`
criticality level appropriately.

<img width="1488" alt="Screenshot 2025-01-30 at 2 03 11 PM"
src="https://github.com/user-attachments/assets/938411c4-725a-451c-ab38-aca36a704e91"
/>


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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 was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)


### Testing Steps

The main idea for this change is that the `unassigned` criticality level
is actually marked as `deleted` in the ES documents.

ES index name for default space :
`.asset-criticality.asset-criticality-default`

#### API 

1. `POST /api/asset_criticality/upload_csv`

```
curl --location 'http://localhost:5601/api/asset_criticality/upload_csv?output=stream' \
--header 'kbn-xsrf: hello' \
--header 'Accept: multipart/form-data' \
--header 'Authorization: *******' \
--form 'file=@"<Full path of the CSV file for asset criticality>"
```

Error response : 

```
{"errors":[{"message":"Invalid criticality level \"unassigned_impact\", expected one of extreme_impact, high_impact, medium_impact, low_impact, unassigned","index":4}],"stats":{"successful":3,"failed":1,"total":4}}%
```

Success response : 

```
{"errors":[],"stats":{"successful":4,"failed":0,"total":4}}%
```

Query the ES using below query to see if the criticality level is
`deleted`

```
GET .asset-criticality.asset-criticality-default/_search
{
  "query": {
    "match": {
      "asset.criticality": "deleted"
    }
  }
}
```

### UI

1. Navigate to Entity Store page
2. Upload a csv file with incorrect asset criticality level


![image](https://github.com/user-attachments/assets/8e19573b-f9f1-40df-a8de-be3ffa6ade17)

3. Rectify and upload the same file with correct criticality levels.


![image](https://github.com/user-attachments/assets/9c1872c0-e1d5-4a58-8cd8-bde0e6b0b26b)


4. Navigate to EA Dashboard and scroll down to the Entities section.
5. Select an entity and open the flyout.
6. Try changing the asset criticality of the entity. No blank/empty
value should be present or assigned to asset criticality.
7. Should be able to successfully modify the asset criticality for the
entity.

![Screenshot 2025-02-10 at 12 58
21 PM](https://github.com/user-attachments/assets/29ca6ff2-de2b-46e8-bec0-842672323844)
![Screenshot 2025-02-10 at 12 58
11 PM](https://github.com/user-attachments/assets/1cdb5f77-01e8-49b4-8f8d-bfc42859dbae)


Confirm this by querying the ES with the query : 

```
GET .asset-criticality.asset-criticality-default/_search
{
  "query": {
    "match": {
      "asset.criticality": "deleted"
    }
  }
}
```

Ensure that the Elastic search document's `_source` contains three keys,
with `deleted` present as the ` `criticality_level` for the below three
keys.

`criticality_level`
`host.asset.criticality`
`asset.criticality`

Example : 

![Screenshot 2025-02-10 at 1 08
29 PM](https://github.com/user-attachments/assets/053eddad-f9df-4c65-b687-226d9cfd5715)


### Bulk upload

```
curl --location 'http://localhost:5601/api/asset_criticality/bulk' \
--header 'kbn-xsrf: hello' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ****' \
--data '{
  "records": [
    {
      "id_value": "host-1",
      "id_field": "host.name",
      "criticality_level": "low_impact"
    },
    {
      "id_value": "host-2",
      "id_field": "host.name",
      "criticality_level": "medium_impact"
    },
    {
      "id_value": "host-6",
      "id_field": "host.name",
      "criticality_level": "medium_impact"
    },
    {
      "id_value": "host-3",
      "id_field": "host.name",
      "criticality_level": "high_impact"
    },
    {
      "id_value": "host-4",
      "id_field": "host.name",
      "criticality_level": "high_impact"
    },
    {
      "id_value": "host-bulkupload",
      "id_field": "host.name",
      "criticality_level": "unassigned"
    }

  ]
}
```

![image](https://github.com/user-attachments/assets/f692798b-2589-42a4-8ee5-696af0e39fdc)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-17 15:31:27 +05:30
Gerard Soldevila
c14d52a12a
[main] [UA] Handle frozen indices deprecations (#208156) (#211355)
# Backport

This will backport the following commits from `8.x` to `main`:
- [[UA] Handle frozen indices deprecations
(#208156)](https://github.com/elastic/kibana/pull/208156)

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

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-01-30T22:36:28Z","message":"[UA]
Handle frozen indices deprecations (#208156)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana-team/issues/1392\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"cc358e3c46e5df2af834e341114f23aa1fd4f7d1","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:version","v8.18.0","v8.19.0"],"title":"[UA]
Handle frozen indices
deprecations","number":208156,"url":"https://github.com/elastic/kibana/pull/208156","mergeCommit":{"message":"[UA]
Handle frozen indices deprecations (#208156)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana-team/issues/1392\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"cc358e3c46e5df2af834e341114f23aa1fd4f7d1"}},"sourceBranch":"8.x","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/211165","number":211165,"state":"MERGED","mergeCommit":{"sha":"22a748198915940c4bbcf59eab167caae462284e","message":"[8.18]
[UA] Handle frozen indices deprecations (#208156) (#211165)\n\n#
Backport\n\nThis will backport the following commits from `8.x` to
`8.18`:\n- [[UA] Handle frozen indices
deprecations\n(#208156)](https://github.com/elastic/kibana/pull/208156)\n\n<!---
Backport version: 8.9.8 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Gerard\nSoldevila\",\"email\":\"gerard.soldevila@elastic.co\"},\"sourceCommit\":{\"committedDate\":\"2025-01-30T22:36:28Z\",\"message\":\"[UA]\nHandle
frozen indices deprecations (#208156)\\n\\n##
Summary\\r\\n\\r\\nCloses\nhttps://github.com/elastic/kibana-team/issues/1392\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<42973632+kibanamachine@users.noreply.github.com>\",\"sha\":\"cc358e3c46e5df2af834e341114f23aa1fd4f7d1\",\"branchLabelMapping\":{\"^v8.16.0$\":\"main\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"Team:Core\",\"release_note:skip\",\"backport:version\",\"v8.18.0\",\"v8.19.0\"],\"number\":208156,\"url\":\"https://github.com/elastic/kibana/pull/208156\",\"mergeCommit\":{\"message\":\"[UA]\nHandle
frozen indices deprecations (#208156)\\n\\n##
Summary\\r\\n\\r\\nCloses\nhttps://github.com/elastic/kibana-team/issues/1392\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<42973632+kibanamachine@users.noreply.github.com>\",\"sha\":\"cc358e3c46e5df2af834e341114f23aa1fd4f7d1\"}},\"sourceBranch\":\"8.x\",\"suggestedTargetBranches\":[\"8.18\"],\"targetPullRequestStates\":[{\"branch\":\"8.18\",\"label\":\"v8.18.0\",\"labelRegex\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"},{\"branch\":\"8.19\",\"label\":\"v8.19.0\",\"labelRegex\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"}]}]\nBACKPORT-->\n\nCo-authored-by:
Gerard Soldevila
<gerard.soldevila@elastic.co>"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
2025-02-17 10:53:04 +01:00