Commit graph

152 commits

Author SHA1 Message Date
Kevin Delemme
473b9a4a7c feat(slo): Update search with the new summary data (#162336) 2023-07-28 13:18:46 -04:00
Kevin Delemme
d9f098f210 Improve time window handling and validation (#161978) 2023-07-28 13:18:45 -04:00
Kevin Delemme
39af36782e feat(slo): Add more data in SLO rollup index (#161392)
Resolves https://github.com/elastic/kibana/issues/161393

## Summary

This PR is the first of a series to implement the summary and search
improvement feature on SLO.
Every PR will be merged against the feature branch:
`slo/feature-branch`. And we'll update this feature branch with main as
often as possible to keep conflict as a minimum.

This PR changes the SLO rollup index mapping, adding more fields to it,
that we are going to use to summarize the SLO rollup data later.
It also includes the SLO summary index templates (mappings, settings,
template) and install them with the other templates.

Since this is a **breaking change**, any SLO running will be shown as
`NO_DATA`. You can remove the SLO through the API or the UI, or update
them (make sure you change something significant (time window, indicator
params, ...) in order to induce a revision bump) so the underlying
transform is recreated using the new index structure.
2023-07-28 12:52:04 -04:00
James Gowdy
716ecb8a04
[ML] Log pattern analysis field validation (#162319)
Uses the recently created [category validation
package](https://github.com/elastic/kibana/pull/161261) to perform
validation on the field selected for pattern analysis.

If the field is considered unsuitable for categorization, a warning
callout is displayed which lists the reasons it is unsuitable.
If the field is suitable, no callout is displayed.

Other changes:
- Adds the selected field to the URL state, so it is remembered on page
refresh.
- If no field is in the URL, it will look for a field called `message`
in the data view and auto select it.
- renames the ML route `/jobs/categorization_field_examples` to
`/jobs/categorization_field_validation` as it is a more accurate name
and it's consistent with the newly added route in AIOPs.

**Log Pattern Analysis page in ML**


![image](c0dfda8b-bc34-48b7-9e71-8bae9e65bdf3)


**Log Pattern Analysis flyout in Discover**


![image](b4d251f3-bae6-424f-9891-bda57ba1673d)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-28 16:44:23 +01:00
Thomas Watson
d213ed274c
Upgrade ESLint React plugins (#162464) 2023-07-28 10:43:53 +02:00
Ievgen Sorokopud
5f913066a9
[Security Solution] Fix Accessibility Tests (#162143)
## Summary

This PR un-skips security solution a11y tests.

There were four main issues fixes:

1. All list items (`li`) must be contained within `ul` or `ol` parent
elements:
https://dequeuniversity.com/rules/axe/4.6/listitem?application=axeAPI
2. Lists must be marked up correctly, meaning they must not contain
content elements other than `li` elements:
https://dequeuniversity.com/rules/axe/4.6/list?application=axeAPI
3. Ensures elements marked `role="img"` elements have alternate text:
https://dequeuniversity.com/rules/axe/4.6/role-img-alt?application=axeAPI
4. Each `select` element must have a programmatically associated label
element:
https://dequeuniversity.com/rules/axe/4.6/select-name?application=axeAPI


Fixes next tests:
1. https://github.com/elastic/kibana/issues/95707
2. https://github.com/elastic/kibana/issues/101923
2023-07-27 20:41:16 +02:00
Walter Rafelsberger
0ab24e566c
[ML] AIOps: Use Kibana's http service instead of fetch, fix throttling. (#162335)
- Originally Kibana's `http` service did not support receiving streams,
that's why we used plain `fetch` for this. This has been fixed in
#158678, so this PR updates the streaming helpers to use Kibana's `http`
service from now on.
- The PR also breaks out the response stream code into its own package
and restructures it to separate client and server side code. This brings
down the `aiops` bundle size by `~300KB`! 🥳
- The approach to client side throttling/buffering was also revamped:
There was an issue doing the throttling inside the generator function,
it always waited for the timeout. The buffering is now removed from
`fetchStream`, instead `useThrottle` from `react-use` is used on the
reduced `data` in `useFetchStream`. Loading log rate analysis results
got a lot snappier with this update!
2023-07-27 08:57:10 +02:00
Sergi Massaneda
3d6dbd4ad7
[Security Solution] Unified IA Project Navigation (#161667)
## Summary

Implementation of serverless-specific pages within the Unified IA
Navigation.

#### Links implemented:

- `Machine Learning`
  - Landing page created on serverless only
  - All links in the landing page go to `/ml` app
  
- `Dev Tools` 
  - Links directly to `/dev_tools` app


![snapshot](bd53c796-02df-4c3a-88e4-0fa043b896cd)

#### Links not implemented:
```// TODO: in a follow-up PR```

- Project Settings
  - Change the _Settings_ name by _Project Settings_
  - Modify the landing page items according to the design

## Changes

### Plugin contract changes

The Machine Learning landing page is the first page that is only available on serverless and should not exist in ess (there are more of this kind in the pipeline), so this PR implements the foundations to enable the _security_solution_serverless_ plugin to implement its own page components, configure the link definition and create new routes to render them in the Security Solution application. 
These new APIs can be called from either `security_solution_serverless` or `security_solution_ess`, allowing those plugins to have their own offering-specific pages.

The new APIs exposed in the security_solution public contract are the following:

 - `extraAppLinks$`: Observable to add extra app_links into the application links configuration, so they are stored and included in the SecuritySolution plugin `deepLinks` registry, to make them accessible from anywhere in the application using the `chrome.navLinks` API.
 
 - `extraRoutes$`: Observable to add extra routes into the main Router, so it can render the new page components. These additional routes are appended after the "sub-plugin" (_alerts_, _timeline_, ...) routes, so it is not possible to override an existing route path.
 
### New `security-solution-navigation` package

Since now we need to use the same navigation components and hooks in different plugins, these functionalities have been extracted to the `@kbn/security-solution-navigation` package, which all Security plugins will depend on (generic, serverless, and ess).

The modules exposed by this package have been extracted from the main security_solution plugin and standardized. They include the Landing pages components (new [storybook](https://ci-artifacts.kibana.dev/storybooks/pr-161667/394abe76676c6a76b2982c1d3f5bb675739c3477/security_solution_packages/index.html?path=/story/landing-links-landing-links-icons-categories--landing-links-icons-categories) available), navigation hooks, and link utilities. Also, some types and constants have been moved to this package.

A new context provider has also been created, which needs to be in place in order to use this package. The `<NavigationProvider core={core}>` is required for the package functionalities to have access to the Kibana core navigation APIs: `navigateToUrl`, `navigateToApp`, and `getUrlForApp`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: YulNaumenko <jo.naumenko@gmail.com>
2023-07-25 14:02:10 -07:00
Steph Milovic
06fabab55b
Assistant refactor (#162079) 2023-07-25 10:31:04 -06:00
Faisal Kanout
6bae659a1d
[AO][SERVERLESS] Create serverless integration tests for the Threshold rule #161458 (#161569)
## Summary

It fixes #161458 by adding API integration tests for the Threshold rule,
with many scenarios (file per scenario), and each scenario has a
complete life-cycle

### The scenario life-cycle 
- Generating data using the `fake_host` dataset from the high-card
- Create a DataView based on the generated data
- Create the rule and wait to be active
- Get the fired alert and matches its value 
- Clean up

### The covered scenarios 
- Avg. percentage, fires alert
- Avg. percentage, fires alert with no data
- Custom equation on bytes filed, fires alert
- Doc count, fires alert
- Group by two fields, fires alert.

---------
2023-07-24 18:59:44 +02:00
Walter Rafelsberger
11cc1e1be6
[ML] AIOps: Rename Explain Log Rate Spikes to Log Rate Analysis. (#161764)
## Summary

Part of #161832.

This PR renames the Explain Log Rate Spikes feature to **Log Rate
Analysis**.

- [x] Renamed references in `docs/developer/*`
- [x] Updated docs screenshots
- [x] Redirect in docs
- [x] Redirect urls from `explain_log_rate_spikes` to `log_rate_analysis`
- [x] API versioning
- [x] Renamed navigation links
- [x] Renamed variable names
- [x] Renamed file names
- [x] Renamed i18n ids
- [x] Renamed breadcrumbs 
- [x] Removed hard coded `AIOPS_ENABLED` feature flag
2023-07-19 16:46:31 +02:00
James Gowdy
219426dc7a
[ML] Creating category validation package (#161261)
Moves the server and client side code which performs analysis on data to
see whether it is suitable for categorization.
This is currently only used by the categorization job wizard to display
this callout:

![image](08db5321-0c38-474d-9bfe-90b8a9ad984a)

However this analysis will be useful for the Log Pattern Analysis
feature and so moving the code to a package allows easier sharing
between ML and AIOPs plugins.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-19 12:34:29 +01:00
Garrett Spong
83a31bfcc0
[Security Solution] [Elastic AI Assistant] Fixes System Prompt not sending as part of the conversation (#161920)
## Summary

Resolves System Prompt not sending issues:
https://github.com/elastic/kibana/issues/161809

Also resolves:
- [X] Not being able to delete really long Conversation, System Prompt,
and Quick Prompt names
- [X] Fix user/all System Prompts being overridden on refresh
- [X] Conversation without default System Prompt not healed if it is
initial conversation when Assistant opens (Timeline)
- [X] New conversation created from Conversations Settings not getting a
connector by default
- [X] Current conversation not selected by default when settings gear is
clicked (and other assistant instances exist)
- [X] Sent to Timeline action sends anonymized values instead of actual
plaintext
- [X] Clicking Submit does not clear the text area
- [X] Remove System Prompt Tooltip
- [X] Fixes confusion when System or Quick Prompt is empty by adding a
placeholder value
- [X] Shows (empty prompt) in System Prompt selector when the Prompt
content is empty
- [X] Fixes connector error callout flashing on initial load
- [X] Shows `(empty prompt)` text within Prompt Editor when prompt
content is empty to prevent confusion

### Checklist

Delete any items that are not applicable to this PR.

- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-07-14 17:42:57 -06:00
Steph Milovic
11cf01ea43
[Security solution] AI Assistant Fix Up (#161784) 2023-07-13 10:53:48 -06:00
Garrett Spong
b323923e65
[Security Solution] [Elastic AI Assistant] Consolidates settings into a single modal (#160468)
## Summary

This PR fixes the disjointed settings across the assistant by combining
them all into a single settings modal. It also resolves the Connector
`Model` configuration not being available when using the `OpenAI`
variant of the GenAI Connector.

Additional issues resolved:
- [x] Clearing conversation doesn't restore default system prompt
- [X] Double repeated welcome prompt
- [X] Clicking skip button broken

Resolves: https://github.com/elastic/security-team/issues/7110
Resolves:
https://github.com/elastic/kibana/pull/161039#pullrequestreview-1517129764
Resolves:
https://github.com/elastic/kibana/pull/161027#pullrequestreview-1523018176

#### Conversations

<p align="center">
<img width="500"
src="80e271e8-d12a-4d00-b6eb-d63cda2d8017"
/>
</p> 

#### Quick Prompts

<p align="center">
<img width="500"
src="417c49c0-2029-49f1-a2f3-b9d0ae3690d3"
/>
</p> 

#### System Prompts

<p align="center">
<img width="500"
src="cc2bac93-bfba-49c1-b5b8-6a6efa1c0a92"
/>
</p> 

#### Anonymization

<p align="center">
<img width="500"
src="9a65683a-06cc-4cc7-9397-9db2633b20a3"
/>
</p> 









### Checklist

Delete any items that are not applicable to this PR.

- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-07-12 01:50:10 -06:00
Luke
ca3146f0ca
[Security Solution] Store last conversation in localstorage #6993 (#161373) 2023-07-11 18:02:11 -07:00
Chris Cowan
06f7cbf9b6
[SLO] Add indicator to support histogram fields (#161582)
## Summary


This PR add a new indicator to support histogram fields. This will allow
you to either use a `range` aggregation or `value_count` aggregation for
the good and total events; including support for filtering with KQL on
both event types. When using a `range` aggregation, both the `from` and
`to` thresholds are required for the range and events will be to total
number of events within that range.[ Keep in mind, with the `range`
aggregation, the range includes the `from` value and excludes the `to`
value.](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-range-aggregation.html)

This PR also includes support for using the histogram field for a
"Custom Metric" indicator, `sum` is calculated on the values and not the
counts. If you need it calculated on the counts then you have to use the
histogram indicator.

<img width="776" alt="image"
src="1d46b722-df13-417e-bf3b-b3c450933da2">

---------

Co-authored-by: Kevin Delemme <kdelemme@gmail.com>
2023-07-11 16:44:08 -07:00
Steph Milovic
6673ffbf18
[Security solution] Elastic Assistant adds beta label (#161682) 2023-07-11 13:52:45 -07:00
Jatin Kathuria
091b5c133b
[Security Solution][Security Assistant] Investigate in timeline control should be visible only on eligible queries. (#161240)
## Summary

Handles elastic/security-team#6971

This PR mainly resolved below 3 issues:

### Rename to `Add To Timeline` control in conversation code blocks to
`Investigate in Timeline`
 
- `Add to Timeline` according to existing Security Solution actions
means, adding a condition to the timeline with an `OR` clause without
affecting the existing Timeline.

- But the `Add to Timeline` control in the Security Assistant, creates a
new timeline on each action by the user, which contradicts the above
workflow. Hence, it might confuse user.

- `Investigate in Timeline` already means that a new timeline will be
created.

### `Add To Timeline` control was visible on types of codeblock. For
example, it does not make sense for a `Query DSL` to have an `Add to
Timeline` control.

- This PR adds the list of eligible types of queries/code blocks on
which `Add To Timeline` action can be added.

- Currently, that list only contains `kql`, `dsl` and `eql`. Below is
the complete list of types of query that can occur in code blocks.

- Please feel free to suggest a change.
    ```
    'eql' | 'kql' | 'dsl' | 'json' | 'no-type';
    ```

### Lazy calculation of CodeBlockPortals and CodeBlock Action container

- To add controls to the conversation code blocks, we need to follow
below 2 steps.
    1. get the codeBlock containers on which the controls can be added.
2. create portals in the HTML container with our `Add to Timeline`
control.
  
- Below are issues these steps sometime created.
1. We get codeBlock container in the `useLayoutEffect` but at the time,
all conversations might not have loaded because of which containers are
returns as the undefined.
2. Then, we try to create portal in the `undefined` container, which
fails and hence, `Add to Timeline` controls are not visible.
 
- Solution:
1. Instead of getting the codeblock container in useLayoutEffect, we get
the function which will eventually return that container, whenever we
are creating the portal.
2. Converted codeBlock Portal to a callback such that callback can be
called during the rendering which makes sure that all needed
conversations are available and using above step we can easily get the
portal containers.
Feel free to let me know if there are any issues with above strategy. 

### Better Pattern matching.

- Currently, when we are trying to identify the type of codeblock it
might result in unexpected output because of below reason.
1. Let say, we are trying to identify KQL Query and for that we use
below phrases to match in the `OpenAI` response.
        `'Kibana Query Language', 'KQL Query'`
2. Because of this, if the `OpenAI` response contains the phrase `KQL
query` or `kql query`, that fails because of case senstivity when
searching the above phrases.
    3. This PR makes that part of pattern matching case insensitive


### Before



b472178a-0145-42d8-8fb9-ab107915086a



### After


b499f099-a7a1-435f-99b2-ab27ee1f5680



### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
2023-07-11 12:09:33 -06:00
Steph Milovic
ac0630015f
[Security solution] Create AI assistant availability model (#161027) 2023-07-10 17:37:29 -06:00
Pablo Machado
6db79db1e0
[Security Solutions] Update Events/alerts table to use FieldSpec for CellActions (#161361)
EPIC: https://github.com/elastic/kibana/issues/144943

## Summary

Update Events/alerts table to provide `CellActions` with a complete
`FieldSpec`object from DataView

### Affected pages:
* Alerts page
* Security Dashboards
* Rule preview
* Host events
* Users events

### How to test it
Use CellActions on one of the affected pages.




### Checklist

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-07-10 16:57:04 +02:00
Christos Nasikas
67fc8333e7
[Actions] Set system actions on Kibana start (#160983)
## Summary

This PR:

- Adds the ability to create system action types
- Creates system connectors on Kibana `start` from the system action
types
- Prevents system action to be created/updated/deleted
- Return system actions from the get/getAll endpoints

### Checklist

Delete any items that are not applicable to this PR.

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

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 10:39:29 -07:00
Jatin Kathuria
75bd6dd854
[Security Solution][Security Assistant] Fixes relationship between system prompts & conversations (#161039)
## Summary
This PR handles bugs 
- elastic/security-team#6977 
- https://github.com/elastic/security-team/issues/6978 
- elastic/security-team#6979.

Currently, below operations between System Prompts and Conversarions do
not work.

1. When a prompt is set as default for all conversation, it should be
automatically selected for any new conversation user creates.
2. When a new prompt is creates and set as default for all conversation,
it should be automatically selected for any new conversation user
creates.
3. When a prompt is edited such that, it is default for only certain
conversation, it should be automatically selected for that conversation.
4. When a prompt is edited such that conversations are removed to have
that default prompt, it should be automatically removed from
conversation default system prompt list.

In addition to above scenarios, this PR also handles one more bug.

Consider below interface of Conversation which has a property
`apiConfig.defaultSystemPrompt` is of type Prompt. It has been changed
from `defaultSystemPrompt?: Prompt` to `defaultSystemPrompt?: string`
where it will store `promptId` instead of complete prompt.

The current model was posing a problem where, if a prompt was updated,
all its copies in `Conversation` were needed to be updated leading to
inconsistencies. This is now resolved.

```typescript
export interface Conversation {
  apiConfig: {
    connectorId?: string;
    defaultSystemPrompt?: Prompt;
    provider?: OpenAiProviderType;
  };
  id: string;
  messages: Message[];
  replacements?: Record<string, string>;
  theme?: ConversationTheme;
  isDefault?: boolean;
}

```
2023-07-06 15:09:49 -07:00
Bree Hall
4cf630bfec
Upgrade EUI to 83.0.0 (#160813)
`eui@82.1.0`  `83.0.0`

⚠️ The biggest change in this PR by far is the `EuiButtonEmpty` Emotion
conversion, which changes the DOM structure of the button slightly as
well as several CSS classes around it.

EUI has attempted to convert any custom EuiButtonEmpty CSS overrides
where possible, but would super appreciate it if CODEOWNERS checked
their touched files. If anything other than a snapshot or test was
touched, please double check the display of your button(s) and confirm
everything still looks shipshape. Feel free to ping us for advice if
not.

---

## [`83.0.0`](https://github.com/elastic/eui/tree/v83.0.0)

**Bug fixes**

- Fixed `EuiPaginationButton` styling affected by `EuiButtonEmpty`'s
Emotion conversion ([#6893](https://github.com/elastic/eui/pull/6893))

**Breaking changes**

- Removed `isPlaceholder` prop from `EuiPaginationButton`
([#6893](https://github.com/elastic/eui/pull/6893))

## [`82.2.1`](https://github.com/elastic/eui/tree/v82.2.1)

- Updated supported Node engine versions to allow Node 16, 18 and >=20
([#6884](https://github.com/elastic/eui/pull/6884))

## [`82.2.0`](https://github.com/elastic/eui/tree/v82.2.0)

- Updated EUI's SVG icons library to use latest SVGO v3 optimization
([#6843](https://github.com/elastic/eui/pull/6843))
- Added success color `EuiNotificationBadge`
([#6864](https://github.com/elastic/eui/pull/6864))
- Added `badgeColor` prop to `EuiFilterButton`
([#6864](https://github.com/elastic/eui/pull/6864))
- Updated `EuiBadge` to use CSS-in-JS for named colors instead of inline
styles. Custom colors will still use inline styles.
([#6864](https://github.com/elastic/eui/pull/6864))

**CSS-in-JS conversions**

- Converted `EuiButtonGroup` and `EuiButtonGroupButton` to Emotion
([#6841](https://github.com/elastic/eui/pull/6841))
- Converted `EuiButtonIcon` to Emotion
([#6844](https://github.com/elastic/eui/pull/6844))
- Converted `EuiButtonEmpty` to Emotion
([#6863](https://github.com/elastic/eui/pull/6863))
- Converted `EuiCollapsibleNav` and `EuiCollapsibleNavGroup` to Emotion
([#6865](https://github.com/elastic/eui/pull/6865))
- Removed Sass variables `$euiCollapsibleNavGroupLightBackgroundColor`,
`$euiCollapsibleNavGroupDarkBackgroundColor`, and
`$euiCollapsibleNavGroupDarkHighContrastColor`
([#6865](https://github.com/elastic/eui/pull/6865))

---------

Co-authored-by: Cee Chen <constance.chen@elastic.co>
Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-06 12:46:55 -07:00
Chris Cowan
099835fad5
[SLO] Support filters for good/total custom metrics (#161308)
## Summary

This PR adds support for applying a KQL filter to the good/total
metrics.

<img width="858" alt="image"
src="c271352c-10fd-49f1-89b8-a352b69f7f7c">
2023-07-06 08:00:09 -06:00
Pablo Machado
360c4c30fd
[SecuritySolutions] Update CellActions to support all types used by Discover (#160524)
Original issue: https://github.com/elastic/kibana/issues/144943

## Summary

* Update CellActions value to be `Serializable`.
* Update Default Actions and SecuritySolution Actions to allowlist the
supported Kibana types.
* Add an extra check to Action's `execute` to ensure the field value is
compatible.

### How to test it?
* Open Discover and create a saved search with many different field
types
* Go to Security Solutions dashboards
* Create a new dashboard and import the saved search
* Test the created dashboard inside Security Solutions


### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-30 15:50:39 +02:00
Walter Rafelsberger
9eb6d1e4cb
[ML] Explain Log Rate Spikes: Fix slowness of flushFix random payload generation. (#160645)
The random payload for the proxy flushing fix was regenerated for every
push to the stream. This turned out to be quite slow. This PR updates
the logic to create the payload only once and reuse it for every push.

Note: Further testing in Cloud showed the differences there are not as
big as in my local testing, might be related to entropy for
`crypto.randomBytes`.
2023-06-30 12:39:15 +02:00
Pablo Machado
977a8b657b
Fix Elastic Security Assistant - system prompt tooltip (#160957)
issue: https://github.com/elastic/security-team/issues/6969

## Summary

Because we have multiple popovers inside each other and every popover
adds 2000 z-index to the target, the popover was higher than the default
tooltip z-index. This change fixes it by setting the popover z-index.



### Checklist

Delete any items that are not applicable to this PR.

- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

Co-authored-by: Angela Chuang <6295984+angorayc@users.noreply.github.com>
2023-06-30 02:49:12 -07:00
Steph Milovic
a156e48193
[Security solution] Elastic AI Assistant Modal CSS Improvements (#160799) 2023-06-29 07:35:28 -05:00
Dima Arnautov
4064e2b7d4
[ML] Hide inference stats for PyTorch models (#160599)
## Summary

Resolves https://github.com/elastic/kibana/issues/157385

Hides inference stats for the PyTorch models. 

- The salient information (`inference_count`, `timestamp`) is a repeat
of what is already displayed in the Deployment Stats section.
- `missing_all_fields_count` is confusing as the PyTorch models take a
single input field rather than multiple fields as DFA models do, hence
omitted.
- The deployment stats have an
[error_count](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html)
field, hence it has been added to the Deployment Stats and
`failure_count` has been removed.
- Displays the stats tab by default for expanded rows if the model has
started deployments
2023-06-28 05:55:28 -07:00
Chris Cowan
a8322d2711
[Alerting] Fix the charts on Log Threshold Rule Alert Detail page (#160321)
## Summary

This PR fixes #160320 by changing the chart from the `CriterionPreview`
chart, borrowed from the Log Threshold Rule, to an embedded Lens
visualization that represents the correct document count in one chart. I
also took the liberty of changing the ratio chart to use the same
technique for consistency sake.

## Count with multiple conditions

### Before

<img width="736" alt="image"
src="6c6a27ea-f8e4-491f-8a12-261d0ed13dcb">

### After

<img width="736" alt="image"
src="9b18ebe9-e911-4e40-8911-bee55cd7d245">

## Count with multiple conditions and a group by

### Before

<img width="736" alt="image"
src="7b9462da-55b2-4f54-ba09-3c55b372ae2c">


### After

<img width="736" alt="image"
src="b268caed-242f-430a-ade0-14bf491ec899">

## Ratio with multiple conditions

### Before

<img width="736" alt="image"
src="55b8dfa2-7789-433b-bffd-e412bdb08b3f">

### After

<img width="736" alt="image"
src="a029bf8a-3ba1-4e16-87bd-097ebc526a4e">


## Ratio with multiple conditions and a  group by

### Before

<img width="736" alt="image"
src="61ddf1e9-c5ad-4546-a539-15a51ee563c0">

### After

<img width="736" alt="image"
src="15b0aaa3-4ef9-47f6-baba-24869feae77e">
2023-06-27 09:18:31 -07:00
Sergi Massaneda
aad68003a6
[Security Solution] SideNav changes according to new Unified IA (ESS) (#159185) 2023-06-27 08:53:06 -07:00
renovate[bot]
b2c6c71a8d
Update dependency @elastic/charts to v58 (main) (#159082)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`57.0.1` ->
`58.2.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/57.0.1/58.2.0)
|
[![age](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/compatibility-slim/57.0.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@elastic%2fcharts/58.2.0/confidence-slim/57.0.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>elastic/elastic-charts</summary>

#
[58.2.0](https://github.com/elastic/elastic-charts/compare/v58.1.0...v58.2.0)
(2023-06-23)


### Bug Fixes

* `Chart` component `children` type
([#2071](https://github.com/elastic/elastic-charts/issues/2071))
([525c782](525c782829))
* **deps:** update dependency @elastic/eui to v82
([#2074](https://github.com/elastic/elastic-charts/issues/2074))
([69a655f](69a655f0da))


### Features

* **flame:** expose search field text and search text change listener
([#2068](https://github.com/elastic/elastic-charts/issues/2068))
([c339947](c339947c39))
* support native chart title and description
([#2002](https://github.com/elastic/elastic-charts/issues/2002))
([341a990](341a990c5d))

#
[58.1.0](https://github.com/elastic/elastic-charts/compare/v58.0.0...v58.1.0)
(2023-06-08)


### Features

* **flame:** expose search control
([#2064](https://github.com/elastic/elastic-charts/issues/2064))
([011b56b](011b56b3f5))

#
[58.0.0](https://github.com/elastic/elastic-charts/compare/v57.0.1...v58.0.0)
(2023-06-06)


### Bug Fixes

* **axis:** reduce number of y axis ticks on linear scale
([#2005](https://github.com/elastic/elastic-charts/issues/2005))
([0ef828b](0ef828b535))
* **deps:** update dependency @elastic/eui to v81
([#2052](https://github.com/elastic/elastic-charts/issues/2052))
([4c55e01](4c55e0119e))


### BREAKING CHANGES

* **axis:** the default number of desired ticks in the Y-Axis was
changed from `10` to `5`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/elastic/kibana).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMTAuMCIsInVwZGF0ZWRJblZlciI6IjM1LjExMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: nickofthyme <nicholas.partridge@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
2023-06-26 11:41:49 -07:00
Kevin Delemme
f5a111eaab
chore(slo): improve error handling (#160081)
Resolves https://github.com/elastic/kibana/issues/156145
Resolves https://github.com/elastic/kibana/issues/160293

## 📝 Summary

This PR fixes a bug related to `shouldUnregister` used on controlled
fields which removes part of the form state while submitting the form,
due to the components unmounting. This is a weird issue between React
Hook Form and React Query, as if we were not using optimistic update
with RQ, we won't notice the problem in the first place.

I have done a few things in this PR:
1. I've introduced a `CreateSLOForm` type to decouple what the API is
expecting (CreateSLOInput) and how we structure the form and store the
form state. This is particularly useful when building a partial
`CreateSLOForm` from a partial url state `_a`.
2. I've introduced a hook that handles the change of indicator
correctly, resetting the default value as we change. The default values
are typed with each indicator schema type, and the hook will throw when
a new indicator is introduced but not handled there.
3. I've removed the custom metric manual useEffect and instead rely on
hidden registered inputs.
4. The time window type handles correctly the initial state, and reload
the default values when we change from rolling <-> calendar aligned.
5. I've grouped some code from the main form component into their own
hook to 1. add a layer of abstraction and 2. make the code more cohesive
6. When the create SLO call fails, we redirect the user to the form with
the previously entered values.


## 🧪 Testing

I would suggest to create and edit some SLOs, playing with the different
time window, budgeting method, indicators.
The main thing to look for are: 
1. Switching indicator reset the form as expected
2. When editing an SLO, all the form fields are populated correctly with
the initial SLO values.
3. Creating an SLO with a bad indicator, for example with an invalid KQL
query, will redirect to the form with the previous value filled.


https://www.loom.com/share/516c3d5a1fa74db6bf839cfa0cf41f5d?sid=f0a1a33f-eb29-4b8f-b65f-ffce2313bad8

---------

Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
2023-06-23 12:41:24 -04:00
Sergi Massaneda
f4159c4583
[Security Solution] Use CellActions registry in Discover data grid (#157201)
## Summary

closes: https://github.com/elastic/kibana/issues/157191

Enables Discover DataGrid to use registered cell actions instead of the
default static actions.

### New `cellActionsTriggerId` prop
This PR introduces a new `cellActionsTriggerId` _optional_ prop in the
DataGrid component:


98c210f9ec/src/plugins/discover/public/components/discover_grid/discover_grid.tsx (L198-L201)

When this prop is defined, the component queries the trigger's registry
to retrieve the cellActions attached to it, using the CellActions
package' `useDataGridColumnsCellActions` hook. This hook returns the
cellActions array ready to be passed for each column to the EuiDataGrid
component.
When (non-empty) actions are found in the registry, they are used,
replacing all of the default static Discover actions. Otherwise, the
default cell actions are used.

This new prop also allows other instances of the Discover DataGrid to be
configured with custom cell actions, which will probably be needed by
Security Timeline integration with Discover.

### New `SEARCH_EMBEDDABLE_CELL_ACTIONS_TRIGGER` Trigger

Along with the new `cellActionsTriggerId` prop the plugin also registers
a new trigger for "saved search" embeddable:


055750c8dd/src/plugins/discover/public/plugin.tsx (L387)

And it gets passed to the DataGrid component on the Embeddable creation:


055750c8dd/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx (L403)

Having this new trigger available allows solutions to attach custom
actions to it, in order to be displayed in the saved search embeddables.
Each action will be able to implement its `isCompatible` check to
determine if they are going to be displayed in the embedded saved search
DataGrid field, or not. If no compatible actions are found, DataGrid
will render the default static actions.


ℹ️ In this implementation, the actions registered to this new
"embeddable trigger" need to check if they are being rendered inside
Security using the `isCompatible` function, to prevent them from being
displayed in other solutions, resulting in a non-optimal architecture.
This approach was needed since there's no plausible way to pass the
`cellActionsTriggerId` property from the Dashboard Renderer used in
Security, all the way down to the specific Discover "saved search"
embeddable. However, the Dashboards team is planning to enable us to
pass options to nested embeddables using a registry
(https://github.com/elastic/kibana/issues/148933). When this new tool is
available we will be able to delegate the trigger registering to
Security and configure the "saved search" embeddables to use it.
Therefore, the trigger will only be used by Security, so we won't have
to worry about Security actions being rendered outside Security.


## Videos

before:


de92cd74-6125-4766-8e9d-7e0985932618

after:


f9bd597a-860e-4572-aa9d-9f1c72c11a4b

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Pablo Neves Machado <pablo.nevesmachado@elastic.co>
2023-06-23 07:15:41 -07:00
Pablo Machado
5fb9709d4c
[Security Solution] Update CellActions field type to be FieldSpec #157243 (#157834)
issue: https://github.com/elastic/kibana/issues/150347

## Context
Some Actions need to access `FieldSpec` data, which is not present on
the `CellActions` API (`subType`and `isMapped`). So we are updating the
`CellActions` `field` property to be compatible with `FieldSpec`.

## Summary

This PR is the first step to fix
https://github.com/elastic/kibana/issues/150347.
* Updates the `CellActions` to support an array of data objects, each
containing field (`FieldSpec`) and value
* Create a new `SecurityCellActions` component that accepts a field name
and loads `FieldSpec` from the Dataview.

## Examples
Before: 
```tsx
 <SecurityCellActions
      value={'admin'}
      field={{
        name: 'user.name',
        type: 'keyword',
        searchable: true,
        aggregatable: true,
        ...
      }} />
```
After:
```tsx
 <SecurityCellActions data={{ field: 'user.name', value: 'admin' }}/>
```
`SecurityCellActions` will load the spec from the Dataview and provide
it to `CellActons`.

`CellActons` now also support an of fields instead of only one field. It
will be useful when rendering cell actions for aggregated data like on
the Entity Analytic page. But for now, the actions are not supporting
multiple values, we need to rewrite them
https://github.com/elastic/kibana/issues/159480.

### Next steps
We must refactor the Security Solution to get `FieldSpec` from the
`DataView` instead of using BrowserFields. Ideally, we have to do that
for every `CellAction` call so the actions can access the `subType`
property.
- [x] ~Refactor the Security Solution CellActions calls to get
`FieldSpec` from the `DataView`~
- [x] Refactor data grid cell actions to get `FieldSpec` from the
`DataView`
- [ ] Rewrite actions to support multiple fields and use them on the
investigation in timeline (.andFilters)
- [ ] Fix https://github.com/elastic/kibana/issues/150347 using
`subType` from `fieldSpec`
- [ ] Fix https://github.com/elastic/kibana/issues/154714 using
`isMapped` from `fieldSpec`

### Extra information
*** Previously we were mixing `esTypes` and `kbnTypes`. For example, if
the `esType` is a keyword the `kbnType` has to be a `string`.

[Here](9799dbba27/packages/kbn-field-types/src/types.ts (L22))
you can check all possible ES and KBN types and
[here](9799dbba27/packages/kbn-field-types/src/kbn_field_types_factory.ts)
you can see the mapping between esType and kbnType


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-06-22 15:20:53 +02:00
Melissa Alvarez
3d68e071bd
[ML] Data Frame Analytics: Allow interval time range selection in custom URLs (#159874)
## Summary

Related PR https://github.com/elastic/kibana/issues/156025

This PR adds the option to in Data Frame Analytics custom urls to add an
interval time range to a custom url.

<img width="831" alt="image"
src="0e9ee00b-d67e-49a7-93eb-3b452e715762">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co>
2023-06-21 09:55:01 -06:00
Chris Cowan
c0d3a93dff
[SLO] Add burn rate windows to SLO detail page (#159750)
## Summary

This PR adds a burn rate visualization to the overview tab of the SLO
Detail page. This PR also includes a fix for fetching the index pattern
fields hook; it uses the DataViews service to fetch the fields instead
of the internal API.

<img width="1170" alt="image"
src="41057791-880e-4cc8-a0c7-02a0f18aaeca">

### All good

<img width="1141" alt="image"
src="3ec07efa-e35a-4251-87f3-7ddc836171b7">

### Degrading

<img width="1141" alt="image"
src="a6d347be-7b55-404e-99a1-14ad4a38ad36">

### EVERYTHING IS BURNING 🔥

<img width="1141" alt="image"
src="9ed05875-b907-4a57-8387-a094876dd35e">


### Recovering in the dark

<img width="1151" alt="image"
src="f2999c7a-f97b-474c-8146-4565445df892">

### No data

<img width="1141" alt="image"
src="675a65a4-91b1-4de3-9f51-b65760efbb66">
2023-06-20 15:02:48 -07:00
Kevin Delemme
3a34e3593d
feat(slo): Support for calendar aligned time window (#159949)
Resolves https://github.com/elastic/kibana/issues/159948

## 📝 Summary

This PR updates the SLO form to support the calendar aligned time
windows for both create and edit flow.
I've also moved the budgeting method selector down, so when selecting
"timeslices", the timeslices related inputs are shown next to it on the
same line.
 

| Screenshot | Screenshot |
|--------|--------| 
|
![screencapture-localhost-5601-kibana-app-observability-slos-edit-c1a51ac0-0eb0-11ee-8f7a-0da90ce06520-2023-06-19-11_53_05](9e786a17-ebce-43b5-b063-090fe89a1821)
|
![screencapture-localhost-5601-kibana-app-observability-slos-edit-c1a51ac0-0eb0-11ee-8f7a-0da90ce06520-2023-06-19-11_52_31](c3e7cab1-31c2-490b-b38f-6f7b01a3fc95)
|
2023-06-20 07:43:17 -04:00
James Gowdy
8ca1789faa
[ML] Reverting use of isPopulatedObject in error utils (#159913)
PR https://github.com/elastic/kibana/pull/155372 moved our error utils
to a package and also made a few small code changes, one of which added
`isPopulatedObject` to the error object type guards.
`isPopulatedObject` uses `Object.keys` under the hood which cannot be
used to access the non-enumerable properties of an object, like Error's
`message`.


![image](6a0269df-ca2a-494a-9364-8f35f2b52388)

This PR reverts all of these functions back to their original versions
which had existed in ML for a while without issue.

This was change had been causing error messages to not display
correctly.


![image](1862f069-1626-4ac3-8961-dca016b91956)

vs


![image](243143a5-0c8f-4365-a41d-7c1c09858ad8)
2023-06-19 13:52:11 +01:00
Andrew Macri
9ea864cc05
[Security Solution] [Elastic AI Assistant] Data anonymization (#159857)
## [Security Solution] [Elastic AI Assistant] Data anonymization

The PR introduces the _Data anonymization_ feature to the _Elastic AI Assistant_:

![data-anonymization](fa5147bb-e306-48e5-9819-2018e1ceaba3)

_Above: Data anonymization in the Elastic AI Assistant_

![toggle_show_anonymized](7b31a939-1960-41bb-9cf1-1431d14ecc1f)

_Above: Viewing the anonymized `host.name`, `user.name`, and `user.domain` fields in a conversation_

Use this feature to:

- Control which fields are sent from a context to the assistant
- Toggle anonymization on or off for specific fields
- Set defaults for the above

### How it works

When data anonymization is enabled for a context (e.g. an alert or an event), only a subset of the fields in the alert or event will be sent by default.

Some fields will also be anonymized by default. When a field is anonymized, UUIDs are sent to the assistant in lieu of actual values. When responses are received from the assistant, the UUIDs are automatically translated back to their original values.

- Elastic Security ships with a recommended set of default fields configured for anonymization
- Simply accept the defaults, or edit any message before it's sent
- Customize the defaults at any time

### See what was actually sent

The `Show anonymized` toggle reveals the anonymized data that was sent, per the animated gif below:

![toggle_show_anonymized](7b31a939-1960-41bb-9cf1-1431d14ecc1f)

_Above: The `Show anonymized` toggle reveals the anonymized data_

### Use Bulk actions to quickly customize what's sent

![bluk-actions](55317830-b123-4631-8bb6-bea5dc36483b)

_Above: bulk actions_

Apply the following bulk actions to customize any context sent to the assistant:

- Allow
- Deny
- Anonymize
- Unonymize

### Use Bulk actions to quickly customize defaults

![bulk-actions-default](baa002d8-e3da-4ad7-ad2e-7ec611515bcc)

_Above: Customize defaults with bulk actions_

Apply the following bulk actions to customize defaults:

- Allow by default
- Deny by default
- Anonymize by default
- Unonymize by default

### Row actions

![row-actions](76496c07-1acf-4f71-a00c-fbd3ee7b30cc)

_Above: The row actions overflow menu_

The following row actions are available on every row:

- Allow
- Deny
- Anonymize
- Unonymize
- Allow by default
- Deny by default
- Anonymize by default
- Unonymize by default

### Restore the "factory defaults"

The _Anonymization defaults_ setting, shown in the screenshot below, may be used to restore the Elastic-provided defaults for which fields are allowed and anonymized:

![restore-defaults](91f6762d-72eb-4e91-b2b9-d6001cf9171f)

_Above: restoring the Elastic defaults_

See epic <https://github.com/elastic/security-team/issues/6775> (internal) for additional details.
2023-06-18 02:34:23 -06:00
Kevin Delemme
f9d16e160b
feat(slo): Show SLI preview chart for custom kql (#159713) 2023-06-15 15:39:21 -07:00
Melissa Alvarez
5751f29f58
[ML] Explain Log Rate Spikes: allow sticky histogram (#159412)
## Summary

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

This PR adds some ELRS style updates:

- adds options prop to allow 'stickyHistogram' - defaults to false for
now - until page restructure work is done to allow for smooth
interaction
- Moves the 'Clear' functionality to 'Reset' button in line with the
progress controls

<img width="1273" alt="image"
src="50bd3512-cad6-498e-b7a2-740a01151004">


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-15 07:26:33 -06:00
Kevin Delemme
685b0ea636
chore(slo): Move slo schema into x-pack (#159594) 2023-06-14 08:53:57 -04:00
Garrett Spong
6b65e90935
[Security Solution] Adds support for custom Security Assistant SystemPrompts and Conversations (#159365)
## Summary


<p align="center">
  <img width="700" src="3edf2101-718c-4716-80f6-c8377e66f0b9" />
</p> 




Adds the following new abilities to the Security Assistant:
- Adds ability to create/delete custom SystemPrompts
  - Configurable `Name`, `Prompt`, `Default Conversations`, and `Default for New Conversations`
  - Introduces `System Prompt` setting within `Conversation Settings`
- Adds ability to create/delete custom Conversations
  - Create conversation in-line within the Conversation selector by just typing the new conversation name and pressing enter
  - Applies configured SystemPrompt and default connector on conversation creation
- Extracts `baseSystemPrompts` so they can be provided to the AssistantContextProvider on a per solution basis. The consolidates assistant dependency defaults to the `x-pack/plugins/security_solution/public/assistant/content` and `x-pack/packages/kbn-elastic-assistant/impl/content` directories respectively.
  - All Security SystemPrompts now organized in `BASE_SECURITY_SYSTEM_PROMPTS`
  - All Security Conversations organized in `BASE_SECURITY_CONVERSATIONS`

See epic https://github.com/elastic/security-team/issues/6775 (internal) for additional details.


### Checklist

Delete any items that are not applicable to this PR.

- [X] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
2023-06-13 12:06:29 -06:00
Patryk Kopyciński
daf81aae39
Refactor react-tiny-virtual-list (#159023)
## Summary

`react-tiny-virtual-list ` wasn't updated for over 5 years 🤯
2023-06-12 17:20:16 +02:00
Jan Monschke
95edefb221
[SecuritySolution] Decouple timeline SO types from server representation types (#158566)
## Summary

https://github.com/elastic/security-team/issues/6479

In this PR we're separating the types for the `Timeline` saved object
and the type of it's API response equivalent. Doing so will allow us to
make changes to either representations individually which is necessary
for versioning the SO and routes (individually) in the future.

The saved object definition of timeline and its API equivalent now live
in `*/saved_object.ts` and `*/api.ts` respectively. A clean cut of these
two, now distinct types. You will encounter a lot of duplication of
types in these files which is unavoidable. In the future, depending on
how both representations evolve when versioned, these two definitions
will diverge.

You will notice that only few types (and values) defined in
`saved_object.ts` are exported. They are only used for the conversion
logic. They are not exported so they're not accidentally required by
frontend or server code that is not dealing with the conversion. The
exported types all start with `SavedObject*` to clearly mark them as SO
representations.

The conversion files (`convert_saved_object_to_savedtimeline.ts` and
`security_solution/server/lib/timeline/saved_object/timelines/index.ts`)
have been updated to use the new representations and there is no
implicit conversion between them (e.g. through spreading or rest
parameters). In some places, an explicit conversion of fields was
necessary (e.g. to translate between timeline types).

The bulk of the changes are updates of `import` statements to change the
import to `**/api.ts`. If you are on a security team other than the
investigations team, you're most likely only required to look at those
import changes :)


### Checklist


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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-09 09:50:27 +02:00
Karl Godard
ed0d341757
[Session view] [serverless] versioned APIs and other improvements (#158982)
## Summary

### Issues: 
- https://github.com/elastic/kibana/issues/158687
- https://github.com/elastic/kibana/issues/158686

### Fixes
- API routes now versioned
- Moved index selection logic to session_view plugin, added tests
- fields now defined for all ES queries
- types consolidated, and put under a latest/v1 export paradigm

### Checklist

Delete any items that are not applicable to this PR.

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-07 15:44:51 -07:00
Walter Rafelsberger
6b99a51824
[ML] Explain Log Rate Spikes: Support WindowParameters for autoAnalysisStart. (#159111)
To allow for more fine grained control of the baseline and deviation
time ranges for `autoAnalysisStart` this PR allows to pass in a
`WindowParameters` object as an alternative to the plain timestamp. When
more useful metadata is available this might lead to better selections
then the default one provided by `getWindowParameters`.
2023-06-07 10:37:16 +02:00
Jean-Louis Leysens
6cf0c8c564
[http] Require version headers for internal endpoints (#159009)
## Summary

Makes version headers required for internal endpoints. We also require
version headers for public endpoints when in dev mode.

### Note to reviewers

This PR is a re-revert of the original
https://github.com/elastic/kibana/pull/158667 with some minor additions
(see comments).

The original was reverted due to failing Cypress tests blocking Kibana
promotion for 8.8.1 (CC @stephmilovic,
https://github.com/elastic/kibana/pull/158961)

Not sending headers to versioned, internal endpoints will return 400!
Due to the somewhat sensitive nature of this change, I went through all
of the existing `.versioned` endpoints and tried to ensure that for
_internal_ endpoints we send through a version as this is now
**required**.

I would greatly appreciate it if code owners could check their code,
think of any existing consumers of your versioned endpoints and ensure
they are sending a version.

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
2023-06-06 11:51:06 -06:00