Commit graph

76835 commits

Author SHA1 Message Date
Julia Bardi
df9e95a087
[Fleet] Fix copy agent policy, missed bump revision (#188935)
## Summary

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

It looks like the copy agent functionality was not working well when the
agent policy has integration policies or tamper protection enabled. The
revision was not bumped, and the resulting documents in
`.fleet-policies` were incorrect.

To verify:
- run local kibana with fleet-server 8.15 
- create agent policy and add endpoint integration
- copy the policy
- verify that the copied policy is on `revision:2` and there is one
document in `.fleet-policies` with `revision:2` and `coordinator_idx:1`
and the `data.inputs` field has `endpoint` in it
- enable tamper protection on the original agent policy
- copy again and verify the same is true (`revision:2`, etc.)

<img width="1132" alt="image"
src="https://github.com/user-attachments/assets/4492dced-56db-485d-8691-be60ba65b2cb">

```
// no tamper
GET .fleet-policies/_search
{"query": {
  "bool": {
    "must": [
      {"match": {
        "coordinator_idx": 1
      }},
      {"match": {
        "revision_idx": 2
      }},
       {"match": {
        "policy_id": "ae7c5e99-d79a-4364-9209-1c3da5789cd8"
      }}
    ]
  }
}}

  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 4.4079456,
    "hits": [
      {
        "_index": ".fleet-policies-7",
        "_id": "W7iD35ABUS1gQZsO-P6F",
        "_score": 4.4079456,
        "_source": {
          "coordinator_idx": 1,
          "data": {
            "agent": {
              "download": {
                "sourceURI": "https://artifacts.elastic.co/downloads/"
              },
            },
            "fleet": {
              "hosts": [
                "https://192.168.178.216:8220"
              ]
            },
            "id": "ae7c5e99-d79a-4364-9209-1c3da5789cd8",
            "inputs": [
              {
               
                  "manifest_version": "1.0.0",
                  "schema_version": "v1"
                },
                "data_stream": {
                  "namespace": "default"
                },
                "id": "16c83e6a-b764-459d-847d-024697603269",
                "integration_config": {
                  "endpointConfig": {
                    "preset": "EDRComplete"
                  },
                  "type": "endpoint"
                },
                "meta": {
                  "package": {
                    "name": "endpoint",
                    "version": "8.15.0"
                  }
                },
                "name": "endpoint (copy)",


// tamper

GET .fleet-policies/_search
{"query": {
  "bool": {
    "must": [
      {"match": {
        "coordinator_idx": 1
      }},
      {"match": {
        "revision_idx": 2
      }},
       {"match": {
        "policy_id": "d3dae391-a68e-4d0d-b8cd-d09f431c8a52"
      }}
    ]
  }
}}

 "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 4.4079456,
    "hits": [
      {
        "_index": ".fleet-policies-7",
        "_id": "8LmF35ABUS1gQZsOEwrC",
        "_score": 4.4079456,
        "_source": {
          "coordinator_idx": 1,
          "data": {atures": {},
              "protection": {
                "enabled": true,
              }
            },
            "fleet": {
              "hosts": [
                "https://192.168.178.216:8220"
              ]
            },
            "id": "d3dae391-a68e-4d0d-b8cd-d09f431c8a52",
            "inputs": [
              {
                "id": "cbf33dcf-289a-4124-b6a9-50e988247307",
                "integration_config": {
                  "endpointConfig": {
                    "preset": "EDRComplete"
                  },
                  "type": "endpoint"
                },
                "meta": {
                  "package": {
                    "name": "endpoint",
                    "version": "8.15.0"
                  }
                },
                "name": "endpoint (copy 2)",
                "package_policy_id": "cbf33dcf-289a-4124-b6a9-50e988247307",
```


### 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
2024-07-23 10:14:36 -05:00
Sébastien Loix
14770214fd
[Spaces] Add warning for changes that impact other users (#188728) 2024-07-23 16:06:20 +01:00
Katerina
5d9d92b88e
[APM][ECO] Promote new experience when no apm data found (#188867)
closes https://github.com/elastic/observability-dev/issues/3737

## Summary

- When FF is disabled it shows the existing no data page
- The no data config is very limited in the template, thus we had to go
against the guidelines and create a custom no data page for the new
experience.
- The user needs to have permissions to enable EEM, othewise same modal
appears with slightly different copy

Additionally, the PR includes
- Small refactoring in the enablement component in order to share it
- Add short link that was misseed


https://github.com/user-attachments/assets/5d3bbe83-682a-47a1-a9af-770f1ca42876

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-23 10:01:40 -05:00
dkirchan
2cc03329e4
[Security] Fixed key issue in pipeline for quality gate (#188952)
A " was missed in a key in the pipeline for the rule management tests
for Security Quality Gate.
2024-07-23 16:45:39 +02:00
Hannah Mudge
457f08bb37
[Embeddable Rebuild] [Controls] Fix control state on edit (#188784)
## Summary

This PR fixes control editing so that, when the control type is changed,
extra state from the old type gets removed. Prior to this, controls were
keeping unrelated state - for example, switching from a range slider to
a search control would result in a search control with the "step"
property.

### Checklist

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

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-23 08:05:47 -06:00
Ignacio Rivas
dc3d9600da
[Index Management] Support rollover of datastreams from component templates linked to managed/packaged index templates (#187733) 2024-07-23 15:45:28 +02:00
Ignacio Rivas
9bcefe356f
[Index Management] Fix failed tests on mki (#187963) 2024-07-23 15:44:42 +02:00
István Zoltán Szabó
c75a8e03b7
[DOCS] Updates screenshots in AIOps Labs docs (#188851)
## Summary

This PR updates the screenshots related to log rate analysis and log
pattern analysis in the AIOps Labs documentation to reflect that those
features are GA.
2024-07-23 13:27:20 +00:00
Praveen Kukreja
87e2f03778
[Search] Fix missing sync rules in native connectors (#188803)
## Part of https://github.com/elastic/connectors/issues/2686 

## Summary

The following set of connectors gained support for the advanced sync
rules feature in a later release compared to the one where they were
made available as native connector. Consequently, enabling advanced
rules for these connectors was missed.
- Postgres
- Network Drive
- MSSQL
- GitHub
- OneDrive
- Salesforce
- S3
- GMail
- Notion

Co-authored-by: Navarone Feekery <13634519+navarone-feekery@users.noreply.github.com>
2024-07-23 14:38:16 +02:00
Tomasz Ciecierski
9db3d866b5
[EDR Workflows] Add Crowdstrike Connector docs (#187850) 2024-07-23 15:30:02 +03:00
Dima Arnautov
9669bfde47
[ML] Fixes display of model state in trained models list with starting and stopping deployments (#188847)
## Summary

Fixes #188035 and #181093

<img width="1434" alt="image"
src="https://github.com/user-attachments/assets/6c14afa3-2908-45ff-a68d-88ee18f18964">



### 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
2024-07-23 14:18:49 +02:00
Agustina Nahir Ruidiaz
abfd30da75
[Security Solution] Fix: destination of the command link is a host details page (#188742)
## Summary
It doesn't look right that the destination of the command link is a host
details page.
In this PR the command link has been removed and was replaced with a
normal text.
The issue related with this matter is below:
https://github.com/elastic/kibana/issues/188295

- Before:


https://github.com/user-attachments/assets/78d4a09e-e531-4722-b6af-fe7068b29ad5

- Now:

<img width="399" alt="Screenshot 2024-07-19 at 14 16 05"
src="https://github.com/user-attachments/assets/8f8b51e1-3aa6-4d00-8ebc-a98db4afaef0">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] [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>
2024-07-23 13:31:10 +02:00
Rachel Shen
c11d5345b8
[A11y][TableListView] Refactor to use context to return focus (#188774)
## Summary

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

Refactoring the tags portion of the table list view to return focus
after closing the tags popover

---------

Co-authored-by: Sébastien Loix <sebastien.loix@elastic.co>
2024-07-23 10:24:46 +01:00
Alexey Antonov
ac9165d5fc
fix: [ES Serverless home] 'New' button ("Add an API Key" section) gives no context (#188391)
Closes: https://github.com/elastic/search-team/issues/7619
Closes: https://github.com/elastic/search-team/issues/7625

## Description

'New' button ("Add an API Key" section) gives no context . They are not
programmatically associated to their respective topics.

## Steps to Reproduce
1. Open a Search `Serverless` project.
2. Navigate to the `Search` project homepage.

## What was changed?: 

1. Required `aria-label` attributes were added

## Screen: 

<img width="1099" alt="image"
src="https://github.com/user-attachments/assets/8d349017-cd43-4668-8bba-43c29cf90fe2">
2024-07-23 11:09:28 +02:00
Ryland Herrick
e2150dea5e
[Detection Engine] ML Rule Alert Suppression - Followup (#188267)
## Summary

This PR is a followup to #181926. It includes the following changes:

- Refactoring some Rule Form logic with `useMemo` 
- Requested [in this
discussion](https://github.com/elastic/kibana/pull/181926#discussion_r1656825268)
  - Addressed in a5fcf4d0cc
- Adds FTR tests validating ML Suppression supports alert enrichment
- Requested [during previous
review](https://github.com/elastic/kibana/pull/181926#discussion_r1634616090)
  - Addressed in d5aa551590
- Disables ML Suppression fields as a group
- Requested in [this
comment](https://github.com/elastic/kibana/pull/181926#issuecomment-2203592643)
  - Addressed by 983945b8da


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
2024-07-23 09:53:11 +01:00
Maryam Saeidi
ed32c98072
[ResponseOps] Bring back EuiThemeProvider to fix o11y and stack monitoring rules in stack management (#188724)
Related to https://github.com/elastic/kibana/issues/186969 and
elastic/response-ops-team#218

## Summary

This PR brings back EuiThemeProvider to fix o11y and stack monitoring
rules in stack management.

## To check/do

- [x] Add an APM test that fails without this fix
- [x] Check if this solves the related SDH for [CPU
Usage](https://github.com/elastic/sdh-kibana/issues/4829)
- Yes, it will solve that issue
([comment](https://github.com/elastic/sdh-kibana/issues/4829#issuecomment-2242509680))
- [x] Smoke test **ALL** rule types in stack management
    - Can we load the rule form?
    - Can we adjust all the input fields without error?
    - Does it work both with and without data in the preview chart?
2024-07-23 10:42:42 +02:00
Jean-Louis Leysens
11e81d15ec
Add ELU history metrics (#188512)
## Summary

Close https://github.com/elastic/kibana/issues/184836

Adds a new endpoint: `/api/_elu_history` for the purposes of tracking
load.

```ts
interface Response {
  /**
   * Event-loop utilization represented as an average of a number of collections as buckets
   * @remark 3 load windows borrows from the `uptime` CLI tool on macOS and Linux, but is not necessarily 1m, 5m, 15m. The
   *         actual time range covered is determined by our collection interval (configured via `ops.interval`, default 5s)
   *         and the number of samples held in each window. So by default short: 15s, medium: 30s and long 60s.
   */
  history: {
    /** The average ELU for the short window */
    short: number;
    /** The average ELU for the medium window */
    medium: number;
    /** The average ELU for the long window */
    long: number;
  };
}
```

## How to test

Start Kibana locally (`yarn start --no-base-path`) and immediately run
the script below.

```bash
watch -n1 curl -s http://localhost:5601/api/_elu_history
```

Once Kibana starts responding you should see the `short > medium >
long`, then `short < medium < long` and eventually `short ~= medium ~=
long` if you let Kibana idle (basically, long needs to "lag" behind
short and medium).

## Questions

1. An alternative implementation exposes this directly via the
`/api/stats` endpoint as a new section under `event_loop_utilization`.
I'm assuming this approach is preferable.
2. Naming... What shall we call this endpoint?

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-23 10:40:56 +02:00
Walter Rafelsberger
dffc044211
[ML] AIOps: Tweak log rate changes in log rate analysis results table. (#188648)
## Summary

Part of #187684.

This moves functions related to log rate changes to the
`@kbn/aiops_log_rate_analysis` package.

- `getLogRateAnalysisType` was renamed to
`getLogRateAnalysisTypeForHistogram` to indicate its use with histogram
data.
- `getLogRateAnalysisTypeForCounts` was added for cases where we don't
have the histogram data available but just the doc counts for baseline
an deviation time ranges. This isn't used yet as of this PR but will be
in a follow up in combination with the o11y AI assistant.
- `getSwappedWindowParameters` is a helper to consolidate inline code
that's used to swap baseline and deviation when we detected a dip in log
rate.
- Rounding for the log rate change messages was tweaked. Changes below
`10x` will now be rounded to one digit to avoid messages like `1x
increase`.
- Tweaked/Shortened the message for 0 in baseline or deviation to just
`45 up from 0 in baseline` / `down to 0 from 45 in baseline`.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-23 10:25:29 +02:00
Pierre Gayvallet
3af5893f3b
[i18n] remove Object.freeze in initTranslations (#188813)
## Summary

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

Title.
2024-07-23 09:57:32 +02:00
Luke G
b9e6e56106
[Security Solution] Align field format with platform spec (#187697)
## Summary

This PR aligns Security Solution field format spec with the platform
one, as described in the field spec.
2024-07-23 09:02:51 +02:00
Julia Rechkunova
9a44464df3
[Discover] Unskip context navigation flaky tests (#188811)
- Closes https://github.com/elastic/kibana/issues/188396
2024-07-23 07:56:38 +02:00
Kibana Machine
6cfa2c0f15
[api-docs] 2024-07-23 Daily api_docs build (#188890)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/777
2024-07-23 05:03:14 +00:00
Milton Hultgren
dd126c4868
[EEM] Use top_metrics for identity fields lifting (#188315)
This PR converts the identity fields in the latest transform from a
`terms` aggregation to a `top_metric` aggregation in an effort to
simplify the implementation since we have to convert a terms aggregation
from keys to an array of strings. With the `top_metrics` implementation,
we just need to use the `dot_expander` processors along with a `set`
processor to get a single (non-array) field.

---------

Co-authored-by: Chris Cowan <chris@elastic.co>
2024-07-22 17:15:24 -05:00
Jon
a68f812800
[ci] Implement kibana-pointer-compression pipeline (#188480)
Closes https://github.com/elastic/kibana/issues/186631
Closes https://github.com/elastic/kibana-operations/issues/151

Adds a daily pipeline for running our jest and integration tests against
a Node.js distribution with pointer compression enabled. This is enabled
by setting the environment variable
`CI_FORCE_NODE_POINTER_COMPRESSION=true`

I would prefer a cleaner implementation, but I'm not seeing a way around
it without changing our defaults globally. Open to ideas. We have to
update three downloads:

1) base node.js install, for jest
2) build node.js install, for integration tests
3) bazel workspace install, for dependencies

https://buildkite.com/elastic/kibana-pointer-compression/builds/6

---------

Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2024-07-22 17:13:27 -05:00
Konrad Szwarc
d6d017c4a3
[EDR Workflows][MKI] Skip flaky form.cy test (#188810)
Skip due to flakiness in MKI env.
MKI pipeline -
https://buildkite.com/elastic/kibana-serverless-security-solution-quality-gate-defend-workflows/builds/899
2024-07-22 17:06:41 -05:00
Lisa Cawley
17181e6ba5
[OAS] Combine manual and automated OpenAPI documents (#188702) 2024-07-22 16:20:03 -05:00
Hannah Mudge
5c4eae1286
[Embeddable Rebuild] [Saved Search] Migrate saved search embeddable to new embeddable framework (#180536)
Closes https://github.com/elastic/kibana/issues/174959

## Summary

This PR converts the Saved Search embeddable to the new React embeddable
framework. There should not be **any** changes in user-facing behaviour
(except for the intentional change described
[here](https://github.com/elastic/kibana/pull/180536#discussion_r1647924825))
- therefore, testing of this PR should be focused on ensuring that no
behaviour is changed and/or broken with this refactor.

> [!WARNING]  
> The saved search embeddable takes **many forms** and so, while I tried
my best to test everything thoroughly, it is very, very likely that I
missed some test cases due to not being the expert in this area. It is
important that @elastic/kibana-data-discovery in particular approaches
this PR review with a fine-tooth comb 🙇 Thanks so much.

### Notes about the embeddable state:
As part of this refactor, I made three significant changes to how the
state is managed:

1. Once the embeddable is being built in `buildEmbeddable`, the **only
difference** between the runtime state of a by reference and a by value
panel is that the by reference one will have three saved object-specific
keys: `savedObjectId`, `savedObjectDescription`, and `savedObjectTitle`.
2. Number 1 made it possible for me to "flatten out" the runtime state
of the embeddable by removing the `attributes` key, which makes it
easier to access the pieces of state that you need.
3. Previously, the `savedSearch` element of the Saved Search embeddable
object was never modified; instead, changes made to the columns, sort,
sample size, etc. from the dashboard were stored in `explicitInput`.
This essentially created two sources of truth.
   
With the new embeddable system, we only ever want **one** source of
truth - so, the saved search is now modified **directly** when making
changes from the dashboard. However, in order to keep behaviour
consistent with the old embeddable, changes made from the dashboard to a
by reference saved search **should not** modify the underlying saved
object (this behaviour will have to change if we ever want inline
editing for saved searches, but that is another discussion) - therefore,
when **serializing** the runtime state (which happens when the dashboard
is saved), we [only serialize state that has **changed** from the
initial
state](https://github.com/elastic/kibana/pull/180536/files#diff-7346937694685b85c017fb608c6582afb3aded0912bfb42fffa4b32a6d27fdbbR93-R117);
then, on deserialization, we take this "changed" state and
[**overwrite** the state of the saved search with
it](https://github.com/elastic/kibana/pull/180536/files#diff-7346937694685b85c017fb608c6582afb3aded0912bfb42fffa4b32a6d27fdbbR44-R54).
    
Note that this **only** applies to by reference saved searches - with by
value saved searches, we don't have to worry about this and can freely
modify the state.

I also had to make changes to how the **search source** is stored in
runtime state. Previously, when initializing the embeddable, fetching
the saved search saved object also created and returned an
**unserializable** search source object. However, in the new system,
runtime state **most always be serializable** (see
https://github.com/elastic/kibana/pull/186052) - therefore, I've had to
instead use the **serialized** search source in my runtime state saved
search - therefore, I've had to make changes to `toSavedSearch` method
to [allow for a **serializable** saved search to be
returned](https://github.com/elastic/kibana/pull/180536/files#diff-3baaeaeef5893a5a4db6379a1ed888406a8584cb9d0c7440f273040e4aa28166R160-R169).

| | Runtime state (`input`) before | Runtime state after |
|--------|--------|--------|
| **By value** |
![image](d019f904-aac3-4bf2-8f9f-a98787d3b78a)
|
![image](dd820202-f1ef-4404-9450-610989204015)
|
| **By reference** |
![image](ebb0d4a9-b918-48a4-8690-0434a2a17561)
|
![image](16fa1e4d-064d-457b-98af-4697f52de4dd)
|


### 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
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-22 15:14:21 -06:00
Jon
e93e3034a7
[cloud deploy] Enable ML autoscaling (#188653)
Enables ML autoscaling on Cloud deployments, in support of ELSER models
requiring 4gb of memory.
2024-07-22 16:11:22 -05:00
Hannah Mudge
fa0ef37edf
[Embeddable Rebuild] [Controls] Add drag and drop to control group (#188687)
## Summary

> [!NOTE]
> This PR has **no** user-facing changes - minus one small style change
(which is a small selector simplification and doesn't actually change
anything), all work is contained in the `examples` plugin.

This PR adds drag and drop to the refactored control group in the
`examples` plugin.

![Jul-18-2024
16-24-32](https://github.com/user-attachments/assets/c8080af7-4176-473f-92ea-b13f8b1e5def)


### Checklist

- [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 was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-22 14:00:49 -06:00
Ying Mao
f19af22be6
[Response Ops][Alerting] Refactor ExecutionHandler stage 1 (#186666)
Resolves https://github.com/elastic/kibana/issues/186533

## Summary

Stage 1 of `ExecutionHandler` refactor:

* Rename `ExecutionHandler` to `ActionScheduler`.
* Create schedulers to handle the 3 different action types
(`SummaryActionScheduler`, `SystemActionScheduler`,
`PerAlertActionScheduler`)
* Splits `ExecutionHandler.generateExecutables` function into the
appropriate action type class and combine the returned executables from
each scheduler class.

GH is not recognizing the rename from `ExecutionHandler` to
`ActionScheduler` so I've called out the primary difference between the
two files (other than the rename) which is to get the executables from
each scheduler class instead of from a `generateExecutables` function.
Removed the `generateExecutables` fn from the `ActionScheduler` and any
associated private helper functions.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-22 14:39:11 -04:00
Ievgen Sorokopud
0077b0e645
[Security Solution][Detections][BUG] Rule execution error when source document has a non-ECS compliant text field (#187630) (#187673)
## Summary

-  https://github.com/elastic/kibana/issues/187630
- https://github.com/elastic/kibana/issues/187768

These changes fix the error on saving the alert
> An error occurred during rule execution: message: "[1:6952] failed to
parse field [event.original] of type [keyword] in document with id
'330b17dc2ac382dbdd2f2577c28e83b42c5dc66eaf95e857ec0f222abfc486fa'..."

The issue happens when source index has non-ECS compliant text field
which is expected to be a keyword. If the text value is longer than
32766 bytes and keyword field does not have ignore_above parameter set,
then on trying to store the text value in keyword field we will hit the
Lucene's term byte-length limit (for more details see [this
page](https://www.elastic.co/guide/en/elasticsearch/reference/current/ignore-above.html)).

See the main ticket for steps to reproduce the issue.

---------

Co-authored-by: Vitalii Dmyterko <92328789+vitaliidm@users.noreply.github.com>
2024-07-22 13:32:38 -05:00
Juan Pablo Djeredjian
0c5d7b95c0
[Security Solution] Remove remaining usage of rule_schema_legacy types (#188079)
## Summary

Leftover work from https://github.com/elastic/kibana/pull/186615

- Removes remaining usage of `rule_schema_legacy` types. In this PR,
simply inlines the last io-ts types used, to be able to get rid of the
legacy folder.
- The remaining files that need to be migrated to using Zod schema types
are:
-
`x-pack/plugins/security_solution/common/api/detection_engine/rule_exceptions/find_exception_references/find_exception_references_route.ts`
- `x-pack/plugins/security_solution/common/api/timeline/model/api.ts`

### For maintainers

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

---------

Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
2024-07-22 12:53:13 -05:00
Juan Pablo Djeredjian
232a16637d
[Security Solution] Implement normalization of ruleSource for API responses (#188631)
Fixes: https://github.com/elastic/kibana/issues/180140

## Summary

- Implements normalization of`rule_source` for API responses
- `rule_source` field in API responses is calculated out of the
`immutable` and `ruleSource` fields.

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-07-22 12:36:31 -05:00
Dzmitry Lemechko
013276edac
[kbn-test] improve run_check_ftr_configs_cli script (#188854)
## Summary

Follow-up to #188825

@crespocarlos reported that some Oblt configs after missing after
#187440

I was using `node scripts/check_ftr_configs.js` to validate I did not
miss anything and decided to debug the script.

We had a pretty strict config file content validation like
`testRunner|testFiles`, that was skipping some FTR configs like
`x-pack/test/apm_api_integration/basic/config.ts`

I extended file content check to look for default export function and
also skip test/suite or Cypress-own config files.

In the end 7 FTR configs were discovered, but only 2 are with tests. I
will ask owners to confirm if it should be enabled/disabled. Script run
output:

```
node scripts/check_ftr_configs.js
ERROR The following files look like FTR configs which are not listed in one of manifest files:
        - x-pack/plugins/observability_solution/uptime/e2e/config.ts
        - x-pack/test/functional_basic/apps/ml/config.base.ts
        - x-pack/test/functional_basic/apps/transform/config.base.ts
        - x-pack/test/security_solution_api_integration/config/ess/config.base.trial.ts
        - x-pack/test_serverless/functional/test_suites/observability/cypress/oblt_config.base.ts

      Make sure to add your new FTR config to the correct manifest file.

      Stateful tests:
      .buildkite/ftr_platform_stateful_configs.yml
      .buildkite/ftr_oblt_stateful_configs.yml
      .buildkite/ftr_security_stateful_configs.yml
      .buildkite/ftr_search_stateful_configs.yml

      Serverless tests:
      .buildkite/ftr_base_serverless_configs.yml
      .buildkite/ftr_oblt_serverless_configs.yml
      .buildkite/ftr_security_serverless_configs.yml
      .buildkite/ftr_search_serverless_configs.yml

ERROR Please add the listed paths to the correct manifest file. If it's not an FTR config, you can add it to the IGNORED_PATHS in packages/kbn-test/src/functional_test_runner/lib/config/run_check_ftr_configs_cli.ts or contact #kibana-operations
```
2024-07-22 12:27:40 -05:00
Chris Cowan
375c6ffd61
[EEM] Convert route validation to Zod (#188691)
## Summary

This PR closes https://github.com/elastic/kibana/issues/188171 by
converting the route validate to Zod for `get`, `reset`, and `delete`
APIs. This also changes the validation for the `create` API to use
`buildRouteValidationWithZod` along with adding `strict()` to each of
the schemas.

Closes https://github.com/elastic/elastic-entity-model/issues/103

---------

Co-authored-by: Kevin Lacabane <kevin.lacabane@elastic.co>
2024-07-22 12:24:29 -05:00
Rachel Shen
8fb8c27fac
[A11y] aria label for context for try in console open in a new tab or embedded console (#188367)
## Summary

Closes https://github.com/elastic/search-team/issues/7627
2024-07-22 11:03:26 -06:00
Jon
d8302eb2ec
[deb] Add adduser as a dependency (#185048)
adduser is used in the deb post install script. Installing kibana.deb in
a container won't have the necessary dependencies by default

Closes #182537

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-22 11:31:20 -05:00
Joey F. Poon
e026c2a2a9
[Security Solution] unskip endpoint metering integration tests (#187816) 2024-07-22 11:30:17 -05:00
Tiago Costa
f380962a6e
skip flaky suite (#188660) 2024-07-22 17:20:04 +01:00
Tiago Costa
e33f010d6d
skip flaky suite (#188234) 2024-07-22 17:16:25 +01:00
Steph Milovic
47b0105ea7
Gemini connector - update test message (#188850) 2024-07-22 11:06:37 -05:00
Maxim Palenov
7aae5d9ce1
[Security Solution] Enable OpenAPI schemas linting in Security Solution plugin (#188529)
**Relates to:** https://github.com/elastic/security-team/issues/9401

## Summary

Disabling OpenAPI spec linting in https://github.com/elastic/kibana/pull/179074 lead to accumulating invalid OpenAPi specs.

This PR enables OpenAPI linting for Security Solution plugin and make appropriate fixes to make the linting pass.

## Details

OpenAPI linting is a part of code generation. It runs automatically but can be disabled via  `skipLinting: true`. Code generation with disabled linting isn't able to catch all possible problems in processing specs.

The majority of problems came from Entity Analytics and Osquery OpenAPI specs. These specs were fixed and refactored to enable code generation and integrate generated artefacts into routes to make sure OpenAPI spec match API endpoints they describe. It helped to catch some subtle inconsistencies.
2024-07-22 17:50:40 +02:00
Paul Tavares
1ac9c8e2dc
[Security Solution][Endpoint] Fix authz on File Info/Download APIs for execute response action (#188698)
## Summary

- Fixes the API route for response actions file information and file
download to ensure that user only needs Authz to the Execute action.
- Centralizes the logic to determine the platform for a given host which
was (under certain data conditions) causing the platform icon to not be
shown in the response console.
2024-07-22 10:34:28 -05:00
Pablo Machado
240d988ce3
[Observability][SecuritySolution] Update entity manager to support extension of mappings and ingest pipeline (#188410)
## Summary


### Acceptance Criteria

- [x] When starting Kibana, the global entity index templates are no
longer created
- [x] When installing a definition, an index template is generated and
installed scoped to the definition ID
- [x] When deleting a definition, the related index template is also
deleted
- [x] The index template composes the current component templates (base,
entity, event) as well as the new custom component templates with the
setting ignore_missing_component_templates set to true
- [x] The new component templates should be named:
<definition_id>@platform, <definition_id>-history@platform,
<definition_id>-latest@platform, <definition_id>@custom,
<definition_id>-history@custom and <definition_id>-latest@custom
- [x] The ingest pipelines include a pipeline processor that calls out
the pipelines named <definition_id>@platform and
<definition_id>-history@platform or <definition_id>-latest@platform,
<definition_id>@custom and <definition_id>-history@custom or
<definition_id>-latest@custom if they exist
- [x] The index template should have a priority of 200 and be set to
managed
- [x] The @custom component template should take precedence over the
@platform component template, allowing users to override things we have
set if they so wish
- [x] set managed_by to 'elastic_entity_model',


### 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: Kevin Lacabane <kevin.lacabane@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-22 17:06:33 +02:00
Marta Bondyra
b7b3260db2
[Dashboard][ES|QL] Unable to load page error on edit/add ES|QL panel (#188664)
## Summary

Fixes https://github.com/elastic/kibana/issues/184544
2024-07-22 16:59:40 +02:00
Drew Tate
76c6f550dc
[ES|QL] distinguish between trigger kinds in tests (#188604)
## Summary

Part of https://github.com/elastic/kibana/issues/188677

Monaco editor has different [kinds of completion
triggers](https://microsoft.github.io/monaco-editor/typedoc/enums/languages.CompletionTriggerKind.html).
However, the current tests only validate the "TriggerCharacter" events.

This PR prepares the tests to support validating "Invoke" as well.

**Note:** It does change many of the tests from a "TriggerCharacter" to
an "Invoke" scenario. I think this is okay because
- there are still plenty of "TriggerCharacter" tests
- it would take a lot of work to update all the tests
- I will be adding a full set of tests to cover both scenarios as part
of https://github.com/elastic/kibana/issues/188677
- We may rely less and less on trigger characters in the future

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-07-22 09:25:30 -05:00
Drew Tate
2438c36fd9
[ES|QL] improve SORT command suggestions (#188579)
## Summary

- Suggests options in uppercase
- Applies syntax highlighting

**Before**


https://github.com/user-attachments/assets/5f04d8fc-d61a-4779-906b-a7f4f42b4014

**After**


https://github.com/user-attachments/assets/cd585306-020a-4a55-867a-affe373666f6

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-07-22 09:06:27 -05:00
Pierre Gayvallet
7f3f757a38
[i18n] include i18nrc file in 3rd party plugin bundles (#188814)
## Summary

Fix #57273

Include the `. i18nrc.json` file when bundling 3rd party plugins
2024-07-22 15:40:35 +02:00
Kibana Machine
91ed11ac91 skip failing test suite (#118488) 2024-07-22 15:35:59 +02:00
Alex Szabo
03148d203f
[CI] Prevent skippable changes pr break (#188740)
## Summary
Closes: https://github.com/elastic/kibana-operations/issues/159
2024-07-22 15:32:53 +02:00