Commit graph

292 commits

Author SHA1 Message Date
Tiago Costa
302bd423f3
chore(NA): eslint rule for disallowing naked eslint-disable (#136408)
* chore(NA): eslint rule for disallowing naked eslint-disable

* chore(NA): export new rule and update docs

* chore(NA): creation of rule in ts

* chore(NA): new corrected rule in ts

* refact(NA): remove old logic from older plugin

* docs(NA): update documentation

* docs(NA): update documentation

* docs(NA): update documentation

* refact(NA): include edge cases for better locating errors

* chore(NA): changed regex name

* docs(NA): correct name rule on docs

* refact(NA): use dedent in the template literals

* refact(NA): check for undefined

* fix(NA): introduces support for eslint-disable-line

* chore(NA): fix extra space

* test(NA): created more test cases

* chore(NA): rename plugin to eslint-plugin-disable

* docs(NA): update nav and operations landing page ids for eslint rule

* test(NA): use messageIds on test

* chore(NA): complete naked eslint disables with specific rules

* chore(NA): specific rules for a few naked eslint disable

* chore(NA): add focused eslint disable on big reindex_operation_with_large_error_message.ts file

* chore(NA): changes according PR feedback

* chore(NA): include specific eslint rules on latest naked eslint disable

* chore(NA): missing eslint disable specific rule

* fix(NA): remove comment for js annotator

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-19 17:11:04 +01:00
Yuliia Naumenko
5c8eaa3ef9
[Security Solution] Migrate to fields API (#136163)
* -

* fixed tests

* fixed linting rules

* fixed mocks

* removed docValueFields

* -

* fixed tests

* -

* fixed tests

* fixed tests

* -

* changed the recursive approach

* fixed tests

* fixed tests

* fixed tests data according to the new fields api results

* -

* fixed tests

* -

* -

* fixed types

* -

* Fixed threat enrichment

* Fixed unmapped alert details test

* improved naming

* Fixed rule detections tests, by parsing nested structure only for ECS objects

* Fixed tests

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Fixed type checks

* Fixed merge issues

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fixed snapshot

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-07-12 13:08:11 -07:00
Sergi Massaneda
0573c83ebf
[Security Solution] Migrate Field Browser to TriggersActionsUi plugin (#135231)
* field browser migrated

* fix tests, skip styled-components warnings

* fix types and tests

* more test fixes

* styles migrated to emotion/react

* use eui theme

* cleaning

* rename parameter fieldId to columnId

* move files to components folder

* fix lint error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-07 11:11:00 -07:00
Andrew Goldstein
2e844f0c24
[Security Solution] Fixes: Queries with nested field types fail open with failed to create query: [nested] failed to find nested object under path [threat.enrichments] errors for indexes where the nested fields are unmapped (#134866)
## [Security Solution] Fixes: Queries with `nested` field types fail open with `failed to create query: [nested] failed to find nested object under path [threat.enrichments]` errors for indexes where the nested fields are unmapped

This PR implements a fix for <https://github.com/elastic/kibana/issues/130340>, where queries with [nested](https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html) field types failed open with `failed to create query: [nested] failed to find nested object under path [threat.enrichments]` errors for indexes where the nested fields are unmapped.

The fix uses the new `nestedIgnoreUnmapped` option to the `buildEsQuery` API introduced in <https://github.com/elastic/kibana/pull/134580> as a fix for issue <https://github.com/elastic/kibana/issues/130348>.

Please see <https://github.com/elastic/kibana/issues/130340> for a deep dive on the issue being fixed.

### Before

 Before this fix, Timeline queries that used the `nested` query syntax in requests did NOT contain the `ignore_unmapped` option, per the example request below:

```json
                      "nested": {
                        "path": "threat.enrichments",
                        "query": {
                          "bool": {
                            "should": [
                              {
                                "match": {
                                  "threat.enrichments.matched.atomic": "a4f87cbcd2a4241da77b6bf0c5d9e8553fec991f"
                                }
                              }
                            ],
                            "minimum_should_match": 1
                          }
                        },
                        "score_mode": "none"
                      }
```

_Above: Timeline requests for fields with the `nested` query syntax did NOT contain the `ignore_unmapped` option (when inspected)_

When indexes where the nested fields were unmapped were searched:

- Elasticsearch returned a `200` status code
- The response from Elasticsearch included shard failures, per the example response below:

```json
  "_shards": {
    "total": 5,
    "successful": 3,
    "skipped": 0,
    "failed": 2,
    "failures": [
      {
        "shard": 0,
        "index": ".ds-logs-endpoint.events.process-default-2022.06.13-000001",
        "node": "3nAChOVOQKy92bhuDztcgA",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: [nested] failed to find nested object under path [threat.enrichments]",
```

_Above: Timeline responses contained shard failures (when inspected)_

### After

 After this fix, Timeline queries that use the `nested` syntax in requests contain the `"ignore_unmapped": true` option, per the example request below:

```json
                      "nested": {
                        "path": "threat.enrichments",
                        "query": {
                          "bool": {
                            "should": [
                              {
                                "match": {
                                  "threat.enrichments.matched.atomic": "a4f87cbcd2a4241da77b6bf0c5d9e8553fec991f"
                                }
                              }
                            ],
                            "minimum_should_match": 1
                          }
                        },
                        "score_mode": "none",
                        "ignore_unmapped": true
                      }
```

_Above: Timeline requests with the `nested` query syntax `"ignore_unmapped": true` option (when inspected)_

When indexes where the nested fields were unmapped are searched:

- Elasticsearch (still) returs a `200` status code
- The response from Elasticsearch does NOT include shard failures, per the example response below:

```json
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
```

### A tail of two `convertToBuildEsQuery` functions

While fixing this PR, it was noted that there are two different implementations of the `convertToBuildEsQuery` function in:

- `x-pack/plugins/security_solution/public/common/lib/keury/index.ts`
- `x-pack/plugins/timelines/public/components/utils/keury/index.ts`

The implementations of these functions are not the same. Specifically, the return type of the former implementation is:

```ts
[string, undefined] | [undefined, Error]
```

and the latter is just:

```ts
string
```

- This PR reduces the implementations of `convertToBuildEsQuery` down to a single function exported by the `timelines` plugin in `x-pack/plugins/timelines/public/components/utils/keury/index.ts`

- To minimize the scope of the changes in this PR, the previous Security Solution implementation in `x-pack/plugins/security_solution/public/common/lib/keury/index.ts` re-exports the new `timelines` implementation.

### Desk testing

See the _Reproduction steps_ section of <https://github.com/elastic/kibana/issues/130340> for details
2022-06-23 09:44:06 -06:00
Greg Thompson
2336f33632
Upgrade EUI to v59.0.1 (#133927)
* eui to v59.0.0

* i18n tokens

* update theme var tokens

* mock mouseevent for euiselectable

* mock mouseevent for euiselectable

* update theme var tokens

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* mock mouseevent for euiselectable

* update theme var tokens

* update theme var tokens mocks

* WIP: forwardRef type

* update snapshots

* euiTextColor

* snapshot updates

* jest test updates

* euiTextColor updates

* jest test updates

* update getVisualizeError selector

* euiPaddingSizes

* snapshot update

* WIP: accordion cy.react

* DetailPanelMetadataTab test updates

* eui to v59.0.1

* snapshot updates

* WIP: osquery cypress

* WIP: osquery cypress

* use data-test-subj

* log standard console errors

* snapshot

* paddingSizes update

* euiaccordion class type comment

* snapshots

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-06-21 17:08:15 -05:00
Jack
726ea2823b
[8.4] [Security Solution] [Kubernetes Security] Use sessions view component from security_solution (#134704)
* Use sessions view component from security_solution

* Add kubernetes columns
2022-06-21 12:30:11 -07:00
Sergi Massaneda
7649da18cf
[Security Solution] Stateless FieldBrowser (#134495)
* remove redux from field browser

* test added

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-06-21 11:06:18 +02:00
Sergi Massaneda
0a981fdcdf
refactor for consistent field browser naming (#134364) 2022-06-15 10:13:16 +02:00
Steph Milovic
2657221748
[Security Solution] Cleanup network page inconsistencies (#133900) 2022-06-13 10:10:37 -06:00
Matthew Kime
fb881b27f8
[data plugin ] Reduce data plugin reexporting of data view exports (#133518)
* reduce data plugin reexporting of data view exports

* reduce data plugin reexporting of data view exports

* cleanup

* Apply suggestions from code review

Co-authored-by: Dima Arnautov <arnautov.dima@gmail.com>

Co-authored-by: Dima Arnautov <arnautov.dima@gmail.com>
2022-06-07 07:40:35 -05:00
Steph Milovic
fe835e7f87
[Security Solution] Re-enable unmapped fields column in timeline (#133247) 2022-06-03 08:57:55 -06:00
Kevin Qualters
c51fb17e4c
[Security Solution] Hide empty state for timeline when graph overlay is rendered (#132835)
* Hide empty state for timeline when graph overlay is rendered

* Add unit test to not render empty state when overlay is open

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-05-25 10:42:22 -04:00
Andrew Goldstein
899e5cb089
[Security Solution] Updates Timeline tooltips to use action words / fewer words (#132756)
## [Security Solution] Updates Timeline tooltips to use action words / fewer words

- This PR updates the row-level action button tooltips in Timeline, per issue <https://github.com/elastic/kibana/issues/126973>, to use action words / fewer words. This brings the tooltips up to date with the latest [EUI Guidelines](https://elastic.github.io/eui/#/navigation/button/guidelines).
- The tooltips now differentiate between events and alerts. (The original tooltips were written before the Security Solution shipped with a detection engine, so there was no prior distinction.)

### Alert tooltips

This section contains before / after screenshots for alerts.

#### Before: Unpinned alert

![01-BEFORE-unpinned-alert](https://user-images.githubusercontent.com/4459398/169910015-ec5789c2-a691-4e48-b375-c95d15db8378.png)

#### After: Unpinned alert

![01-AFTER-unpinned-alert](https://user-images.githubusercontent.com/4459398/169910149-0cdd8c65-a9b0-43b6-8550-cd0d9c512b17.png)

#### Before: Pinned alert

![02-BEFORE-pinned-alert](https://user-images.githubusercontent.com/4459398/169910207-27aa3307-d33d-4fb5-9ff7-042a6adf030e.png)

#### After: Pinned alert

![02-AFTER-pinned-alert](https://user-images.githubusercontent.com/4459398/169910265-087a3779-2330-437d-b83f-d887eb4adaf9.png)

#### Before: Add a note to an alert

![03-BEFORE-alert-add-note](https://user-images.githubusercontent.com/4459398/169910347-39ca30db-a010-4739-b67f-464851730218.png)

#### After: Add a note to an alert

![03-AFTER-alert-add-note](https://user-images.githubusercontent.com/4459398/169910407-510ff4f3-e0ee-4649-8a44-5b7411a5b629.png)

#### Before: A pinned alert with notes

![04-BEFORE-pinned-alert-with-notes](https://user-images.githubusercontent.com/4459398/169910491-59869c08-2b2b-4c42-a39b-4d4efc05e668.png)

#### After: A pinned alert with notes

![04-AFTER-pinned-alert-with-notes](https://user-images.githubusercontent.com/4459398/169910573-7ae31f88-1199-4744-ae5e-54b40d3c34cb.png)

#### Before: A timeline template with alerts

![05-BEFORE-alert-template](https://user-images.githubusercontent.com/4459398/169910699-03ead1dd-d543-4687-a6f3-14b1b95023aa.png)

#### After: A timeline template with alerts

![05-AFTER-alert-template](https://user-images.githubusercontent.com/4459398/169910740-120eb087-111f-42e9-bb24-af3c344e68c7.png)

### Event tooltips

This section contains before / after screenshots for events.

#### Before: Unpinned event

![06-BEFORE-unpinned-event](https://user-images.githubusercontent.com/4459398/169911532-047d07e2-b4b2-4719-a1a9-fe67c9e04162.png)

#### After: Unpinned event

![06-AFTER-unpinned-event](https://user-images.githubusercontent.com/4459398/169911561-3c452e5b-23de-4144-b0c9-3e805fbd4021.png)

#### Before: Pinned event

![07-BEFORE-pinned-event](https://user-images.githubusercontent.com/4459398/169911699-ffde9799-6120-49e0-8012-37dd687bba31.png)

#### After: Pinned event

![07-AFTER-pinned-event](https://user-images.githubusercontent.com/4459398/169911741-48eeba36-a2c3-4a53-b5f6-57c376b82aa0.png)

#### Before: Add a note to event

![08-BEFORE-event-add-note](https://user-images.githubusercontent.com/4459398/169911867-4139d719-dd5d-4e1b-a415-08863cbf9897.png)

#### After: Add a note to an event

![08-AFTER-event-add-note](https://user-images.githubusercontent.com/4459398/169911895-ea537e8e-9457-4f30-adcc-7ca03c35ea68.png)

#### Before: A pinned event with notes

![09-BEFORE-pinned-event-with-notes](https://user-images.githubusercontent.com/4459398/169911931-9bb662b7-21ea-414b-99c2-46706763ac01.png)

#### After: A pinned event with notes

![09-AFTER-pinned-event-with-notes](https://user-images.githubusercontent.com/4459398/169911975-fc7901ff-61d2-4b6d-b47f-62bf38d4ca16.png)

#### Before: A timeline template with events

![10-BEFORE-event-template](https://user-images.githubusercontent.com/4459398/169911994-4df648ad-bfc7-44ec-bcd5-602a6edb6ca1.png)

#### After: A timeline template with events

![10-AFTER-event-template](https://user-images.githubusercontent.com/4459398/169912017-ac54d03d-11ab-4116-ab33-6d20d5cbba37.png)

CC: @dimadavid
2022-05-24 11:49:22 -06:00
Kristof C
f540c5e392
[Security Solution] [Detection & Response] 131827 Update Detections Response view with pagination and opening numbers in timeline (#131828)
* Fix alert colour pallete & alerts chart header size

* Add pagination and navigation to timeline capability

* fix translation name conflict

* Rename hook file to snake case to match elastic formatting

* Change name scheme oof navigateToTimeline to OpenInTimeline & remove styled components

Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-05-23 10:56:15 -07:00
Tomasz Ciecierski
693b3e85a4
[Osquery] Add Osquery to Alert context menu (#131790) 2022-05-23 11:54:29 +02:00
Andrew Goldstein
788dd2e718
[Security Solution] Fixes sorting and tooltips on columns for non-ECS fields that are only one level deep (#132570)
## [Security Solution] Fixes sorting and tooltips on columns for non-ECS fields that are only one level deep

This PR fixes <https://github.com/elastic/kibana/issues/132490>, an issue where Timeline columns for non-ECS fields that are only one level deep couldn't be sorted, and displayed incomplete metadata in the column's tooltip.

### Before

![test_field_1_actual_tooltip](https://user-images.githubusercontent.com/4459398/169208299-51d9296a-15e1-4eb0-bc31-a0df6a63f0c5.png)

_Before: The column is **not** sortable, and the tooltip displays incomplete metadata_

### After

![after](https://user-images.githubusercontent.com/4459398/169414767-7274a795-015f-4805-8c3f-b233ead994ea.png)

_After: The column is sortable, and the tooltip displays the expected metadata_

### Desk testing

See the _Steps to reproduce_ section of <https://github.com/elastic/kibana/issues/132490> for testing details.
2022-05-20 16:02:05 -06:00
Esteban Beltran
d638b188dc
[Cases] Add to new and existing cases bulk actions in the timelines and security_solution (#130958)
Co-authored-by: mgiota <panagiota.mitsopoulou@elastic.co>
2022-05-18 02:30:14 -07:00
Andrew Goldstein
f2c8b2c48e
[Security Solution] Fixes sorting issues related to unmapped fields (#132190)
## [Security Solution] Fixes sorting issues related to unmapped fields

This PR fixes the following issues related to sorting unmapped fields in timelines and the events / alerts tables:

- <https://github.com/elastic/kibana/issues/129603>
- <https://github.com/elastic/kibana/issues/123912>
- <https://github.com/elastic/kibana/issues/131625>

The `unmapped_type` property [addition](https://github.com/elastic/kibana/pull/87241/files#diff-52fd5870dcd5f783f9fc8ac3a18a8674d83ac6136e09fe0e0bcae30427d61c3fR55) to the `sort` parameter of requests was using the `type` field metadata from `BrowserFields`, but the `type` metadata (for some fields) contains the value `string`, which is not a [valid field data type](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html).

The fix for the issues above:

- Populates the `sort` property of requests with values from the `esTypes` `BrowserFields` metadata (instead of `type`)
  - The `esTypes` metadata may specify more than one field value type. When `esTypes` contains more than one type, and `keyword` is one of the types, the `sort` property of the request will prefer `keyword` over other the other types
- When the field metadata has an empty `esTypes` collection, the `sort` property of the request will default to using `"unmapped_type": "keyword"`
- The field type displayed in tooltips when hovering over columns in a timeline now displays values from `esTypes` instead of `type`

### Desk testing

To reproduce issue <https://github.com/elastic/kibana/issues/129603> and to verify the fix:

1) Open Kibana `Dev tools`

2) Execute the following query to delete any exiting `logs-ti_test` index:

```
DELETE logs-ti_test
```

3) Execute the following query to create an index named `logs-ti_test`, which has the following properities:

- Dynamic mappings are disabled via `"dynamic": false`
- It does NOT contain a mapping for `event.action` (we will sort by this field in later steps)
- It contains a mapping for the non-ECS `testing` field

```
PUT logs-ti_test
{
  "mappings": {
    "dynamic": false,
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "event": {
        "properties": {
          "category": {
            "type": "keyword"
          },
          "dataset": {
            "type": "keyword"
          },
          "kind": {
            "type": "keyword"
          },
          "type": {
            "type": "keyword"
          }
        }
      },
      "host": {
        "properties": {
          "name": {
            "type": "keyword"
          }
        }
      },
      "testing": {
        "type": "keyword",
        "ignore_above": 1024
      },
      "threat": {
        "properties": {
          "indicator": {
            "properties": {
              "file": {
                "properties": {
                  "hash": {
                    "properties": {
                      "md5": {
                        "type": "keyword"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```

4) Execute the following query to add a new document to the `logs-ti_test` index, and note that:

- It does NOT contain a `event.action` field
- It contains a value for the non-ECS `testing` field

```
POST logs-ti_test/_doc/
{
  "@timestamp": "2022-05-12T00:00:14.725Z",
  "host": {
    "name": "foozle"
  },
  "threat": {
    "indicator": {
      "file": {
        "hash": {
          "md5": "a4f87cbcd2a4241da77b6bf0c5d9e8553fec991f"
        }
      }
    }
  },
  "event": {
    "kind": "enrichment",
    "type": "indicator",
    "dataset": "ti_*",
    "category": "threat"
  },
  "testing": "simulated threat intel data"
}
```

5) Navigate to the Security > Hosts page

6) Select `Last 1 year` from the date picker

7) Click the `Events` tab

8) Enter the following KQL query in the search bar at the top of the page:

```
host.name: foozle
```

9) Hover over the `foozle` entry in the `host.name` column in the Events table, and click the `Add to timeline investigation` cell action

10) Open the timeline

11) Hover over the `event.action` field

**Expected result**

- The tooltip displays  type `keyword` for the `event.action` field

**Actual result**

- The tooltip displays type `string` for the `event.action` field

12) Click the `event.action` column to add a secondary sort

**Expected result**

- The table is sorted by `@timestamp` and `event.action`
- The table contents are (still) visible

**Actual result**

- The table is sorted by `@timestamp` and `event.action`
- The contents of the table are now empty

13) Click the timeline's `Inspect` button

14) In the `Inspect Timeline` dialog, click the `Request` tab

15) Scroll down to the `sort` property of the request

**Expected result**

- The `event.action` field contains a `"unmapped_type": "keyword"` property, per the example below:

```json
  "sort": [
    {
      "@timestamp": {
        "order": "desc",
        "unmapped_type": "date"
      }
    },
    {
      "event.action": {
        "order": "desc",
        "unmapped_type": "keyword"
      }
    }
  ],
  ```

**Actual result**

- The request's `event.action` field contains a `"unmapped_type": "string"` property, per the example below:

```json
  "sort": [
    {
      "@timestamp": {
        "order": "desc",
        "unmapped_type": "number"
      }
    },
    {
      "event.action": {
        "order": "desc",
        "unmapped_type": "string"
      }
    }
  ],
  ```

16) In the `Inspect Timeline` dialog, click the `Response` tab

**Expected result**

- The response contains `0` `failed` shards / no failures

**Actual result**

- The response contains failures for the `logs-ti_test` index, with the following reason:

```
"reason": "No mapper found for type [string]"
```

per the example below:

```json
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 4,
    "successful": 3,
    "skipped": 0,
    "failed": 1,
    "failures": [
      {
        "shard": 0,
        "index": "logs-ti_test",
        "node": "NCRcGeDqSlKQiuPWVFvMEg",
        "reason": {
          "type": "illegal_argument_exception",
          "reason": "No mapper found for type [string]"
        }
      }
    ]
  },
```
2022-05-17 09:30:02 -06:00
Alejandro Fernández Gómez
70d7de4579
[Unified observability] Show 10 items per page by default in the alerts table in the observability overview page. (#129633)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-05-12 11:39:10 -07:00
Steph Milovic
9c8796a0bf
[Security Solution] Optimize field formatting server side (#130915) 2022-05-11 12:20:16 -06:00
Sergi Massaneda
818f5e63b2
[Security Solution] [Field Browser] Prevent pagination reset on field selection (#131714)
* prevent pagination reset on selection

* sorting controls

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-05-10 15:35:45 +02:00
Karl Godard
743cce0a65
Sessions tab improvements (#131583)
* session tab query modified query all events, not just entry leaders. solves a few problems wrt to query ability. default columns modified and display names provided for each

* snapshot updated

* readded test

* Default sort set to process.entry_leader.start desc

* sessions tab timeline id changed to cache bust localstorage for table column configs

* missed a couple spots for session tab timeline id update

Co-authored-by: mitodrummer <karlgodard@elastic.co>
2022-05-06 09:17:16 -07:00
Sergi Massaneda
0b2d02d35d
improve function performance (#131530) 2022-05-05 16:40:44 +02:00
Anton Dosov
e603d92552
Remove data_enhanced plugin (#122075)
Code moved into `data` plugin
2022-04-29 16:43:59 +02:00
Andrew Goldstein
3ad6452166
[Security Solution] [Investigations] [Tech Debt] removes redundant code from timelines plugin (#130928)
## [Security Solution] [Investigations] [Tech Debt] removes redundant code from the timelines plugin

This follow-up PR removes redundant code from the `timelines` plugin, identified while implementing https://github.com/elastic/kibana/pull/130740
2022-04-25 16:14:59 -06:00
Andrew Goldstein
995e63a09b
[Security Solution] [Investigations] [Tech Debt] removes deepEqual checks in column headers and data providers (#130740)
## [Security Solution] [Investigations] [Tech Debt] removes `deepEqual` checks in column headers and data providers

This tech debt PR is another entry in a series to remove `React.memo` `deepEqual` checks, per the details in <https://github.com/elastic/kibana/issues/124151>

- It removes `deepEqual` checks in Timeline's column headers and data providers
- Files made redundant by the `timelines` plugin adopting `EuiDataGrid` are deleted

### Methodology

The following techniques were used to ensure that removing the `deepEqual` checks did NOT result in unexpected re-renders:

- To understand why components re-rendered, Timeline was profiled with the `Record why each component rendered wile profiling` setting in the React dev tools Profiler enabled, shown in the (illustrative) screenshot below:

![record_why_each_component_rendered](https://user-images.githubusercontent.com/4459398/158903740-8122e2d3-11a6-4927-916a-f895717835ae.png)

- Components were temporarily instrumented with counters that incremented every time the component was rendered. Log statements prefixed with `[pre]` were observed before making changes, per the screenshot below:

![pre_change](https://user-images.githubusercontent.com/4459398/164310611-3837bd09-0b31-434e-8ef7-94434d35be48.png)

- After removing the `deepEqual` checks, the log prefix was updated to `[POST]`, and the log entries were observed again, per the screenshot below:

![post_change](https://user-images.githubusercontent.com/4459398/164310656-f5c82443-2ff4-4e62-8c7b-8fa9dbce5dfd.png)

The `[pre]` and `[POST]` counters were compared to verify removing the `deepEqual` checks did NOT introduce unexpected re-renders.
2022-04-21 12:33:51 -06:00
spalger
3730dd0779 fix all violations 2022-04-16 01:37:30 -05:00
Kevin Qualters
a54d0d66db
Update event rendered view action column width to account for session view button (#130410) 2022-04-15 20:08:06 -04:00
Robert Austin
4835a5d7d1
[Security Solution] remove unused BrowserField references (#130206)
A property was passed through many react components, but never used. This commit cleans this up.
2022-04-14 08:09:23 -04:00
Alejandro Fernández Haro
9d5aca591b
Upgrade RxJS to 7 (#129087)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-04-12 12:40:55 -07:00
Constance
0955953799
Upgrade EUI to v54.0.0 (#129653)
* Upgrade EUI to v54.0.0

* [Discover] Remove deprecated closePopover call
- for closeCellPopover ref API

* [Lens] Remove deprecated closePopover call
- for closeCellPopover ref API

* [Security/Timelines] Remove deprecated closePopover call
- for closeCellPopover ref API

* [Security/Timeline] Update Timeline datagrid to accept/pass `visibleCellActions` prop

+ update Security to show 3 visible cell actions

* [APM] Account for removed EUI theme avatar sizes

* Update emotion dependencies to latest

* Remove styles from being rendered in emotion serializer

* Update snapshots affected by emotion serializer `includeStyles: false` change

* Update snapshot changes caused by EuiFormControlLayout changes

* Update snapshot changes caused by EuiAvatar CSS-in-JS conversion

* consolidate yarn.lock

* [Spaces] Fix failing test due to new EuiAvatar emotion wrapper

- which, due to mount() causes .first() to no longer work as expected - targeting .last() instead gets the actual div element which works

* [Security] Fix cell expansion popover actions

- EUI added 2 `.euiPopoverFooter`s for overflowing cell actions, and Security's CSS to hide the first 2 cell actions (replaced by their own custom cell actions) was unintentionally affecting other actions

* Clean up spaces test snapshots

* [Security feedback] Revert 793d208 and hard-code visibleCellActions

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
Co-authored-by: Joe Portner <joseph.portner@elastic.co>
2022-04-12 11:00:15 -07:00
Davis Plumlee
268470a440
[Security Solution] Rule Preview Table Follow-up (#128981) 2022-04-11 12:34:58 -07:00
Paulo Henrique
144a3c8313
[Security Solution][Session View] Fix duplicated events and runtime_fields that are no longer necessary on the Sessions Tab (#129835) 2022-04-11 14:09:41 -03:00
Robert Austin
47b62d83af
Enhance Event Fields Browser performance (#129861)
* Enhance Event Fields Browser performance

* fixes checks

* Update x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx

Use idiomatic value for EUI's `itemId` field

Co-authored-by: Jan Monschke <janmonschke@fastmail.com>

Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co>
Co-authored-by: Jan Monschke <janmonschke@fastmail.com>
2022-04-11 12:42:33 -04:00
renovate[bot]
d89ddadc17
Update typescript (main) (#129106)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Spencer <spencer@elastic.co>
2022-04-04 07:05:12 -07:00
Constance
2688cb21f9
Upgrade EUI to v52.2.0 (#128841)
* Updgraded EUI packages in package.json and src/dev/license_checker/config.js

* Resolved Jest test failures for Jest test suites 1 and 2. Updated snapshots, and updated equality conditions for specific test cases

* Resolve Jest test cases for Jest test suite 3. Updated snapshots for required tests

* Resolved failing Jest test cases in Jest suite 3. Updated tests checking for strict text equality to account for text coming from the EuiScreenReaderOnly component. Also updated tests to account for EuiIcon text that is now rendered when the icon is imported from .testenv (PR 5709 - https://github.com/elastic/eui/pull/5709/).

* type fixes

* eui to 52.2.0

* Resolved test cases for Jest test suites 1 and 2. Updated required snapshots.
Updated tests using getAllByLabelText and getByLabelText to getAllByText and getByText respectively as the former have been deprecated

* Updated Jest tests for Jest test suites 5 and 6. Updated required snapshots. Updated instances of getByLabelText and getAllByLabelText to getByText and getAllByText as the former are now deprecated.

* Updated Jest tests for Jest test suite 7. Updated required snapshots.

* Completed test case revisions for Jest test suites 1, 3, 6, 7, and 8. Updated required snapshots. Updated various tests to account for text rendering of the EuiIcon text.

* removed unused test utils

* use .contains for euiicon content

* storyshots updates

* linting

* Fix failing a11y violations tests

* Fix Jest failures caused by #eui/5709

- these changes should be reverted if we opt to revert the above PR

Co-authored-by: Bree Hall <briannajdhall@gmail.com>
Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
2022-03-29 20:44:44 -07:00
Tyler Smalley
f782f8bf33 Revert "Upgrade EUI to v52.2.0 (#128313)"
This reverts commit dccd8290bb.
2022-03-29 14:52:15 -07:00
Bree Hall
dccd8290bb
Upgrade EUI to v52.2.0 (#128313)
* Updgraded EUI packages in package.json and src/dev/license_checker/config.js

* Resolved Jest test failures for Jest test suites 1 and 2. Updated snapshots, and updated equality conditions for specific test cases

* Resolve Jest test cases for Jest test suite 3. Updated snapshots for required tests

* type fixes

* Resolved failing Jest test cases in Jest suite 3. Updated tests checking for strict text equality to account for text coming from the EuiScreenReaderOnly component. Also updated tests to account for EuiIcon text that is now rendered when the icon is imported from .testenv (PR 5709 - https://github.com/elastic/eui/pull/5709/).

* eui to 52.2.0

* Resolved test cases for Jest test suites 1 and 2. Updated required snapshots.
Updated tests using getAllByLabelText and getByLabelText to getAllByText and getByText respectively as the former have been deprecated

* Updated Jest tests for Jest test suites 5 and 6. Updated required snapshots. Updated instances of getByLabelText and getAllByLabelText to getByText and getAllByText as the former are now deprecated.

* Updated Jest tests for Jest test suite 7. Updated required snapshots.

* Completed test case revisions for Jest test suites 1, 3, 6, 7, and 8. Updated required snapshots. Updated various tests to account for text rendering of the EuiIcon text.

* eui back to v52.2.0

* removed unused test utils

* use .contains for euiicon content

* storyshots updates

* linting

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
2022-03-29 13:39:45 -07:00
Kevin Qualters
33b85f8968
[Security Solution] Use session view plugin to render session viewer in alerts, events and timeline (#127520) 2022-03-29 16:06:42 -04:00
Robert Austin
4ce6f20fec
Security Solution: reimplement filterBrowserFieldsByFieldName (#128779)
The function filterBrowserFieldsByFieldName is being run 4+ times when loading pages in the Security app. With a large number of fields, such as is found in production environment, this function can take 10+ seconds to completed. With this implementation, it should run a bit quicker.
2022-03-29 15:40:33 -04:00
Paulo Henrique
8d117ca349
[Security solution][Session view] - Add Sessions tab into the Hosts page (#127920)
* add Session Leader Table

* WIP: Session Leader Table

* sessions search strategy

* session viewer component

* add timelineId

* remove session leader table

* cleaning

* cleaning

* updating search strategy

* add space for open in session viewer icon

* add sessionEntityId as key cache

* updating deep links

* updating headers

* adding filterQuery

* adding timeline

* add runtime fields to search strategy

* updating comment

* fixing tests

* removing unecessary intermediate component

* removing intermediary component

* adding tests for session viewer

* remove unnecessary runtime_mappings

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-28 16:49:15 -07:00
Pablo Machado
f289a5d78b
Add Events tab and External alerts tab to the User page and the User details page (#127953)
* Add Events tab to the User page and the User details page

* Add External alerts tab to the User page and the User details page

* Add cypress tests

* Add unit test to EventsQueryTabBody

* Memoize navTabs on Users page
2022-03-24 09:31:40 +01:00
Sergi Massaneda
4b47481566
[Security Solution] [Timeline] Fields browser add a view all / selected option (#128049)
* view selected option added

* new header component

* test fixed

* Update x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_table_header.test.tsx

use not.toBeInTheDocument

Co-authored-by: Pablo Machado <machadoum@gmail.com>

* pass callback down instead of state setter

Co-authored-by: Pablo Machado <machadoum@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-22 17:04:51 +01:00
Michael Olorunnisola
26a47d069f
[SecuritySolution] Add alert prevalence column to highlighted fields table (#127599)
Co-authored-by: Jan Monschke <jan.monschke@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-17 09:21:06 -04:00
Greg Thompson
854da93770
Upgrade EUI to v51.1.0 (#126926)
* eui to v50.0.0

* i18n tokens

* Deprecate EuiDataGrid's `popoverContents` prop for `renderCellPopover`

* [optional ML refactor] Use `renderCellValue.isDetails` to customize numeric popover content instead of `renderCellPopover`

 - since no especially custom popover rendering is occuring, just conditional content

* onChangeItemsPerPage update

* storyshots updates

* snapshot updates

* snapshot updates

* snapshot updates

* snapshot updates

* EuiComboBox listbox -> combobox

* remove invalid combobox aria attr

* Revert "onChangeItemsPerPage update"

This reverts commit 127c9e5840.

* eui to v51.0.0

* WIP: schema

* WIP: schema

* EuiSelectable API changes

* WIP: schema

* hidePerPageOptions -> showPerpageOptions

* WIP: schema

* hidePerPageOptions -> showPerpageOptions

* WIP: schema

* breadcrumbs type

* clean up

* snapshot updates

* Fix E2E datagrid cell filter action test

- This changed in 50.0.0 because of https://github.com/elastic/eui/pull/5681

- `await testSubjects.click('filterForButton')` applies to both the cell action button icon and the cell popover button
- The test was trying to click the cell action button icon and not the popover button, which closed the popover and caused nothing to actually get clicked

- the solution I went with was to simply avoid opening the cell popover but instead click the cell action icon directly

* WIP: selectable search

* clean up

* eui to v51.1.0

* i18n tokens

* resolve SharedRenderCellElementProps.schema optionality

* i18n, snapshot updates

* shapshot update

* consolidate url-parse

Co-authored-by: Constance Chen <constance.chen@elastic.co>
2022-03-16 15:39:15 -06:00
Sergi Massaneda
53ba0305f7
[SecuritySolution] Add runtime field edit/delete actions in the Field Browser (#127037)
* implement fieldBrowser runtime field edit/remove actions

* fix user edit permission check

* fix lint error

* test improvements and fixes

* test fix

* fix rules sourcerer loading unmounting alerts

* column widths updated

* comment removed

* test fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-15 11:37:29 +01:00
Tiago Costa
8cd75df196
chore(NA): upgrade typescript-eslint packages to v5.14.0 (#127275)
* chore(NA): upgrade typescript-eslint packages to v5.14.0

* chore(NA): ignore required quotes

* Update packages/elastic-eslint-config-kibana/typescript.js

Co-authored-by: Spencer <email@spalger.com>

* chore(NA): remove old lint disable comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Spencer <spencer@elastic.co>
Co-authored-by: Spencer <email@spalger.com>
2022-03-10 22:44:06 +00:00
Esteban Beltran
5ad355e8c7
Remove all cases related code from timelines (#127003) 2022-03-08 09:01:09 +01:00
Sergi Massaneda
a79562a67e
[SecuritySolution] Alerts table Fields Browser revamp (#126105)
* field browser first revamp implementation

* customize columns for security solution alert tables

* cleaning

* some tests

* clean unused code

* field browser tests created and existing fixed

* security solution test fixes

* translations cleaned

* fix test

* adapt cypress tests

* remove translation

* fix typo

* remove duplicated test

* type error fixed

* enable body vertical scroll for small screens

* fix new field not added to the table bug

* addapt Kevin performance improvement

* fixed linter error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-07 15:14:41 +01:00
Kevin Qualters
377e2b4c3d
[Security Solution] Improve fields browser performance (#126114)
* Probably better

* Make backspace not slow

* Type and prop cleanup

* PR comments, fix failing cypress test

* Update cypress tests to wait for debounced text filtering

* Update cypress test

* Update failing cypress tests by waiting when needed

* Reload entire page for field browser tests

* Skip failing local storage test

* Remove unused import, cleanKibana back to before

* Skip failing tests

* Clear applied filter onHide, undo some cypress changes

* Remove unnecessary wait

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-04 13:17:25 -05:00