Commit graph

1988 commits

Author SHA1 Message Date
Ersin Erdal
ed02db1782
Connector Rate Limiter (#224784)
This PR adds a rate limiter to control connector usage rate limiting.
It supports only `email` connector for now, but the other connectors can
be added by adding their connectorTypeId to the `validConnectorTypeIds`
list.

## To validate:

Add the below config to your `kibana.yml`
```
xpack.actions.rateLimiter.email
  lookbackWindow: '310s'
  limit: 4
```

And create a rule that triggers an email action every 1 minute.
On the 5th execution you should see an error message like: `Action
execution rate limit exceeded for connector: .email`

30 seconds after that the action should be successfully retried.

You can test with other connectors as well (e.g. .server-log). In order
to do that, the connectorTypeId should be added to the
`validConnectorTypeIds` list in the config file.
`const validConnectorTypeIds = new Set(['email']);` -> `const
validConnectorTypeIds = new Set(['email','server-log']);`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-27 23:37:54 +02:00
Ievgen Sorokopud
b5728f818b
[BUG][Attack Discovery][Scheduling] Handle whitespaces within the markdown value section (#225595)
## Summary

These changes fix the issue with the markdown fields that we return
within the action's context for Attack Discovery Schedules.

Right now if the second part (the `value`) of the `{{ field value }}`
elements within the details markdown fields has whitespaces the RegEx
won't capture those and thus we will not transform them into a desired
format - `value`.

With the help of gemini I generated the expression that handles
whitespaces within the value part:

```
new RegExp('{{\\s*(\\S+)\\s+(.*?)\\s*}}', 'gm');
```

### Gemini reasoning

To fix your RegEx and capture substrings like `{{ file.hash.sha256 fake
file sha256 }}`, you need to modify the second capturing group to allow
for spaces.

Here's the corrected RegEx: `{{\s*(\S+)\s+(.*?)\s*}}`

Here's a breakdown of the changes:

* `(\S+)`: This remains the same, capturing the first part (e.g.,
`host.name`, `file.name`, `file.hash.sha256`) which does not contain
whitespace.
* `(.*?)`: This is the key change.
* `.`: Matches any character (except newline).
* `*`: Matches the preceding character zero or more times.
* `?`: Makes the `*` quantifier non-greedy, meaning it will match the
shortest possible string. This is important to prevent it from matching
across multiple `{{ ... }}` blocks if they were on the same line.

This updated RegEx will now correctly capture both
`835a4be1-8f35-431f-93a0-c89935726b2e` and `fake file sha256` as the
second captured group.

### RegExp testing

https://regexr.com/

<img width="2043" alt="Screenshot 2025-06-27 at 10 51 21"
src="https://github.com/user-attachments/assets/e0f13c1b-a1d7-477e-9fdd-1624919395f1"
/>
2025-06-27 23:12:26 +02:00
Melissa Alvarez
536ddcc0e5
[ML] Inference endpoints UI serverless: enable adaptive allocations and allow user to set max allocations (#222726)
## Summary

Related issue: https://github.com/elastic/kibana/issues/221827

The changes in this PR for now will only apply in serverless. 

This PR adds the following changes in a serverless environment:
- removes the allocations/threads input fields from the inference
endpoints UI creation and replaces it with an input for max allocations
- adds informative text for the user when adaptive allocations will be
enabled
- always sets adaptive allocations to be enabled and min_allocations to
0

Entry points tested: 

- Inference endpoints list page > `Add endpoint` button
- Playground > `Connect to an LLM` button
- Connectors list page > `Create connector button`
- AI Assistant > `Set up GenAI Connector` button
- Index management > create index with mapping > add semantic text field


![image](https://github.com/user-attachments/assets/d011b596-ee37-4ad4-acea-79719b4a8ce0)



## TASKS
~~- [ ] implement helper class to calculate appropriate value for
`num_threads` based on max allocations specified by the user. This will
be done keeping in mind that it will be optimized for search with high
resource use.~~
- ML nodes will set a default number of threads in serverless trained
model APIs - this will require a backend change (I will link PR here
when available)
- Until that change is made, `num_allocations` will be defaulted to 1 as
the endpoint currently requires that parameter
- [x] minimum allocations will always be 0
- [x] Add serverless check in AI Connector to ensure behavior is the
same


## TO NOTE
The field overrides added are a temporary solution until the endpoint
returning the service's configurable fields can be updated.

As the code is shared with the AI Connector - this behavior will also
apply for Elasticsearch service when on serverless.

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-27 15:12:07 -06:00
Sean Story
1e06468880
Document Feature Flag for tools page (#225707)
## Summary

Noticed that
https://github.com/elastic/kibana/pull/224330/files#diff-4720f9a7b336b67d1811ff3f3ee908ebd4edcc7b8c6b7105cba33890446f1b7eR502
wasn't in the plugin README
2025-06-27 20:59:31 +00:00
Meghan Murphy
53bcb6ea7d
[ESQL based tools] POC for creating an ESQL tool (#222715)
## Summary

This PR adds the ability for users to create and manage their own ESQL
based tools through API endpoints `/api/chat/tools/esql`. The tools are
persisted into a hidden index that serves as the source of truth for the
ESQL Tool Provider that is registered on start to manage the tools and
expose them to the Onechat registry.

**ESQL Tools**

- The tools follow a common schema when being created
```
          id: schema.string(),
          name: schema.maybe(schema.string))
          description: schema.string(),
          query: schema.string(),
          params: schema.recordOf(
            schema.string(),
            schema.object({
              type: schema.string(),
              description: schema.string(),
            })
          ),
          meta: schema.object({
            tags: schema.arrayOf(schema.string(), { defaultValue: [] }),
          }),
```

- Queries follow this pattern `"FROM my_cases | WHERE case_id ==
?case_id | LIMIT 1"` where parameters that are needed to execute the
query are shown with a '?'.

- this feature is under a feature flag so you will need to update you
`kibana.yml `file with

```
uiSettings.overrides:
  onechat:esqlToolApi:enabled: true
```

Not in the PR:

- `_execute` endpoint to test tools




https://github.com/user-attachments/assets/7e25b7e2-5190-4dfc-8dbc-3afd20982706



### 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)
- [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
- [ ] 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
- [ ] 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: Sean Story <sean.j.story@gmail.com>
2025-06-27 15:44:26 -04:00
Julian Gernun
1914673ca3
[Response Ops] Fix cases action owner on o11y serverless project (#224537)
## Summary

Serverless observability project would throw when creating a rule with a
system case action.

`Action 'system-connector-.cases' failed: an error occurred while
running the action: Failed to bulk create cases: Error: Unauthorized to
create case with owners: "cases"`

To fix it, we set the owner to be the serverless project type and if
serverless but unknown, we default the owner to "cases"

### How to test

1. Start ES with cloud projectId flag like this: `yarn es serverless
--projectType=oblt -E xpack.cloud.serverless.project_id: test-123`
2. Go to management rules page by searching for `rules` in the top
searchbar

![image](https://github.com/user-attachments/assets/d0df7cf4-74e6-4e7d-86b0-3871614116d2)


3. Create a stack rule (index threshold) and add the cases action
4. When an alert is triggered confirm you can view the case in the cases
page

---------

Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
2025-06-27 18:25:52 +01:00
Umberto Pepato
c85c7d62aa
[ResponseOps][Reporting] Add callout to scheduled reports flyout when no supported report type is available (#225597)
## 📄 Summary

- Adds a callout to the Scheduled reports flyout when none of the
available report types is supported for scheduling to avoid showing the
flyout with an empty type selector
- Adds `csv_v2` to the list of supported report types

<details>
<summary>

## 🧪 Verification steps

</summary>

### No supported report type for scheduling
- If you don't have data in Kibana, navigate to Home > Try sample data
and activate a sample data set
- Create a role (and relative test user) with access to some ES indices,
a license != `basic` and privilege for Visualize Library without
subfeature privilege for scheduling PDF and PNG reports:
<img width="723" alt="image"
src="https://github.com/user-attachments/assets/7e413a51-8d14-4b3b-af9d-24f82e6f9ea6"
/>
- Log in with the unprivileged user and navigate to `Analytics >
Visualize Library`, then create a visualization of type Lens
- Drag any field in the lens UX so that the ⬇️ (Export) menu in the
toolbar becomes clickable and click it
- Click on `Schedule export`
- Check that the flyout shows a warning callout for unsupported report
types

#### csv_v2 support
- Log in as an admin or user with access to Discover
- Navigate to Discover, toggle ES|QL mode
- Open the ⬇️ (Export) menu in the toolbar
- Click on `Schedule export`
- Check that the `CSV` option is available and scheduling works
correctly

</details>

<details>

<summary>

## 🐞 Known issues

</summary>

The CallOut for missing report types is a temporary solution until we
can hide the schedule button altogether (this requires changes in the
SharedUX share menu API)

</details>

<details>

<summary>

## 📷 Screenshots

</summary>

Warning CallOut

![image](https://github.com/user-attachments/assets/dd1eaf2e-22d7-451f-b6bd-4b57ad05d664)


</details>

## 🔗 References

Refs #225606
2025-06-27 19:30:41 +03:00
Alberto Blázquez
e4f5392392
[Cloud Security] [Graph Vis] Add show events/alerts details action to popover (#222844)
## Summary

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

Adds `Show event details` option to events & alerts' popover in the
Graph Visualization component.

<details>
<summary>Video 🎥  </summary>


https://github.com/user-attachments/assets/7137535b-961c-43c3-ad4b-cad5f29af07b

</details>

<details>
<summary>Screenshots 📸 </summary>

**Show event details popover**

![Screenshot 2025-06-26 at 21 42
36](https://github.com/user-attachments/assets/8ce8575d-7eb1-4d45-a0d8-51776ff24f77)

**Based on type, we show a different text:**

![Screenshot 2025-06-26 at 21 28
55](https://github.com/user-attachments/assets/16919764-7653-4382-a96b-a3c456ada676)
![Screenshot 2025-06-26 at 21 29
03](https://github.com/user-attachments/assets/cd1710d3-eb89-4e99-a329-5dfa01f0602d)
![Screenshot 2025-06-26 at 21 29
09](https://github.com/user-attachments/assets/3e9c0ad0-7df7-4740-a62a-10514a6a9ad0)

**When document data is not available:**
![Screenshot 2025-06-26 at 21 29
19](https://github.com/user-attachments/assets/3508108e-0292-428f-8522-771f4e1e7b6a)

**Storybook enhancement, added `supportNodePreviewPopover`**


https://github.com/user-attachments/assets/41db17a5-0ebb-45c9-a5b7-dc712fc8330f

</details>

### How to test - In Kibana

1. Edit `kibana.dev.yml` and add:

```yml
uiSettings.overrides.securitySolution:enableGraphVisualization: true
```

2. Start elasticsearch and kibana locally
3. To add mock data run the following:

```bash
node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \
 --es-url http://elastic:changeme@localhost:9200 \
 --kibana-url http://elastic:changeme@localhost:5601

node scripts/es_archiver load x-pack/solutions/security/test/cloud_security_posture_functional/es_archives/security_alerts \
 --es-url http://elastic:changeme@localhost:9200 \
 --kibana-url http://elastic:changeme@localhost:5601

```

3. Open `Alerts` page in kibana. Update the date-picker to include data
from a year ago. Then check one of the alerts details opening the
right-side flyout and find the "Graph preview" section in it.
4. Open event details (for now, we show event details for alerts as
well, https://github.com/elastic/kibana/issues/221037 will fix that
later)

### How to test - In Storybook

1. Run in terminal:

```bash
yarn storybook cloud_security_posture_graph
```

2. Open [http://localhost:9001/](http://localhost:9001/).

3. Clicking on the _Show event details_ action in the popover won't open
any flyout though (we don't render flyouts in Storybook at least yet).
Instead, you can see an action is being logged

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

### Identify risks

No risk, feature is gated under the
`securitySolution:enableGraphVisualization` UI setting.

---------

Co-authored-by: Kfir Peled <61654899+kfirpeled@users.noreply.github.com>
Co-authored-by: Kfir Peled <kfir.peled@elastic.co>
2025-06-27 09:59:00 -05:00
Alex Szabo
785f7498c6
fix type error - narrow type after find (#225647)
## Summary
Fixing a type error coming from a potential race-merge situation. 
https://github.com/elastic/kibana/pull/222816 +
https://github.com/elastic/kibana/pull/224801
2025-06-27 16:57:55 +02:00
Charis Kalpakis
c75f67970e
[ska][x-pack] Move canvas, watcher and dev_tools functional tests 2025-06-27 17:20:22 +03:00
Anton Dosov
fe9dcf751a
[Workspace Chrome] Bootstrap grid layout for classic nav (#224255)
> [!IMPORTANT]
> **Should be no user-facing changes!!!** The new layout work is behind
a feature flag!

> [!IMPORTANT]  
> This bootstraps new grid layout for chrome using a feature flag. It
only works with classic nav and hack a lot of bugs and EUI-related
workarounds, but the overall code structure and approach can be reviewed
and merged to main.


## Summary

Part of [workspace
chrome](https://github.com/elastic/kibana-team/issues/1581 ) work. In
this PR we lay down the ground work for new grid layout that will power
Kibana's chrome. This is done by introducing **a feature flag** with
which Kibana can switch between "legacy-fixed" layout and new "grid"
layout.


![Image](https://github.com/user-attachments/assets/8d91ef37-f17e-4cee-980b-23834d81290e)

Proper detailed figma link:
https://www.figma.com/design/10ca4AhnWDkyJklUDXnHg5/Sidebar?node-id=5192-259808&p=f&m=dev


kibana.yml:
```
feature_flags.overrides:
  core.chrome.layoutType: 'grid'
```

For this, in-between `rendering_service` and `chrome_service` a new
`layout_service` was introduced the goal of which is to aggregate stuff
from chrome service and compose it together using the needed layout.
There are two implementations for `layout_service`:
- `LegacyFixedLayout` - old one, just code refactor, should still work
as in main
- `GridLayout`- new one, mostly works, but only for classic nav, for
now, and with bunch of hacks and bugs that we will resolve over time

The switch is in `rendering_service` based on a feature flag: 

```tsx
const layout: LayoutService =
      layoutType === 'grid'
        ? new GridLayout(renderCoreDeps)
        : new LegacyFixedLayout(renderCoreDeps);

    const Layout = layout.getComponent();

    ReactDOM.render(
      <KibanaRootContextProvider {...startServices} globalStyles={true}>
        <Layout />
      </KibanaRootContextProvider>,
      targetDomElement
    );`
```

To see the grid and new layout in action there is a helpful `debug` flag
that displays not yet used elements of new layout:

kibana.yml:
```
feature_flags.overrides:
  core.chrome.layoutType: 'grid'
  core.chrome.layoutDebug: true
```


https://github.com/user-attachments/assets/9e4ad1d9-ed23-41ab-b029-254f7511136d




### Other clean ups 

- Migrate `.chrHeaderBadge__wrapper`, `. chrHeaderHelpMenu__version`,
`breadcrumbsWithExtensionContainer` to emotion on simplify global css of
chrome
- remove `getIsNavDrawerLocked` and related css since not used 
- Small unzyme 

### TODO

- [x] fix solution nav in management 
- [x] make sure solution nav works with header 
- [x] fix dashboard full screen mode
- [x] check discover eui grid full screen
- [x] check chromeless mode
- [x] Follow up on EUI related hacks
https://github.com/elastic/eui/issues/8820
- [ ] Misaligned console in search solution 
- [ ] Miaaligned secondary nav in security solutions
- [ ] double scroll in discover push flyout


## How to review 

1. Most importantly, we need to ensure that nothing is broken in the old
layout during the refactor. - Functional tests + visual/manual testing
2. Then for the new layout: 

kibana.yml:
```
feature_flags.overrides:
  core.chrome.layoutType: 'grid'
  core.chrome.layoutDebug: true
```

- Check that it mostly works (some specific edge cases and bugs are
fine)
- Code-review:  focus on the layout implementation split approach
2025-06-27 16:08:47 +02:00
Ying Mao
f43138c059
[Response Ops][Reporting][Task Manager] Allow setting dtstart in rrule schedule - schema changes only for intermediate release (#224979)
## Summary

This PR contains the schema changes needed to support using `dtstart` in
task manager rrule schedules. This is meant for intermediate release and
then the changes will be used in this PR:
https://github.com/elastic/kibana/pull/224948

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-27 10:05:28 -04:00
Zachary Parikh
3ef270c167
[OneChat] Simple Chat UI (#222816)
## Summary


https://github.com/user-attachments/assets/47cf7b8e-fb43-43c8-b6b4-e7a379660d80


### 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: Jedr Blaszyk <jedr.blaszyk@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-27 09:30:15 -04:00
Peter Pisljar
180f90a65c
freeze response (#222160) 2025-06-27 15:00:07 +02:00
Dzmitry Lemechko
10cc7b3c62
[ska] relocate 'shared/lib/security' helpers to 'osquery/cypress' dir (#225438)
## Summary

This PR removes `kbn/test-suites-serverless` as kbn reference for
osquery/cypress test-helper module in order to fix circular dependency I
faced in https://github.com/elastic/kibana/pull/225377

Since the main consumer of that `shared/lib/security` code is
`osquery/cypress` test module, I believe it is a resonable change in
order to unblock us relocating tests from `x-pack/test` dir.
2025-06-27 14:50:52 +02:00
Ying Mao
ac8b1c5b5f
Fixes Failing test: X-Pack Alerting API Integration Tests.x-pack/platform/test/alerting_api_integration/security_and_spaces/group2/tests/actions/execute·ts - alerting api integration security and spaces enabled - Group 2 Connectors execute no_kibana_privileges at space1 should log api key information from execute request (#225555)
Resolves https://github.com/elastic/kibana/issues/224987

## Summary

This test was failing the ES snapshot promotion pipeline. See in the
logs:

```
[00:04:15]             │ proc [kbn-ui] [2025-06-26T17:44:06.841+00:00][WARN ][plugins.eventLog] invalid event logged: [kibana.user_api_key.managed_by]: definition for this key is missing; {"@timestamp":"2025-06-26T17:44:06.840Z","event":{"provider":"actions","action":"execute","kind":"action","start":"2025-06-26T17:44:06.762Z","end":"2025-06-26T17:44:06.840Z","duration":"78000000","outcome":"success"},"kibana":{"saved_objects":[{"rel":"primary","type":"action","id":"c4a64b3b-e5f5-4ffc-a58c-98584b6b5e59","type_id":"test.index-record","namespace":"space1"}],"space_ids":["space1"],"action":{"name":"My Connector","id":"c4a64b3b-e5f5-4ffc-a58c-98584b6b5e59","type_id":"test.index-record","execution":{"uuid":"ecbbf89f-729a-416c-a711-05b0a1e27de6","source":"http_request","usage":{"request_body_bytes":0}}},"user_api_key":{"managed_by":"elasticsearch","name":"test user managed key","id":"r1RWrZcB4HDiQQlB8SOM"},"server_uuid":"5b2de169-2785-441b-ae8c-186a1936b17d","version":"9.1.0"},"user":{"name":"elastic"},"message":"action executed: test.index-record:c4a64b3b-e5f5-4ffc-a58c-98584b6b5e59: My Connector","ecs":{"version":"1.8.0"}}) {"service":{"node":{"roles":["ui"]}}}
```

So it looks like the `api_key` information now returns a `managed_by`
field which we were copying over to the event log but was not accepted
by the event log schema. Updated the code to only copy over the `name`
and `id` field to address this. Can open a followup issue to see if we
want to copy over the `managed_by` field.
2025-06-27 08:17:58 -04:00
Eleonora
b3573364cf
Add docs for chat/complete public API (#224235)
## 26/06 Edits

Following discussion with the team, made the following changes:
* Modified curl and request and response examples with more appropriate
examples

## 20/06 Edits

Following discussion with the team, made the following changes:
* Removed `query` parameter from the API, and therefore removed it from
docs
* Made API return OpenAI format by default
* Removed `unredactions` property from public API schema and removed it
from docs

## Summary

Closes https://github.com/elastic/obs-ai-assistant-team/issues/193

Add docs for chat/complete public API.

## Steps to view documentation
1. checkout branch
2. Install bump-cli if you don't already have it:
https://docs.bump.sh/help/continuous-integration/cli/
3. Go to kibana/oas_docs folder
4. Run `bump preview output/kibana.yaml` or `bump preview
output/kibana.serverless.yaml`
5. Go to the url given by the command (it takes a while to load). On the
side bar, click on Observability AI Assistant menu item and there you
can see the docs :)

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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)

![Screenshot 2025-06-26 at 16 10
38](https://github.com/user-attachments/assets/ba9ad9db-512e-443e-8e7f-e8b538183b98)
![Screenshot 2025-06-26 at 16 11
07](https://github.com/user-attachments/assets/445dfd7e-ab21-4066-b3b3-7ea9da60563b)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-27 10:55:43 +01:00
Steph Milovic
41ccdf0bec
[Security Assistant] Removes Default Quick Prompts (#225536) 2025-06-26 16:17:16 -06:00
Steph Milovic
4543f3e25d
[OpenAI Connector] Get http info from config url, not proxyUrl (#225541) 2025-06-26 16:16:32 -06:00
Ievgen Sorokopud
d38801034a
[Attack Discovery][Scheduling] Cases support followup 1 (#225452)
## Summary

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

These changes addresses the review comment from my previous PR
36ed6b38c1 (r2150081638)

Initially I broke up rendered component into multiple memoized
sub-sections. Reverting that back and adding tests coverage for the new
functionality - Case actions UI for the Attack Discovery rule type:
* Hidden `group by` component
* Hidden `time window` component
* Hidden `reopen case` component
* Disabled `template selector` component
* Tooltip explaining why we disabled the `template selector` component
2025-06-26 21:31:35 +02:00
Tiago Costa
4de6f7ca2c
skip failing es promotion (#224987) 2025-06-26 20:14:29 +01:00
Mason Herron
bb547ad2eb
[Fleet] Disable reinstall button on custom integrations (#225359)
## Summary

Closes #220604 

- Added additional prop check to disable reinstall button when an
integration is a custom integration

### 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
N/A

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-26 12:53:15 -06:00
Mason Herron
547c198c3d
[Fleet] Fix string escaping (#225516)
## Summary

Closes https://github.com/elastic/kibana-team/issues/1767

Fixes a string escaping flaw in the regex, switched to using the built
in function that safely escapes special characters


### 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)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

N/A
2025-06-26 19:11:56 +01:00
Marco Antonio Ghiani
2de5294819
[useUnsavedChangesPrompt] Don't prompt when history is replaced given its option. (#225471)
## 📓 Summary

Fixes an issue with prompting the user about leaving the page when the
URL changes due to data source changes.



https://github.com/user-attachments/assets/88e36769-96a4-4499-87f0-1e6db4502725
2025-06-26 17:28:26 +01:00
Pierre Gayvallet
48e4ede08a
[onechat] Add researcher agent mode (#224801)
## Summary

Follow-up of https://github.com/elastic/kibana/pull/223367
Fix https://github.com/elastic/search-team/issues/10259

This PR introduce the concept of agent **mode**, and expose the "deep
research" agent as a mode instead of a tool.

## Examples

### Calling the Q/A (default) mode

```curl
POST kbn:/internal/onechat/chat
{
  "nextMessage": "Find all info related to our work from home policy"
}
```

### Calling the researcher mode

```curl
POST kbn:/internal/onechat/chat
{
  "mode": "researcher",
  "nextMessage": "Find all info related to our work from home policy"
}
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-26 17:04:31 +01:00
Dario Gieselaar
7d20301289
Load huggingface content datasets (#224543)
Implements a huggingface dataset loader for RAG evals - see
[x-pack/platform/packages/shared/kbn-ai-tools-cli/src/hf_dataset_loader/README.md](https://github.com/dgieselaar/kibana/blob/hf-dataset-loader/x-pack/platform/packages/shared/kbn-ai-tools-cli/src/hf_dataset_loader/README.md).
Additionally, a `@kbn/cache-cli` tool was added that allows tooling
authors to cache to disk (possibly remote storage later).

Used o3 for finding datasets on HuggingFace and doing an initial pass on
a line-by-line dataset processor ([see
conversation](https://chatgpt.com/share/6853e49a-e870-8000-9c65-f7a5a3a72af0))

Libraries added:

- `cache-manager`, `cache-manager-fs-hash`, `keyv`,
`@types/cache-manager-fs-hash`: caching libraries and plugins. could not
find any existing caching libraries in the repo.
- `@huggingface/hub`: api client for HF.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-26 17:24:45 +02:00
Paulina Shakirova
b0704474f0
[a11y][ml] fix screen reader not reading tooltip p-value (#224666)
## Summary
This PR fixes [[ML] Change point detection: p-value tooltip is not
announced because lack of
focus](https://github.com/elastic/kibana/issues/216545) issue.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-26 17:16:10 +02:00
Julia Bardi
6cea1b0b6a
[Fleet] fix UI error when no tags filter is selected (#225413)
## Summary

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

To verify:
- filter on `No Tags` or `not tags:*` in Agent list
- add tag to an agent
- expect that the agent disappears from view and there is no UI error



https://github.com/user-attachments/assets/77982bc9-13a8-4141-b0a0-e9198706691f
2025-06-26 16:58:15 +02:00
Stratoula Kalafateli
731ab84487
[Lens][ES|QL] Do not rerun the hook in case of an error in the query (#225067)
## Summary

While testing the ES|QL charts I realized that in case of an error in
the query, the hook goes into a loop and causes performance issues.

As the error is being reported we do not need to re-run the query to get
the results

For example if you create a control wrongly.

e.g.

1. Create a chart and add a control which will create an error:

<img width="508" alt="image"
src="https://github.com/user-attachments/assets/f2013d2c-e161-47bf-a3cb-d5033be9de59"
/>

2. Add to the control no-date fields. e.g. clientip
3. Check the editor is not going into a rendering loop

<img width="482" alt="image"
src="https://github.com/user-attachments/assets/cc541b68-b317-41ae-b4a6-87569466edd6"
/>


### Release notes
Fixes a performance issue in the Lens ES|QL charts in case of errors in
the query.

### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2025-06-26 15:56:50 +01:00
Mason Herron
2aaf27bb69
[Fleet] Fix CSV download when no fields are chosen (#225368)
## Summary

Closes #218097 

- Added check to stop download button from being active when no fields
are selected as it doesnt make sense to download a CSV with zero fields.


![image](https://github.com/user-attachments/assets/0c69bade-a464-49a4-8276-1845e0f887e9)

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

N/A

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-26 08:48:46 -06:00
Ievgen Sorokopud
4937b3a849
[Attack Discovery][Scheduling] Actions: Return formatted markdown fields in the context (#225330)
## Summary

Main ticket ([Internal
link](https://github.com/elastic/security-team/issues/10142))

With these changes we make sure that we return attack discovery fields
reformatted to a nice markdown text. We already format discovery details
when we create a new Case and add markdown comment to it.

### To Test

1. Create attack discovery schedule
2. Add an action to the schedule (email, slack etc.)
3. Select `For each alert > Per rule run` action frequency
4. Update subject, body or other fields of the connector to include
discovery details through the context variables
5. Wait until the action is triggered and check the received message

### Example of the email connector fields

**Subject**:
```
{{context.attack.title}}
```

**Message**: 
```
{{{context.attack.detailsMarkdown}}}

{{{context.attack.detailsUrl}}}
```

<img width="665" alt="Screenshot 2025-06-25 at 18 05 30"
src="https://github.com/user-attachments/assets/71b2e02b-0437-4486-a584-108bec4d477f"
/>

which will result in an email similar to this one

<img width="1125" alt="Screenshot 2025-06-25 at 17 54 32"
src="https://github.com/user-attachments/assets/fefe60f0-e560-4288-9ec8-d1d444feb950"
/>

## NOTES

The feature is hidden behind the feature flag (in `kibana.dev.yml`):

```
feature_flags.overrides:
  securitySolution.attackDiscoveryAlertsEnabled: true
  securitySolution.assistantAttackDiscoverySchedulingEnabled: true
```
2025-06-26 16:18:36 +02:00
Dzmitry Lemechko
2e2576fbf5
[ska][x-pack] relocate reporting tests (#225333)
## Summary

Part of https://github.com/elastic/kibana-team/issues/1503

This PR is mostly about moving tests from x-pack/test/

Before:

```
x-pack/test/
     | - reporting_api_integration/
     | - reporting_functional/

```

After: 
```
x-pack/platform/test/
     | - reporting_api_integration/
     | - reporting_functional/
```

Few page objects, required by functional tests, were relocated as well

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-26 08:35:10 -05:00
Dennis Tismenko
37c930a542
[onechat] Add tools page, show registered tools (#224330)
## Summary

Implements the tools page in the Onechat UI and retrieves the registered
tools from the Kibana API to display a list of all tools and
descriptions — descriptions are truncated at the first `\n` character.

![Screenshot 2025-06-24 at 2 10
37 PM](https://github.com/user-attachments/assets/f4ea70bd-0675-4d39-b120-123d2185752b)


### 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)
- [ ]
~[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.
__No risks are introduced in this PR.__

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-26 09:34:53 -04:00
Sonia Sanz Vivas
0a2ae4bfe6
Fix problem with validation (#225334)
In this fix https://github.com/elastic/kibana/pull/224961 we introduced
the possibility of the data property to be null, but it can also be
empty. This PR does that.
2025-06-26 08:54:37 +01:00
Marco Antonio Ghiani
e78d4faaa5
[Streams 🌊] Handle no data screen for simulation (#225322)
## 📓 Summary

Fixes an issue where the no-data warning for the stream simulation was
hiding the simulation filters.



https://github.com/user-attachments/assets/965f22f6-3faf-4378-883e-26b002a9cdcd
2025-06-26 08:22:05 +01:00
Marco Antonio Ghiani
69971435e4
[Streams 🌊] Restrict capabilities based on project tier (#224209)
## 📓 Summary

Closes https://github.com/elastic/observability-dev/issues/4511

Apply the following restrictions based on the serverless project tier:
- Grok patterns suggestions (only available on complete tier)
  - Restrict suggestions API 
  - Restrict UI control to generate suggestions
- Date formats suggestions (only available on complete tier)
  - Restrict suggestions API 
  - Restrict UI control to generate suggestions
  - Restrict autocomplete
- Significant events (only available on complete tier)
  - Restrict read API
- Last restrictions to be applied when [[Streams] Significant events
view](https://github.com/elastic/kibana/pull/220197#top) is merged.

**N.B.** All the above restrictions are only applied to Serverless
Observability projects on the Logs Essentials tier.

## 🧪 How To Test

* Modify `config/serverless.oblt.dev.yml` to include:
```yaml
pricing.tiers.products:
  - name: observability
    tier: logs_essentials
```
* Run Kibana locally
* In a stream detail view, go to management and try creating a grok
processor or a date one.
* It should NOT display the patterns generation button, nor it should
autocomplete the date processor formats and show its generate button.

Additionally, switch back to `tier: complete` in
`config/serverless.oblt.dev.yml` and make sure that ML/AI assisted flows
look as usual.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-26 08:14:54 +01:00
Peter Pisljar
c3184aaf14
remove isStaticValue from column (#224517) 2025-06-26 08:33:13 +02:00
Nathan Reese
96780d7e1d
[Lens] fix by value lens drilldowns saved with injected references (#225348)
Closes https://github.com/elastic/kibana/issues/225344

https://github.com/elastic/kibana/pull/223149 moved dynamic action
injection/extraction from dashboard to embeddables.
https://github.com/elastic/kibana/pull/223149 muffed the implementation
for the lens embeddable and failed to spread dynamicActionsState and
dynamicActionsReferences into serialized state for by-value panels.

This PR resolve the issue by spreading dynamicActionsState and
dynamicActionsReferences with lens state for by-value panels.

After applying fix, dashboard saved object should contain drilldown
reference and enhancements state should no longer contain hard coded
`dashboardId`.
```
{
  "attributes": {
    "panelsJSON": "[{\"type\":\"lens\",\"embeddableConfig\":{\"enhancements\":{\"dynamicActions\":{\"events\":[{\"eventId\":\"63700c7c-13e2-4aa2-8a58-7d2c19c42b34\",\"triggers\":[\"FILTER_TRIGGER\"],\"action\":{\"factoryId\":\"DASHBOARD_TO_DASHBOARD_DRILLDOWN\",\"name\":\"Go to Dashboard\",\"config\":{\"openInNewTab\":false,\"useCurrentDateRange\":true,\"useCurrentFilters\":true}}}]}},\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"filters\":[],\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"attributes\":{\"title\":\"\",\"visualizationType\":\"lnsXY\",\"type\":\"lens\",\"references\":[{\"type\":\"index-pattern\",\"id\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"name\":\"indexpattern-datasource-layer-5374d213-dba0-47d7-b4f2-9226d08a35cc\"}],\"state\":{\"visualization\":{\"legend\":{\"isVisible\":true,\"position\":\"right\"},\"valueLabels\":\"hide\",\"fittingFunction\":\"Linear\",\"axisTitlesVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"tickLabelsVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"labelsOrientation\":{\"x\":0,\"yLeft\":0,\"yRight\":0},\"gridlinesVisibilitySettings\":{\"x\":true,\"yLeft\":true,\"yRight\":true},\"preferredSeriesType\":\"bar_stacked\",\"layers\":[{\"layerId\":\"5374d213-dba0-47d7-b4f2-9226d08a35cc\",\"accessors\":[\"d1180bfd-63e2-437e-a027-faa0face26ff\"],\"position\":\"top\",\"seriesType\":\"bar_stacked\",\"showGridlines\":false,\"layerType\":\"data\",\"colorMapping\":{\"assignments\":[],\"specialAssignments\":[{\"rules\":[{\"type\":\"other\"}],\"color\":{\"type\":\"loop\"},\"touched\":false}],\"paletteId\":\"default\",\"colorMode\":{\"type\":\"categorical\"}},\"xAccessor\":\"dc975f9c-772f-4fc1-bc1e-70339f2c5906\"}]},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"datasourceStates\":{\"formBased\":{\"layers\":{\"5374d213-dba0-47d7-b4f2-9226d08a35cc\":{\"columns\":{\"dc975f9c-772f-4fc1-bc1e-70339f2c5906\":{\"label\":\"Top 5 values of machine.os.keyword\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"machine.os.keyword\",\"isBucketed\":true,\"params\":{\"size\":5,\"orderBy\":{\"type\":\"column\",\"columnId\":\"d1180bfd-63e2-437e-a027-faa0face26ff\"},\"orderDirection\":\"desc\",\"otherBucket\":true,\"missingBucket\":false,\"parentFormat\":{\"id\":\"terms\"},\"include\":[],\"exclude\":[],\"includeIsRegex\":false,\"excludeIsRegex\":false}},\"d1180bfd-63e2-437e-a027-faa0face26ff\":{\"label\":\"Count of records\",\"dataType\":\"number\",\"operationType\":\"count\",\"isBucketed\":false,\"scale\":\"ratio\",\"sourceField\":\"___records___\",\"params\":{\"emptyAsNull\":true}}},\"columnOrder\":[\"dc975f9c-772f-4fc1-bc1e-70339f2c5906\",\"d1180bfd-63e2-437e-a027-faa0face26ff\"],\"incompleteColumns\":{},\"sampling\":1}}},\"indexpattern\":{\"layers\":{}},\"textBased\":{\"layers\":{}}},\"internalReferences\":[],\"adHocDataViews\":{}}}},\"panelIndex\":\"74c07c77-979f-4fd9-8b07-889f4a93f9e0\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"74c07c77-979f-4fd9-8b07-889f4a93f9e0\"}}]",
  },
  "references": [
    {
      "type": "index-pattern",
      "id": "90943e30-9a47-11e8-b64d-95841ca0b247",
      "name": "74c07c77-979f-4fd9-8b07-889f4a93f9e0:indexpattern-datasource-layer-5374d213-dba0-47d7-b4f2-9226d08a35cc"
    },
    {
      "name": "74c07c77-979f-4fd9-8b07-889f4a93f9e0:drilldown:DASHBOARD_TO_DASHBOARD_DRILLDOWN:63700c7c-13e2-4aa2-8a58-7d2c19c42b34:dashboardId",
      "type": "dashboard",
      "id": "edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b"
    }
  ],
}
```
2025-06-25 14:18:46 -06:00
Kate Sosedova
0d2125427f
Remapping iInCircle and questionInCircle and deprecating help icon (#223142)
## Summary

This PR closes the issue https://github.com/elastic/kibana/issues/221380
and does 3 things:
1. Replaces all current usages of `iInCircle` with `info` (no visual
changes)
2. Replaces all current usages of `questionInCircle` with `question`(no
visual changes)
3. Replaces all current `help` icon usages with `question`(lifesaver
icon replaced with question)

## Screenshots:
![CleanShot 2025-06-18 at 10 34
01@2x](https://github.com/user-attachments/assets/4379e51e-7422-4570-b452-c17ee26f2d64)
![CleanShot 2025-06-18 at 10 34
13@2x](https://github.com/user-attachments/assets/270056c7-4502-47ef-874f-862149fa27ec)
![CleanShot 2025-06-18 at 10 34
04@2x](https://github.com/user-attachments/assets/1dff8faf-65b7-4208-b568-7718b1a6b729)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
2025-06-25 14:52:04 -05:00
Nick Partridge
17c2556fc6
[Lens] Add internal CRUD api routes (#223296)
## Summary

This adds basic Lens CRUD api routes using the Content Management
system.

| Operation | URI |
|--------|--------|
| Create | `POST api/lens/visualizations` |
| Get | `GET api/lens/visualizations/{id}` |
| Search | `GET api/lens/visualizations?query=test` |
| Update | `PUT api/lens/visualizations/{id}` |
| Delete | `DELETE api/lens/visualizations/{id}` |

### Changes to Lens Content Management

The custom `update` method uses `soClient.create` under the hood for
reasons (i.e. #160116). However, doing this acts as an update or create
method with the provided `id`. I changed this behavior so now any update
where the id is not found will return a `404` error.

Closes #221941
Closes #221942 - OpenAPI docs auto generate from route schema

### Testing

You can testing this locally in kibana dev console like so...

```
GET kbn:/api/lens/visualizations/<id>?apiVersion=1
```

> The `apiVersion` query param is needed to test `internal` api routes.

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
2025-06-25 20:01:35 +01:00
Dzmitry Lemechko
bb7cce6d7b
[ska] relocate x-pack/test/cases_api_integration (#225056)
## Summary

Part of https://github.com/elastic/kibana-team/issues/1503

This PR is mostly about moving tests from
x-pack/test/cases_api_integration and updating related imports

Before:

```
x-pack/test/
     | - cases_api_integration/
```

After: 
```
x-pack/platform/test/
     | - cases_api_integration/
 
x-pack/solutions/security/test/
     | - cases_api_integration/
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-25 18:04:29 +01:00
Dzmitry Lemechko
58b8c7aec0
[ska] [xpack] relocate platform tests (#225223)
## Summary

Part of https://github.com/elastic/kibana-team/issues/1503

This PR is mostly about moving platform tests from x-pack/test/

Before:

```
x-pack/test/
     | - ftr_apis/
     | - load/
     | - plugin_api_perf/
     | - fleet_packages/
     | - fleet_tasks/
     | - scalability/
     | - task_manager_claimer_update_by_query/
```

After: 
```
x-pack/platform/test/
     | - ftr_apis/
     | - load/
     | - plugin_api_perf/
     | - fleet_packages/
     | - fleet_tasks/
     | - scalability/
     | - task_manager_claimer_update_by_query/

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-25 17:01:04 +02:00
Ievgen Sorokopud
1ce76ecf01
[Attack Discovery][Scheduling] Cases: Increase max opened cases limit for attack discovery schedules (#225246)
## Summary

In [this PR](https://github.com/elastic/kibana/pull/222827) we added
support of Cases action for Attack Discovery Schedules.

Now we would like to increase a "max opened cases" limit which defaults
to `5` right now and can be set maximum to `10`. In case with attack
discoveries it is highly expected to have more generated alerts and thus
we would like to bump the max number of opened cases to `20`.

## NOTES

The attack discovery scheduling and alerts history features are hidden
behind these feature flags (in `kibana.dev.yml`):

```
feature_flags.overrides:
  securitySolution.attackDiscoveryAlertsEnabled: true
  securitySolution.assistantAttackDiscoverySchedulingEnabled: true
```
2025-06-25 16:47:47 +02:00
Julia Bardi
4aec662015
[Fleet] disable Save button if target versions not changed (#225228)
## Summary

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

Make Save button disabled if target versions haven't changed in Manage
auto-upgrade agents modal


https://github.com/user-attachments/assets/260dd0ab-bd0a-4977-bfb5-575071bb5a37
2025-06-25 16:44:49 +02:00
Mason Herron
1184cc2832
[Fleet] Update /uninstall_tokens API to use exact matching for policy_id query (#225113)
## Summary

Closes #215725 

- Updated the regex to not wrap the policy_id in wildcards so that only
exact matches based on the query would be returned.

Before: 


https://github.com/user-attachments/assets/ad2bd58a-4dad-48a6-85e1-980630753a93




After: 


https://github.com/user-attachments/assets/2e7ebc97-e5ac-401e-8b23-ea54f758e35f


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

N/A

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-25 07:52:11 -06:00
Srdjan Lulic
05b4fdd854
[Obs AI Assistant] Add custom plugin for highlighting user and assistant responses when they have redacted entities (#224605)
Closes: https://github.com/elastic/obs-ai-assistant-team/issues/264

## Summary

Add custom plugin for highlighting user and assistant responses when
they have redacted entities:

- Custom plugin for `EuiMarkdownFormat` that highlights all content
wrapped inside anonymized node. The parsing plugin follows the approach
from [EUI
docs](https://eui.elastic.co/docs/components/editors-and-syntax/markdown/plugins/#putting-it-all-together-a-simple-chart-plugin)
and is used as follows:
   ```
!{anonymized{"entityClass":"<entity class>", "content": "<content"}}
    ```  
- Highlighted content is currently rendered as `EuiCode`, but it can be
more sophisticated (i.e highlight differently depending on the entity
class).
- Allows using the same highlighting logic for messages from both `user`
and `assistant` roles.
- Currently **skipping highlighting inside the code blocks** - may
require customising the default plugins further.

Manually tested: 
- Function calling seems to work as expected.
- Search results with PII are highlighted in the table.
- Custom regex matches are highlighted correctly.

### Testing instructions:
1. Used setup from https://github.com/elastic/kibana/pull/216352 to set
up NER model locally.
2. Added to `kibana.dev.yml`:
```
uiSettings:
  overrides:
    'observability:aiAssistantAnonymizationRules': |
      [
        {
          "type": "regex",
          "pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[A-Za-z]{2,}",
          "enabled": true,
          "entityClass": "EMAIL"
        },
        {
          "type": "regex",
          "pattern": "https?://[^\\s]+",
          "enabled": true,
          "entityClass": "URL"
        },
        {
          "type": "regex",
          "pattern": "\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b",
          "enabled": true,
          "entityClass": "IP"
        },
        {
          "type": "ner",
          "enabled": true
        }
      ]
```
3. Used the assistant (see screenshots below)

### Screenshots
<img width="689" alt="image"
src="https://github.com/user-attachments/assets/d1f9bd57-7e76-43dc-88a6-d0be5fb15092"
/>

<img width="689" alt="image"
src="https://github.com/user-attachments/assets/ed63626b-b32d-45f8-9cf4-c575320d0dfc"
/>


<img width="689" alt="image"
src="https://github.com/user-attachments/assets/0b591158-9186-406a-aab3-e3be538216dc"
/>



### 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
- [ ] 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-06-25 14:41:19 +01:00
Edgar Santos
3b0c225c38
[follow up] small ui refactoring (#225234)
## Summary
This PR is a follow up of https://github.com/elastic/kibana/pull/225070,
addressing the remaining comments regarding the UI.
- moved some common text to their own translation variables
- added missing period to the end of a sentence for consistency

![image](https://github.com/user-attachments/assets/292fd417-2d50-4d32-98d2-df029db06b15)
2025-06-25 14:41:26 +02:00
Cristina Amico
550b9d58ea
[Fleet] Replace call to registry when deleting kibana assets for custom packages (#224886)
Fixes https://github.com/elastic/kibana/issues/224191

## Summary

Bugfix - Replace call to registry when deleting kibana assets for
packages of type "custom" and "bundled". Also replaced the call to
`fetchInfo.registry` on another code path to avoid errors in the same
situation -
- These calls are replaced with `getPackageInfo`, that has some internal
functionalities to decide when the packageInfo should be fetched from
the cache, ES or the registry.
- Added additional logging to the delete assets functions

### Testing
- Install a custom integration that has some assets (a dashboard for
instance)
- Uninstall it and check that the asset is correctly removed and there
are no errors:

<img width="1453" alt="Screenshot 2025-06-25 at 11 02 39"
src="https://github.com/user-attachments/assets/32fb07f3-2628-4e30-be92-16610043b3ae"
/>


### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-06-25 14:21:41 +02:00
Jan Monschke
1683180a2b
[Cases] Add incremental id service and expose the ID in the UI (#222874)
## Summary

This adds and enables the case id incrementer service ([design
doc](https://docs.google.com/document/d/1DZKTPl7UryYjpjVMNhIYbE82OADVOg93-d02f0ZQtUI/edit?tab=t.0#heading=h.6qjc4qynaeuo)).
In order not to stress bulk creation of cases, we're processing
incremental ids asynchronously, meaning they will not immediately appear
in the UI.

The feature is currently disabled by default to allow for testing in
additional environments after merging but can be enabled by setting
`xpack.cases.incrementalIdService.enabled=true` in `kibana(.dev).yml`.
Once the flag is enabled, actually rendering the IDs in the UI is
disabled by default (for now) and has to be enabled in the advanced
settings (`cases:incrementalIdDisplay:enabled`).

Cases can be found by their incremental ID by searching for
`#{incremental_case_id}` in the cases table.

### Screenshots

**Incremental ID in the case detail page**

<img width="1506" alt="Screenshot 2025-06-05 at 15 46 42"
src="https://github.com/user-attachments/assets/f51ae0cd-a2e8-48f7-a6db-05f9f1285e95"
/>

**Incremental ID in the cases table**

<img width="1240" alt="Screenshot 2025-06-05 at 20 32 32"
src="https://github.com/user-attachments/assets/619b3f12-1986-4bc7-b9e8-f7556d0c546c"
/>

**Searching for case by its incremental ID**
<img width="1239" alt="Screenshot 2025-06-05 at 20 33 36"
src="https://github.com/user-attachments/assets/771df512-7436-4aa0-88f9-ac3e1e161455"
/>

### Testing notes

<details>
<summary>Validation script</summary>

Use this script to investigate if there are duplicates or gaps:

```js
import * as fs from 'fs';

// Query to get all cases from all namespaces sorted by incremental_id
// GET .kibana_alerting_cases/_search?_source_excludes=*
// {
//     "query": {
//         "exists": {
//             "field": "cases.incremental_id"
//         }
//     },
//     "fields": [
//       "cases.incremental_id",
//       "cases.title",
//       "namespaces"
//     ],
//     "from": 0,
//     "size": 10000,
//     "sort": [
//       {
//         "cases.incremental_id": {
//           "order": "asc"
//         }
//       }
//     ]
// }
// Put those results into `test.json` in the same directory

// You might need to add `"search_after": [40007]` in case you want to look at more than 10k cases.
// In that case, replace `[40007]` with whatever value the last item has in `"sort": [2102]`

// Concatenate hits if needed (10k per file)
const cases = [
  JSON.parse(fs.readFileSync('./test.json')),
  // JSON.parse(fs.readFileSync('./test1.json')),
  // JSON.parse(fs.readFileSync('./test2.json')),
  // JSON.parse(fs.readFileSync('./test3.json')),
  // JSON.parse(fs.readFileSync('./test4.json')),
].reduce((allHits, currResult) => {
  return allHits.concat(currResult.hits.hits);
}, []);

console.log(`Total amount of cases: ${cases.length}`);

// Groups cases but
const casesByNamespace = cases.reduce((acc, theCase) => {
  const id = theCase._id;
  const space = theCase.fields.namespaces[0];
  const incrementalId = theCase.fields['cases.incremental_id'][0];
  const title = theCase.fields['cases.title'][0];
  const toStore = { id, incrementalId, title };
  if (!acc[space]) {
    acc[space] = new Map();
  }

  // check for duplicates
  const spaceMap = acc[space];
  if (!spaceMap.has(incrementalId)) {
    acc[space].set(incrementalId, toStore);
  } else {
    const storedCase = spaceMap.get(incrementalId);
    console.error(`
      ${storedCase.title} and ${toStore.title} have the same incremental id (${incrementalId})
    `);
  }
  return acc;
}, {});

// find gaps in spaces
Object.keys(casesByNamespace).forEach((space) => {
  const spaceHits = casesByNamespace[space];
  const gaps = [];
  spaceHits.forEach(({ incrementalId }, _, map) => {
    const idBefore = incrementalId - 1;
    if (incrementalId > 1 && !map.has(idBefore)) {
      gaps.push(idBefore);
    }
  });

  console.log(`space:${space} has ${spaceHits.size} cases and ${gaps.length} skipped ids`);
  gaps.forEach((gap) => console.log(`id #${gap} is not assigned`));
});

```


</details>

- Enable the logger in your `kibana.dev.yml` (optional but helpful)
```
logging.loggers:
  - name: plugins.cases.incremental_id_task
    level: debug
```
- Change some of the timings in
`x-pack/platform/plugins/shared/cases/server/tasks/incremental_id/incremental_id_task_manager.ts`
  - Set `timeout: '1m'`
  - Set `CASES_INCREMENTAL_ID_SYNC_INTERVAL_DEFAULT_MINUTES = 1`
  - Remove ```runAt: new Date(
new Date().getTime() +
CASES_INCREMENTAL_ID_SYNC_INTERVAL_DEFAULT_MINUTES * 60 * 1000
          ),```
- you can also set the timings to something lower in the seconds e.g.
`10s`
- Generate a bunch of cases with the generator script
`x-pack/platform/plugins/shared/cases/scripts/generate_cases.js`:
  - `node scripts/generate_cases.js -c 1000 -o securitySolution
- Enable `cases:incrementalIdDisplay:enabled` in advanced settings
- Wait a couple minutes until the incrementer task ran
- Test that the ids show up and that the search works

### Research notes

- We ran a large-scale test with ~350k cases in a cloud env and can
report the following findings:
- The 10min timeout for the incremental id task makes sense. The task
was usually finished after around 8-9min (processing 1000 cases at a
time) which gives it some buffer even.
- While processing the first 50k cases, the service skipped 8 ids and no
duplicates have been assigned. This means it skipped `0.016%` ids which
is great.
- It's unclear when these skips happened though and we investigated the
first 50k cases for duplicate ids, just in case, and found no
duplicates.
- At no point did any of the error logs trigger, meaning the task is
running smoothly.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-25 08:04:58 -04:00
Sonia Sanz Vivas
493ca9f106
[Data Streams] Fix forward-compatibility api test failures (#224795)
Fixes https://github.com/elastic/kibana/issues/223990

## Summary

This PR fixes the forward-compatibility test for index mode, which
failed because the index mode was added to Get Data Streams API in 8.19
and 9.1 (see https://github.com/elastic/elasticsearch/pull/122486), so
if Kibana 8.19 is run with Es 9.0, the index mode is always displayed as
"Standard" because Es doesn't return an index mode field.

In this PR, we separate all index mode-related tests into a separate
file, and only run it for Es versions 8.19 or 9.1+.

This was also fixed for functional tests in
https://github.com/elastic/kibana/pull/223129

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-06-25 12:55:46 +01:00