Commit graph

46254 commits

Author SHA1 Message Date
kibanamachine
355b859fcd
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' 2025-03-10 21:54:09 +00:00
kibanamachine
ed5e4fed7f
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' 2025-03-10 21:53:30 +00:00
kibanamachine
dd626d8266
[CI] Auto-commit changed files from 'node scripts/notice' 2025-03-10 21:53:30 +00:00
Kenneth Kreindler
58e6e1eded
prevent too many ESQl generation attempts 2025-03-10 21:53:30 +00:00
Kenneth Kreindler
c76a4469ae
esql self healing graph 2025-03-10 21:53:30 +00:00
Kenneth Kreindler
ad3dce1179
attempt 1 2025-03-10 21:53:20 +00:00
Kenneth Kreindler
b79e33db32
init 2025-03-04 20:25:24 +00:00
Joe Reuter
02b9f8f249
🌊 Streams: Disable AI suggestions button if there is no sample data (#213113)
This PR makes the AI suggestions button more stable in case of
misconfigured fields:
* Only make the button clickable if there are sample values
* Filter out sample documents that don't have the required field on the
server (would have broken the request before)

<img width="344" alt="Screenshot 2025-03-04 at 15 43 23"
src="https://github.com/user-attachments/assets/12045985-cfac-4a13-a23c-595ac6503c1a"
/>
2025-03-04 17:46:14 +01:00
Viduni Wickramarachchi
ad8c3e7be5
[Obs AI Assistant] Update date category label (#213108) 2025-03-04 17:20:12 +01:00
Nathan Reese
b213eb6bb2
[embeddable] replace Embeddable ViewMode with presentation-publishing ViewMode (#211960)
Embeddable ViewMode is part of legacy embeddable architecture. This PR
removes Embeddable ViewMode and replaces its usage with
presentation-publishing ViewMode. presentation-publishing ViewMode is a
string literal type so an enum is no longer needed.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-04 09:05:23 -07:00
Carlos Crespo
8e5b8580f4
[Infra] Fix hosts total count query (#212749)
Fixes [#212745](https://github.com/elastic/kibana/issues/212745)

## Summary

Fix for the hosts total count query, which was not correctly filtering
hosts from system integration and APM

<img width="584" alt="image"
src="https://github.com/user-attachments/assets/05c3b244-3a0f-425a-82db-3498c1a6dbb7"
/>


### How to test
- Connect Kibana to an edge cluster
- Navigate to Infrastructure > Hosts
- The total number of items on the table should be equal to the number
in the hosts count KPI

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-04 16:46:21 +01:00
Konrad Szwarc
dfe542bd8e
[EDR Workflows] Workflow Insights - insights generating script (#213094)
This PR introduces a new script for loading parameterized workflow
insights into a data stream. It enables UI/UX testing without requiring
an agent installation or generating insights manually.

Arguments

```
--endpointId       Required. The endpoint ID to use for generating workflow insights.
--elasticsearch    Optional. The URL to Elasticsearch. Default: http://localhost:9200
--username         Optional. The username to use for authentication. Default: elastic
--password         Optional. The password to use for authentication. Default: changeme
--count            Optional. The number of workflow insights to generate. Default: 5
--os               Optional. The OS to use for generating workflow insights. Default: linux
--antivirus        Optional. The antivirus to use for generating workflow insights. Default: ClamAV
--path             Optional. The executable path of the AV to use for generating workflow insights. Default: /usr/bin/clamscan
```
Example usage:

* Load 5 workflow insights, using the default values - Linux, ClamAV,
/usr/bin/clamscan on the endpoint with ID
8ee2a3a4-ca2b-4884-ae20-8b17d31837b6
 
`node ./load_workflow_insights.js --endpointId
8ee2a3a4-ca2b-4884-ae20-8b17d31837b6`
 
* Load 10 workflow insights for Malwarebytes with path of C:\\Program
Files\\Malwarebytes\\Anti-Malware\\mbam.exe on Windows endpoint with ID
8ee2a3a4-ca2b-4884-ae20-8b17d31837b6
        
`node ./load_workflow_insights.js --endpointId
8ee2a3a4-ca2b-4884-ae20-8b17d31837b6 --count 10 --os windows --antivirus
Malwarebytes --path 'C:\\Program
Files\\Malwarebytes\\Anti-Malware\\mbam.exe'`
2025-03-04 16:09:35 +01:00
Vitalii Dmyterko
847be917a6
[Security Solution][Detection Engine] adds bulkGetUserProfiles privilege to Security Feature (#211824)
## Summary

- addresses https://github.com/elastic/kibana/issues/202051

Few observations, based on ticket
[description](https://github.com/elastic/kibana/issues/202051):

1. User can update assignees in alert(i.e. update any alert details,
which is handled by **SecuritySolution** priv)
2. User can see suggested users in searchbox
3. User **can not** see assignees details(name, avatar) in alerts table
column and alerts flyout(that's where error toast originates from)

Why this happens?
2 different APIs used to show users in searchbox and user details in
alerts table column:

1. API to show users in searchbox:
[/internal/detection_engine/users/_find](https://github.com/elastic/kibana/blob/8.18/x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/routes/users/suggest_user_profiles_route.ts#L24)
It requires `securitySolution` privilege
2. API for alerts table cell:
[/internal/security/user_profile/_bulk_get](https://github.com/elastic/kibana/blob/8.18/x-pack/platform/plugins/shared/security/server/routes/user_profile/bulk_get.ts#L20)
It requires `bulkGetUserProfiles` privilege

User was configured with read only Security Feature, that covers only
first API, that's why we see error
> API [POST /internal/security/user_profile/_bulk_get] is unauthorized
for user, this action is granted by the Kibana privileges
[bulkGetUserProfiles] (403)

However `bulkGetUserProfiles` is covered by `Cases` feature already. If
Cases access will be set to read, user would be able to see assignees
details through `/internal/security/user_profile/_bulk_get` API.
It happens, because cases API tags include `bulkGetUserProfiles`
privilege:
https://github.com/elastic/kibana/blob/8.18/x-pack/platform/plugins/shared/cases/common/utils/api_tags.ts#L32,
https://github.com/elastic/kibana/blob/8.18/x-pack/solutions/security/packages/features/src/cases/types.ts#L7

This PR includes `bulkGetUserProfiles` privilege in Security Feature:
https://github.com/elastic/kibana/pull/211824. Since, it's already
present in Cases feature, and user profiles available through Security
Solution `/internal/detection_engine/users/_find` API
2025-03-04 15:08:41 +00:00
Nicolas Chaulet
601e4de6b8
[Fleet] Fix space selector space color,label for readonly spaces (#212941) 2025-03-04 16:08:25 +01:00
Bharat Pasupula
715a72fa18
[Automatic Import] Fix unstructured syslog flow (#213042)
## Summary

This PR fixes the Unstructured syslog flow. It picks up 5 samples send
them to LLM to create a pattern and tests all the samples against the
pattern , collects the unparsed samples [ if any ] , send them in for
next round of pattern check and so on.

This creates a list of patterns that matches all the samples and creates
a grok processor with those patterns and it breaks the syslogs down into
a JSON for ECS mapping , categorization and related graphs.

### 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] 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-03-04 16:02:14 +01:00
Zacqary Adam Xeper
367ff8dbec
[Response Ops] [Rule Form] Add Rule Form Flyout v2 (#206685)
## Summary

Part of #195211

Replaces the create/edit rule flyout with the new rule flyout

<img width="1032" alt="Screenshot 2025-01-14 at 3 12 30 PM"
src="https://github.com/user-attachments/assets/9cbcf4f8-1078-4f7e-a55a-aacc2d877a14"
/>
<img width="1383" alt="Screenshot 2025-01-14 at 3 12 52 PM"
src="https://github.com/user-attachments/assets/2270d57b-9462-4898-9dd0-41baefcc02d4"
/>

Restores the confirmation prompt before canceling or saving a rule
without actions defined.

Also fixes most of the design papercuts in the Actions step:

<img width="494" alt="Screenshot 2025-01-14 at 3 11 06 PM"
src="https://github.com/user-attachments/assets/3cf21d43-88e0-4250-b290-a545e1ebdbcf"
/>
<img width="494" alt="Screenshot 2025-01-14 at 3 11 01 PM"
src="https://github.com/user-attachments/assets/00ef3f95-c91b-4bb7-aead-a3e23c02f7df"
/>





### 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>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-04 16:52:58 +02:00
Katerina
a16dc711fb
[Perfomance] Add Inline documentation for TTFMP (#212393)
## Summary

closes https://github.com/elastic/observability-dev/issues/4101 

<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/4937722f-f05b-404b-9844-930e80c8e15e"
/>


### ⚠️ Instrumentation

Pass the `description` as metadata. The prefix [TTFMP] is required. 

### How to test

- Checkout the PR
- make sure you run `yarn kbn bootstrap`
- go to any page that has onPageReady function instrumented (ex
services)
2025-03-04 15:33:38 +01:00
Patryk Kopyciński
f74b6b52dc
Skip 'No connectors or conversations exist' on serverless (#213078)
## Summary

Fixes
https://buildkite.com/elastic/kibana-serverless-security-solution-quality-gate-gen-ai/builds/2139#_


![image](https://github.com/user-attachments/assets/0e2db8db-28d8-4097-968c-52a42b2e9b07)
2025-03-04 15:28:12 +01:00
Julia Bardi
72d760e5c3
[Fleet] fix telemetry test (#213050)
## Summary

Fix https://github.com/elastic/kibana/issues/211514

It seems the failure is because of the order difference in
`agent_logs_top_errors`.

The other differences shouldn't matter because we are using `
expect.objectContaining` on the result object.
2025-03-04 14:43:51 +01:00
James Gowdy
b26d85bd98
[ML] File upload enable consistent-type-imports eslint rule (#212044)
Enabling `consistent-type-imports` rule and running `node scripts/eslint
--no-cache --fix` to fix every type import.

Every other ML owned plugin has this rule enabled. Originally added in
https://github.com/elastic/kibana/pull/176921

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-04 12:57:23 +00:00
Alex Prozorov
17931c5c5b
[Cloud Security ]update csp README.md file i18n instructions (#213068)
## Summary
update i18 instructions regarding how to add and remove translations.
2025-03-04 14:49:53 +02:00
Ievgen Sorokopud
7db897a539
[Bug] [Assistant API] - Do not allow empty conversation ID in chat/complete route (#11783) (#213049)
## Summary

BUG: https://github.com/elastic/security-team/issues/11783

This PR fixes the behaviour of the
`/api/security_ai_assistant/chat/complete` route where the
`conversationId` can be passed as an empty string. This may lead to
unexpected results described in
https://github.com/elastic/security-team/issues/11783#issuecomment-2696529040.

### Expected behaviour

We should throw a bad request (400) http error when empty
`conversationId` has been passed.

### Testing

* Use this `curl` command to test the endpoint.

```
curl --location 'http://localhost:5601/api/security_ai_assistant/chat/complete' \
--header 'kbn-xsrf: true' \
--header 'Content-Type: application/json' \
--data '{
  "connectorId": "{{my-gpt4o-ai}}",
  "conversationId": "",
  "isStream": false,
  "messages": [
    {
      "content": "Follow up",
      "role": "user"
    }
  ],
  "persist": true
}'
```

You should see next error as a response:

```
{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "[request body]: conversationId: String must contain at least 1 character(s), conversationId: No empty strings allowed"
}
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-04 13:05:51 +01:00
Bharat Pasupula
8970b99d4f
Fix Incomplete string escaping or encoding (#212847)
Fix for
[https://github.com/elastic/kibana/security/code-scanning/546](https://github.com/elastic/kibana/security/code-scanning/546)

To fix the problem, we need to ensure that backslashes are also escaped
in the `trim_key` and `trim_value` properties of the `kvInput` object.
This can be done by adding an additional replace call to escape
backslashes before escaping single and double quotes. The best way to
fix this without changing existing functionality is to use a regular
expression with the `g` flag to replace all occurrences of backslashes
with double backslashes.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-03-04 13:05:05 +01:00
Alberto Blázquez
2473d5951a
Refactor Asset Inventory page (#212436)
## Summary

Refactors code in Asset Inventory page for simplicity and consistency.

### Changes

- Centralized constants for consistency
- Simplified `<AllAssets>` page, removed unused props, renamed
variables, etc...
- Encapsulated technical preview stuff into `<TechnicalPreviewBadge>`
- Removed deprecations in EUI components and styling

Also, this PR **deletes the mocked data** that was used before
integrating the UI with the backend.

### Questions

- Do we see value in centralizing all strings in a new file such as
`localized_strings.ts`?

### Out of scope

Hooks in `hooks/use_asset_inventory_data_table` and field selector
components were all duplicated from the CSP plugin. I haven't put effort
in refactoring those since we'll need to remove the duplication and make
them reusable

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

### Risks

No risk since code is still hidden behind the *Enable Asset Inventory*
advanced setting and the beta *Cloud Asset* integration must be
installed.
2025-03-04 12:28:12 +01:00
Stratoula Kalafateli
e24c1c3ee5
[ES|QL] Correct the lens_map_to_columns function call arguments (#213038)
## Summary

The else is being called atm only in Discover ES|QL mode, when the user
is typing stats or keep.
The `isTextBased` flag is missing which means that we don't call the
`mapToOriginalColumnsTextBased` but the one for the dsl mode which might
cause bugs.

I don't think that Peter had any reason to do so, it seems more as it
slipped.
2025-03-04 11:58:27 +01:00
Cristina Amico
aae11b0161
[Fleet] Remove wrong incorrect import from fleet server host service (#212918)
## Summary

Small follow up of https://github.com/elastic/kibana/pull/208091 

The editor autocompletion added an incorrect import and so I'm removing
it, plus a few comments that should have been removed.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-04 09:37:42 +01:00
Marco Antonio Ghiani
6e2a1033b8
[Streams 🌊] Enrichment - Fix broken results due to condition and add skipped metric (#212757)
## 📓 Summary

When the condition is not met, the processing simulation reports wrong
metrics and fails on a unhandler error.

This work fix the issue and also update the document simulation metrics,
reporting how many documents are skipped by a processor during the
simulation.

A follow-up work will update the filters on the date to better reflect
the available states of the documents (parsed, partially parsed,
skipped, failed).

<img width="701" alt="Screenshot 2025-02-28 at 12 47 10"
src="https://github.com/user-attachments/assets/1b6979e4-78a1-4db3-af72-faaf06c0e249"
/>
2025-03-04 07:43:30 +01:00
christineweng
6b6eb43183
[Security Solution] Alert flyout - fix suppressed alerts alignment (#213029)
## Summary

Ref: https://github.com/elastic/kibana/issues/204184

Before

![image](https://github.com/user-attachments/assets/d578194a-aaf4-45c1-bccb-42d02110be28)


After

![image](https://github.com/user-attachments/assets/b183a2ae-dd73-47d8-8319-984246309d98)


### Checklist

- [ ] 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-03-04 06:01:51 +00:00
christineweng
bac5c30e1c
[Security Solution][Document Flyout] Fix alert insights color order (#212980)
## Summary

Updated order of the insights, following from left to right `Low` to
`Critical`


![image](https://github.com/user-attachments/assets/3b40bca0-4f29-421d-af34-fbacb49486dc)

### 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] 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-03-03 22:16:15 -06:00
Jen Huang
8854433830
[UII] Add internal api that allows to create agent policy and its package policies (#212977)
## Summary

Resolves #206488. This PR introduces a new internal API that allows an
agent policy and its package policies to be created in one request:

<details>
<summary>⤵️ Expand for console snippet ⤵️</summary>

```
POST kbn:/internal/fleet/agent_and_package_policies
{
  "id": "jens-awesome-policy",
  "name": "awesome policy",
  "description": "",
  "namespace": "default",
  "package_policies": [
    {
      "policy_ids": [
        "jens-awesome-policy"
      ],
      "package": {
        "name": "log",
        "version": "1.1.2"
      },
      "name": "log-for-awesome-policy",
      "description": "",
      "namespace": "",
      "inputs": {
        "logs-logfile": {
          "enabled": true,
          "streams": {
            "log.log": {
              "enabled": true,
              "vars": {
                "paths": [
                  "/tmp/some-path"
                ],
                "data_stream.dataset": "generic",
                "tags": [],
                "custom": ""
              }
            }
          }
        }
      }
    },
    {
      "id": "fixed-id-for-filestream",
      "package": {
        "name": "filestream",
        "version": "1.0.1"
      },
      "name": "filestream-1",
      "description": "",
      "namespace": "",
      "inputs": {
        "filestream-filestream": {
          "enabled": true,
          "streams": {
            "filestream.generic": {
              "enabled": true,
              "vars": {
                "paths": [
                  "/var/log/*.log"
                ],
                "data_stream.dataset": "filestream.generic",
                "parsers": "#- ndjson:\n#    target: \"\"\n#    message_key: msg\n#- multiline:\n#    type: count\n#    count_lines: 3\n",
                "exclude_files": [
                  "\\.gz$"
                ],
                "include_files": [],
                "tags": [],
                "recursive_glob": true,
                "clean_inactive": -1,
                "harvester_limit": 0,
                "fingerprint": true,
                "fingerprint_offset": 0,
                "fingerprint_length": 1024,
                "exclude_lines": [],
                "include_lines": []
              }
            }
          }
        }
      }
    }
  ]
}
```
</details>

If successful, the response will be the agent policy with the full
nested package policies.

`id`s can be specified or omitted for either the agent or package
policy. If necessary, the resulting package policy's `policy_id` /
`policy_ids` will be updated with final ID of the created agent policy.

If any of the package policies fail to be created for any reason, there
is a rollback mechanism to delete the agent and package policies that
were already created.

The API also supports any query params that are supported by the create
agent policy and create package policy endpoints:
```
sys_monitoring: boolean; // passed to agent policy creation
format: 'simplified' | 'legacy; // passed to package policy creation
```

### Dev note
The new `createAgentAndPackagePoliciesHandler()` is unique in that it
acts mostly as a passthrough to other handlers,
`createAgentPolicyHandler` and `createPackagePolicyHandler`. This means
all the checks (spaces, rbac, etc) performed on the other handlers are
triggered appropriately.

### 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] 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-03-04 02:22:19 +00:00
Nathan Reese
037e8f58e0
[maps] globe projection (#212437)
<img width="600" alt="Screenshot 2025-02-25 at 11 35 32 AM"
src="https://github.com/user-attachments/assets/2567e20c-1223-4001-9866-edbe8c534350"
/>

PR does the following
* Updates maplibre to 5.1.1. Maplibre 5.0 introduced the globe
projection
* Updates sample data maps to use new globe projection
* Existing maps will use existing "mercator" projection
* Adds globe projection to newly created maps
* Adds `projection` setting, allowing users to switch between classic
"mercator" and new "globeInterpolate" projection
<img width="400" alt="Screenshot 2025-02-25 at 11 35 41 AM"
src="https://github.com/user-attachments/assets/5c55003b-dbe9-4adc-835c-0a2911c81074"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-03 18:31:05 -07:00
Patryk Kopyciński
f0d66691b8
[Security Assistant] Fix Product documentation installation banner (#212463)
## Summary

Fixes logic on fresh cluster where the ELSER was not started yet, in
this case API reports `status` as `uninstalled`, but it doesn't mean
that the Product documentation was actually uninstall, but rather it's a
default state.
Added internal `product_documentation_status` to KB status API to make
sure we keep track of the status internally and present the banner only
if the docs were intentionally uninstalled

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-04 02:28:35 +01:00
Michael Olorunnisola
750e156c26
[Performance][Security Solution][1/4] - Field Browser Performance (#212469)
## Summary
Part 1 of https://github.com/elastic/kibana/pull/212173

### Testing
For setup see testing section here:
https://github.com/elastic/kibana/pull/212173#issue-2870522020

**Areas to test:**
- Alert Table (Alerts, Rule Detail, Rule Preview pages)
- Security solution field browser component
- Flyout table tab.

### Background

When investigating the performance of the security solution application,
one of the issues that was observed was locking of the page and field
browser component when the total number of fields returned were
significantly high.

This led to cell values not rendering in the alert table, and the field
browser in all the security solution pages causing the page to crash.
The relevant images can be seen at the bottom of this description

In short: The `push(...fields)` is non-performant at scale, and at a
significant enough scale (Testing was done with 500k mapped fields),
fails to run due to excessive arguments provided to the `push` method.
In this PR improvements are made in the `browserFields` transformations
that are done for the field browser component, expandable flyout table
tab, and alert/rule tables via `CellValue` component.

This work was done to get immediate improvements in the security
solution UI, but a longer term consideration will be whether or not the
`browserFields` is even necessary anymore as a concept based on what is
available via the `fields` api. We will revisit once our Sourcerer
refactoring work is done.

<img width="1728" alt="Screenshot 2025-02-26 at 10 15 29 AM"
src="https://github.com/user-attachments/assets/a25f577f-f758-415e-9c93-5452eadb8020"
/>

<img width="1445" alt="Screenshot 2025-02-26 at 10 18 36 AM"
src="https://github.com/user-attachments/assets/d70970d3-991a-47ba-b617-5862d18101b6"
/>

<img width="1469" alt="Screenshot 2025-02-26 at 10 19 48 AM"
src="https://github.com/user-attachments/assets/1767aa9b-66ab-46be-bc1a-5311630c2765"
/>


![image](https://github.com/user-attachments/assets/5d746b21-fa9b-425b-826a-cc7abd444f21)


![image](https://github.com/user-attachments/assets/4dff2378-d61b-4770-b46b-41cb37d6ead4)


### After the fix
(Done on [this branch](https://github.com/elastic/kibana/pull/212173)
that has the other changes as well)


https://github.com/user-attachments/assets/da992296-4eb8-49d4-96ca-b0a19a00f1f0


### 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-03-03 20:22:25 -05:00
Christophe Alladoum
e9813b8c72
[Elastic Defend] Add windows.ransomware.dump_process for endpoint advanced policy setting (#212439)
## Summary

This PR exposes `windows.ransomware.dump_process` as an advanced policy
option for Elastic Defend.
If enabled, this option will make the endpoint generate a memory dump of
the ransomware process before killing it, assisting the ransomware
investigation process.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-03 16:57:20 -08:00
Viduni Wickramarachchi
ec127e271c
[Obs AI Assistant] Improve instructions for the summarize function (#212936) 2025-03-03 18:56:55 -05:00
Tiago Costa
bee6ba88c9
skip flaky suite (#206204) 2025-03-03 21:20:02 +00:00
Michael Olorunnisola
98b52804d5
[Performance][Security Solution][3/4] - Sourcerer performance (#212482)
## Summary
Part 3 of https://github.com/elastic/kibana/pull/212173

### Testing
For setup see testing section here:
https://github.com/elastic/kibana/pull/212173#issue-2870522020

Testing this work is a bit more `console.log` related, as the primary
aim of many of these changes was to limit the amount of re-renders
caused by state changes within many of the sourcerer utils. React is
relatively fast at handling many of these re-renders, but considering
the widespread usage of `useSourcererDataView` and the top level
location of `useInitSourcerer`, it was worth taking care of some low
hanging fruit.

### Background

The changes in this PR centered around limiting the number of re-renders
that were being caused unnecessarily in `useSourcererDataView` and
`useInitSourcerer` by identifying some quick wins.

Comments regarding the changes can be found in the PR diffs


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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-03-03 16:06:38 -05:00
Steph Milovic
095fc222aa
[Security Assistant] Conversation pagination refactor (#211831) 2025-03-03 13:41:20 -07:00
Julia Bardi
d2913395af
[Fleet] fix latest_executed_state error (#212935)
Fix schema validation error when `latest_executed_state: {}`.

The logic sets an empty object here:
63394e6bfd/x-pack/platform/plugins/shared/fleet/server/services/epm/packages/install_state_machine/steps/update_latest_executed_state.ts (L63)
This caused an error on the Integration Details page:

`Failed output validation: [response
body.items.4.installationInfo.latest_executed_state.name]: expected
value of type [string] but got [undefined]`

Tested locally by manually updating `latest_executed_state` to `{}`, now
the `/epm/packages` API works as expected.

<img width="1459" alt="image"
src="https://github.com/user-attachments/assets/bbee7787-93a7-4099-ba9b-ff5d031f7637"
/>
2025-03-03 18:07:28 +00:00
Michael Olorunnisola
7f32eb0225
[Performance][Security Solution][4/4] - General Performance changes (#212488)
## Summary
Part 4 (Final) of https://github.com/elastic/kibana/pull/212173

### Testing
For setup see testing section here:
https://github.com/elastic/kibana/pull/212173#issue-2870522020

For testing, feel free to add a `console.count('!! - Number of
re-renders:)` to
`x-pack/solutions/security/plugins/security_solution/public/app/home/index.tsx`.
The memoization changes
[here](https://github.com/elastic/kibana/pull/212488/files#diff-b0cdd6dc57dd06dba69d90894de8c88a7bb7c71c0e58753f324eb8ba664a0782R18)
to the plugin template wrapper, prevented 2 extra re-renders, but there
is still an underlying problem of how the `PageTemplateWrapper` is used,
as it causes unmounting and remounting of the security views when
navigating between pages.

The only other change was to rely on React's built in diffing on the
alerts page for the page level filters
2025-03-03 12:59:43 -05:00
Yuliia Naumenko
7afe813b35
[AI Assistant] Fixed DataClient find method to pass fields param to esClient.msearch (#212465)
Fixed `AIAssistantDataClient` to send values of the `fields` param if is
provided to `esClient.msearch` request.

To test run the API query
`http://localhost:5601/api/security_ai_assistant/current_user/conversations/_find?page=1&per_page=99&fields=id,users,apiConfig.connectorId`
and makes sure the only provided fields are returned in the result.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-03 17:43:16 +00:00
Angela Chuang
24d2cd3e4f
[SecuritySolution] Fix add to library action (#212659)
## Summary

Add to library actions are not working.
Issue description and steps to reproduce:
https://github.com/elastic/kibana/issues/212650


Update according to SaveModalComponent change:
https://github.com/elastic/kibana/pull/186642/files#diff-137261ad728b083fd39cb5d6b58d7afd3d4c4e24749b78609a9aa4b3c63e4170R290


https://github.com/user-attachments/assets/a0d0e81e-5a0f-4462-b110-370894c6bf36

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
2025-03-03 16:33:10 +00:00
Kibana Machine
3fc5022e13 skip failing test suite (#211517) 2025-03-04 02:54:04 +11:00
Kibana Machine
54fb155467 skip failing test suite (#211516) 2025-03-04 02:53:33 +11:00
Julia
6ce22f4a33
[ResponseOps][MW] Allow users to delete MWs (#211399)
Resolve: https://github.com/elastic/kibana/issues/198559
Resolve: https://github.com/elastic/kibana/issues/205269

Here I used the existing DELETE
/internal/alerting/rules/maintenance_window/{id} API to delete MWs from
the UI.
I added an action to the MW table so users can delete MWs. And show a
delete confirmation modal when users delete a MW from the UI.

### 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
- [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
2025-03-03 16:20:31 +01:00
Alberto Blázquez
ed30926f0f
Remove page and links to Cloud Defend from Assets (#212753)
## Summary

Closes:
- https://github.com/elastic/security-team/issues/11933.

Continues work on:
- https://github.com/elastic/kibana/pull/200895.

### Acceptance criteria

- `9.0` / `Serverless`: 
- Removes links to Cloud Defend from Assets page in Security Solution.
- Disables navigation to `app/security/cloud_defend/` redirecting to the
default `app/security/get_started/`.
- `8.x` / `8.18`: 
- No changes (impact is minimal, only affects 4 customers who were told
to uninstall the plugin)

### Screenshot

<details><summary>Before - Assets page</summary>
<img width="1749" alt="Screenshot 2025-02-27 at 19 35 38"
src="https://github.com/user-attachments/assets/0bb076bc-984a-45be-bff8-63fe62ba6571"
/>
</details> 

<details><summary>Before - Cloud Defend page</summary>
<img width="1736" alt="Screenshot 2025-02-27 at 19 36 57"
src="https://github.com/user-attachments/assets/3f4f80b0-869d-48a9-90a3-70d03a37c7f6"
/>
</details>

<details><summary>After - Assets page</summary>
<img width="2006" alt="Screenshot 2025-02-28 at 12 12 11"
src="https://github.com/user-attachments/assets/3ef4bfb2-6b0b-4a77-83ea-cc7b9f54e37f"
/>
</details> 

<details><summary>After - Cloud Defend page redirects to
get_started/siem_migrations </summary>
<img width="2011" alt="Screenshot 2025-02-28 at 11 25 43"
src="https://github.com/user-attachments/assets/2ddafd46-7629-44fe-9234-049f09bc6b71"
/>
</details>

### How to test

Authenticate to Docker Registry with
```bash
docker login -u <YOUR_USER> -p <YOUR_PASSWORD> docker.elastic.co
```

Then run ES with

```bash
yarn es serverless --projectType security --kill
```

In a second terminal, run Kibana with
```bash
yarn serverless-security
```

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

We should not show more links to Cloud Defend in other parts of the app
because the feature was deprecated and it might confuse end users. But
there's no risk of breaking the app because navigation is handled
correctly.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-03 14:52:04 +00:00
Kenneth Kreindler
d37fcb6fb6
[Security Solution] [GenAi] refactor security ai assistant tools to use tool helper method (#212865)
## Summary

Clean up some security ai assistant code.

- Replace the usage of `new DynamicStructuredTool()` with the `tool()`
helper method. This is the recommended approach today and has the
correct types to work with
[`Command`](https://langchain-ai.github.io/langgraphjs/concepts/low_level/#command).
- Extract code such as the default assistant graph state and
agentRunnableFactory to reduce cognitive overload.
- Update AssistantTool type definition

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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
- [X] 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)
- [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)

### 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-03-03 14:35:22 +00:00
Dmitrii Shevchenko
c4a016eda3
[Security Solution] Reduce the _review rule upgrade endpoint response size (#211045)
**Resolves: https://github.com/elastic/kibana/issues/208361**
**Resolves: https://github.com/elastic/kibana/issues/210544**

## Summary

This PR introduces significant memory consumption improvements to the
prebuilt rule endpoints, ensuring users won't encounter OOM errors on
memory-limited Kibana instances.

Memory consumption testing results provided in
https://github.com/elastic/kibana/pull/211045#issuecomment-2689854328.

## Details

This PR implements a number of memory usage optimizations to the
prebuilt rule endpoints with the final goal reducing chances of getting
OOM errors. The changes are extensive and require thorough testing
before merging.

The changes are described by the following bullets

- The most significant change is the addition of pagination to the
`upgrade/_review` endpoint. This endpoint was known for causing OOM
errors due to its large and ever-growing response size. With pagination,
it now returns upgrade information for no more than 20-100 rules at a
time, significantly reducing its memory footprint.
- New backend methods, such as
`ruleObjectsClient.fetchInstalledRuleVersions`, have been introduced.
These methods return rule IDs with their corresponding installed
versions, allowing to build a map of outdated rules without loading all
available rules into memory. Previously, all installed rules, along with
their base and target versions, were fetched unconditionally before
filtering for updates.
- The `stats` data structure of the review endpoint has been deprecated
(it can be safely removed after one Serverless release cycle). Since the
endpoint now returns paginated results, building stats is no longer
feasible due to the limited rule set size fetched on the server side. As
the side effect it required removing related Cypress tests asserting
`Update All` disabled when rules can't be updated.
- All changes to the endpoints are backward-compatible. All previously
required returned structures still present in response. All newly added
structures are optional.
- Upgradeable rule tags are now returned from the prebuilt rule status
endpoint.
- The frontend logic has been updated to move sorting and filtering of
prebuilt rules from the client side to the server side.
- The `upgrade/_perform` endpoint has been rewritten to use lightweight
rule version information rather than full rules to determine upgradeable
rules. Additionally, upgrades are now performed in batches of up to 100
rules, further reducing memory usage.
- A dry run option has been added to the upgrade perform endpoint. This
is needed for the "Update all" rules scenario to determine if any rules
contain conflicts and display a confirmation modal to the user.
- An option to skip conflicting rules has been added to the upgrade
endpoint when called with the `ALL_RULES` mode.
- The `install/_review` endpoint's memory consumption has been optimized
by avoiding loading all rules into memory to determine available rules
for installation. Redundant fetching of all base versions has also been
removed, as they do not participate in the calculation.

---------

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
2025-03-03 15:03:07 +01:00
Julia Bardi
3e2373fd08
[Fleet] sync integrations from follower index (#212371)
## Summary

Relates https://github.com/elastic/kibana/issues/206242

Implemented installing integrations from the doc in the follower index.
Can be tested locally by creating the ccr index locally or setting up 2
local clusters and set up ccr between them.

To test:
- Requires https://github.com/elastic/elasticsearch/pull/123493,
checkout and run es from source
```
yarn es source --license trial -E xpack.security.authc.api_key.enabled=true -E xpack.security.authc.token.enabled=true  --source-path=/Users/juliabardi/elasticsearch  -E path.data=/tmp/es-data -E xpack.ml.enabled=false
```
- Enable feature flag `xpack.fleet.enableExperimental:
['enableSyncIntegrationsOnRemote']`
- Create doc in ccr index, `hosts` should match local elasticsearch host
```
POST fleet-synced-integrations-ccr-remote1/_doc
{
  "id": "fleet-synced-integrations",
 "remote_es_hosts": [
            {
              "hosts": [
                "http://192.168.64.1:9200"
              ],
              "name": "remote1",
              "sync_integrations": true
            }
          ],
          "integrations": [
            {
              "package_version": "1.25.0",
              "package_name": "nginx",
              "updated_at": "2025-02-24T09:03:51.936Z"
            }
          ]
}
```
- Wait 1m until the task runs, verify that the integrations from the doc
are installed


### 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
2025-03-03 14:21:25 +01:00
Gergő Ábrahám
e4ea87e92b
[EDR Workflows][Investigation] Telemetry config watcher fix (#210406)
## Summary

To update the `global_telemetry_config` flag in Defend package policies,
we subscribe to the Telemetry plugin's `isOptedIn$` observable during
Kibana's `start()` phase, and receive the initial value immediately.
This feature is used for 'migrating' existing package policies: after
stack upgrade, when Kibana starts up, this subscription mechanism makes
sure that existing policies are backfilled with the new field.

But not on cloud and serverless instances.

It turned out, that while this works on local instances, on cloud and
serverless instances, at the very moment we receive the value during
`start()`, some mechanisms are not yet green, and this resulted in
`security_exception: missing authentication credentials for REST
request` when trying to read Saved Objects.

As subscribing to`core.status.core$`, and waiting until `ServiceStatus`
for `elasticsearch` and `savedObjects` is `available` didn't solve the
issue, I simply added a retry mechanism, which, at least, protects
against other temporary issues as well.

Some additional logging is added as well.

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

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-03-03 12:31:00 +00:00