Commit graph

46895 commits

Author SHA1 Message Date
Thomas Watson
250e0d13e8
Bump immer, redux and @reduxjs/toolkit (#110962)
Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com>
2021-10-07 14:34:36 -04:00
garanews
58f6d9002a
Fix typos in docs & dev_docs (#113746) 2021-10-07 14:30:32 -04:00
Tyler Smalley
5e18fb1899 [ci] Fix setup_bazel permissions
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-10-07 11:27:52 -07:00
Tyler Smalley
4c66da4410
[Bazel] Only persist cache and create build invocations in on-merge pipeline (#114035)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-10-07 11:19:30 -07:00
Brian Seeders
62dfd2321d
[CI] Add failure count and github issue link to new failed test page (#114138) 2021-10-07 19:18:40 +01:00
Jonathan Budzenski
e777ce9e3c add details to skipped test 2021-10-07 11:34:48 -05:00
Jonathan Budzenski
574a978227 skip flaky suite 2021-10-07 11:21:58 -05:00
Joe Portner
64f37e7414
Remove securityOss plugin (#113946) 2021-10-07 17:57:37 +02:00
Byron Hulcher
920ea03829
[App Search] General UX Improvements for Curations and Suggestions (#114213) 2021-10-07 11:32:24 -04:00
Mat Schaffer
a5f4304672
Logstash view cleanup fixes (#114218)
* Fix route ordering/duplication

* Take out "IDK" comments

I remember we figured this out last week while pairing :)
2021-10-07 17:07:14 +02:00
Jonathan Budzenski
dee9444dcc skip flaky suite, #114249, #114250 2021-10-07 09:51:27 -05:00
Josh Dover
d33eb809a2
[Fleet] Report installing status while package install is in progress (#111875)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 16:49:41 +02:00
Thomas Watson
2eff6d0148
Ensure deprecation documentationUrl's point to correct doc branch (#114264)
This was made possible via PR #113600.
2021-10-07 09:57:28 -04:00
Kevin Lacabane
213c342820
[Stack Monitoring] use product names constants (#114096)
* use product names constants

* add missing productName property
2021-10-07 15:25:11 +02:00
Miriam
a7fd1e2189
Fix undhandle promise rejection (#114233) 2021-10-07 14:17:04 +01:00
Stratoula Kalafateli
541090deb7
[Charts] Unskips the jest active cursor test suite (#114246) 2021-10-07 15:53:38 +03:00
Dominique Clarke
7f1adb8d95
[Observability] [Exploratory View] only show y axis label for a single series (#113989) 2021-10-07 08:10:46 -04:00
Maja Grubic
d65715b6d7
[Field Formatters] Get rid of span ng-non-bindable (#113926)
* [Field Formatters] Get rid of span ng-non-bindable

* Remove span explicitly

* Remove span entirely

* Update src/plugins/field_formats/common/content_types/html_content_type.ts

Co-authored-by: Tim Roes <mail@timroes.de>

Co-authored-by: Tim Roes <mail@timroes.de>
2021-10-07 14:10:18 +02:00
Dario Gieselaar
ea160a5072
[APM] Trace generation library (#113764) 2021-10-07 13:04:00 +02:00
Marta Bondyra
f50345f8ef
[Lens] Chart is not updating with Refresh button (#114135) 2021-10-07 12:57:38 +02:00
Liza Katz
136eafe5a7
[Fullstory] Report mem usage (#114108)
* memory

* jest test

* typo
2021-10-07 13:49:03 +03:00
Alexey Antonov
3291e85119
[KIbana Utils] createGetterSetter should work with optional plugins (#114128) 2021-10-07 13:47:28 +03:00
Pierre Gayvallet
855d2f1094
Migrate routing and navigation docs to new developer guide (#113919)
* Migrate routing and navigation doc to new doc system

* address feedback
2021-10-07 12:45:15 +02:00
Diana Derevyankina
836abdfc16
Respect external URL allow list in vega (#113720)
* Respect external URL allow list in vega

* Add getExternalUrlsAreNotEnabledError

* Revert moving some code in vega_base_view

* Add externalUrl to vega_base_view.d.ts

* Add throwing errors to prevent from following the link

* Fix condition
2021-10-07 13:11:22 +03:00
Shahzad
c2049ed754
[Observability] Move InspectContextProvider and utils to observability (#113842) 2021-10-07 06:05:15 -04:00
Shahzad
380c51ab33
[Exploratory view] Label field filters/breakdowns (#113766) 2021-10-07 11:49:51 +02:00
Dmitry Tomashevich
dca5e1ca76
[Discover] persist columns selection after resetting state, taking into account _source column (#114178) 2021-10-07 12:23:55 +03:00
Robert Oskamp
f7174809e1
Functional tests - fix retry.waitFor not timing out correctly (#113905)
This PR fixes bugs in test services, where retry.waitForWithTimeout and find.descendantExistsByCssSelector do not time out correctly.
2021-10-07 11:23:33 +02:00
Pablo Machado
95d53a28bb
Add Host Risk metadata data to alerts flyout (#113274)
* Filter out empty values from alert flyout overview

* Add Host Risk metadata data to alerts flyout

* Add feature flag to host risk data query

* Swap investigation guide and enrichment data places in the UI

* Migrate alert_summary_view.test to react testing library

* Refactor threat summary by extracting components and renaming
2021-10-07 11:06:24 +02:00
Bryan Clement
a1849bba50
[Osquery] 7.15 osquery bug squash (#113325)
* integration policies fixes

* don't update scheduled query group name while importing pack if there's already a name set

* handle reseting form state on submission error

* nixed the console logging

* fix linting issues

* useFormData instead of getFields

* linter plz

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 10:23:07 +02:00
Anton Dosov
1b8ec4efa8
[Search] Reuse uiSettings within bsearch request (#114088) 2021-10-07 09:51:45 +02:00
Clint Andrew Hall
78021330c7
[fleet][unified integrations] Fix flaky test (#114202) 2021-10-07 09:51:18 +02:00
Shahzad
e388648f9d
[Uptime] Move Monitor list histogram to async search (#113528)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 09:48:14 +02:00
David Sánchez
9a31e86c5c
[Security Solution][Endpoint] Display empty state UI on the artifacts subtab of policy details when no trusted application exist (#113802)
* Adds new empty prom when there is no TA or non already assigned one

* Adds policy name to text message

* Fix error in tabs component

* Fix mulilangs in empty state components

* API call that checks if any TA exists with actions and reducers

* Adds current policy id and name to the empty state component instead of a fake ones

* Adds unit test for layout

* Switch empty state depending on results and added unit test

* Fix multilang keys and join code into a hook to avoid duplications

* Fix TS error

* Canges icon

* Fixes pr comments

* Fix ts error in test
2021-10-07 09:33:46 +02:00
Uladzislau Lasitsa
280d1d84b4
Add savedSearchId when we update state with searchSource (#113938)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-07 10:30:03 +03:00
Spencer
b9f0965381
[failed-test-reporter/es-config] add new sub-fields in mapping (#114200)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-10-07 00:12:46 -05:00
Matthew Kime
202980e887
[data views] clarify field subtype typescript types (#112499)
* separate out multi and nested subTypes

* separate out multi and nested subTypes

* add undefined checks

* remove expect error statements

* use helper functions in es-query

* simplify changes with helper functions

* checking existence instead of getting value x2

* simplify types and revert discover changes

* update discover sidebar with helper methods

* try helpers with group_fields file

* try different helper with group_fields file

* revert group field changes, try nested field helpers

* revert nested field changes, try field_name.tsx helpers

* fix maps jest test

* use helpers in discover instead of setting types

* fix field_name.tsx

* Update index_pattern_util.test.ts

* lint  fix

* fix common exports

* reduce data_views plugin bundle size

* reduce data_views plugin bundle size

* remove discover reliance on es-query package

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 23:13:21 -05:00
Nathan Reese
a67eef4c31
[Maps] fix typings for optionalPlugins (#114103) 2021-10-06 18:24:28 -06:00
Nathan Reese
c2aeac5141
[Maps] do not lazy load setup API methods (#114150)
* [Maps] do not lazy load setup API methods

* remove test code
2021-10-06 18:24:15 -06:00
Scotty Bollinger
758eb157f4
[Workplace Search] Update Source Frequency views to match new designs (#114157)
* Add schema for blocked_windows and blockedWindows type

* Update constants and types

Also changes the size of a spacer

* Update FrequencyItem to new design

* Update BlockedWindowItem to new design

* Update logic file for new designs

It was decided that we would omit the seconds from any API-submitted duration values.

* Add i18n for UTC tooltip

* Better function name

Also moved const closer to function declarations for easier readability

* Add reducers

CI was complaining about types since the method wasn’t used. Was going to add these in a future PR but will add them here so we can merge
2021-10-06 19:46:24 -04:00
Brandon Kobel
a4ee087fd7
Reverting to legacy ES client behavior where maxSockets = Infinity (#113644)
* Reverting to legacy ES client behavior where maxSockets = Infinity

* Removing unnused type

* Specifying keepAlive: true by default

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-06 16:18:58 -07:00
Thom Heymann
94b2e30bd7
Interactive Setup UI enhancements (#113011) 2021-10-06 23:56:42 +01:00
Brian Seeders
4d8d7ee0ad
[buildkite] Several small tweaks and cleanup (#114006) 2021-10-06 18:56:30 -04:00
Jonathan Budzenski
9df3db075f
[config] Remove leading spaces from logging configuration (#114168)
* [config] Remove leading spaces from logging configuration

This is a consistency check with other areas of the stack and other
configurations in kibana.yml.

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

* Update kibana.yml
2021-10-06 17:46:33 -05:00
Andrew Goldstein
530663217c
[Security Solution] Increases code coverage in the timelines plugin (#113681)
## [Security Solution] Increases code coverage in the `timelines` plugin

This PR is the first in a series that increases code coverage in the `timelines` plugin, as part of <https://github.com/elastic/kibana/issues/111581>

### Methodology

1. Code coverage is measured by running the following command:

```
cd $KIBANA_HOME/x-pack && node scripts/jest.js timelines --coverage
```

The above command outputs the following coverage report:

```
kibana/target/kibana-coverage/jest/index.html
```

2. The coverage report is used to determine which paths need coverage, and measure coverage before / after tests are updated, as illustrated by the screenshots below:

**Before (example)**

![file-summary-before](https://user-images.githubusercontent.com/4459398/135690108-f90839b1-1450-4083-b928-5c5d99f1151d.png)

![file-coverage-before](https://user-images.githubusercontent.com/4459398/135690178-be24e716-545f-425f-bcd5-480026fcad1f.png)

**After (example)**

![file-summary-after](https://user-images.githubusercontent.com/4459398/135690267-7e94655f-4852-42f7-8180-8c195dd77e8b.png)

![file-coverage-after](https://user-images.githubusercontent.com/4459398/135690232-63130180-3fa1-4989-ac69-d8af7cc8fc95.png)

### React Testing Library vs Enzyme

- New test files are created using [React Testing Library](https://github.com/testing-library/react-testing-library) by default

- [Enzyme](https://github.com/enzymejs/enzyme) tests will only be used as a fallback when it's not reasonably possible to express the test in React Testing Library

- Code will (still) be instrumented to use `data-test-subj` in alignment with the Kibana [STYLEGUIDE](https://github.com/elastic/kibana/blob/master/STYLEGUIDE.mdx#camel-case-id-and-data-test-subj)

- When possible, the `getByRole` and other [higher priority](https://testing-library.com/docs/queries/about#priority) query APIs will be used in Jest tests, as opposed to selecting via `getByTestId` + `data-test-subj`. This follows the [guidance from React Testing Library](https://testing-library.com/docs/queries/about#priority).

- Note: Jest was already configured to use the `getByTestId` API with `data-test-subj` [here](4a54188355/packages/kbn-test/src/jest/setup/react_testing_library.js (L20))
2021-10-06 16:18:48 -06:00
Brian Seeders
170ed4b0ac
[buildkite] Move PR config into the master branch (#113986) 2021-10-06 22:57:06 +01:00
Frank Hassanabad
3237a746ae
[Security Solution] Migrates siem-detection-engine-rule-actions ruleAlertId and actions to saved object references array (#113577)
## Summary

Fixes https://github.com/elastic/kibana/issues/113278

* Migrates the legacy `siem-detection-engine-rule-actions` `ruleAlertId` and `actions` to saved object references arrays
* Adds an e2e test for `siem-detection-engine-rule-actions`
* Updates the types to work with the migrations and the new and old data structures.
* Decouples and removes reliance on alerting within the types since we do not want development of alerting to get in the way of legacy things and have migration changes by accident.
* Updates the REST interface and code to produce post migration data structures. Removes some types and code where w can since those parts are no longer needed/used.
* Adds `actionRef` to the mapping

Before migration you should see data structures like this if you query:
```json
GET .kibana/_search
{
  "query": {
    "term": {
      "type": {
        "value": "siem-detection-engine-rule-actions"
      }
    }
  }
}
```

```json
{
  "siem-detection-engine-rule-actions": {
    "ruleAlertId": "fb1046a0-0452-11ec-9b15-d13d79d162f3", <-- ruleAlertId which we want in the references array and removed
    "actions": [
      {
        "action_type_id": ".slack",
        "id": "f6e64c00-0452-11ec-9b15-d13d79d162f3", <-- id which we want in the references array and removed
        "params": {
          "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
        },
        "group": "default"
      }
    ],
    "ruleThrottle": "7d",
    "alertThrottle": "7d"
  },
  "type": "siem-detection-engine-rule-actions",
  "references": [], <-- Array is empty which instead needs the id's of alerts and actions
  "migrationVersion": {
    "siem-detection-engine-rule-actions": "7.11.2"
  },
  "coreMigrationVersion": "7.14.0",
  "updated_at": "2021-09-15T22:18:48.369Z"
}
```

After migration you should see data structures like this:
```json
{
  "siem-detection-engine-rule-actions": {
    "actions": [
      {
        "action_type_id": ".slack",
        "actionRef" : "action_0", <-- We use the name and "actionRef" to be consistent with kibana alerting
        "params": {
          "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
        },
        "group": "default"
      }
    ],
    "ruleThrottle": "7d",
    "alertThrottle": "7d"
  },
  "type": "siem-detection-engine-rule-actions",
  "references" : [
    {
      "name" : "alert_0", <-- Name is "alert_0"
      "id" : "fb1046a0-0452-11ec-9b15-d13d79d162f3", <-- Alert id is now here
      "type" : "alert" <-- Type should be "alert"
    },
    {
      "name" : "action_0", <-- Name is "action_0" and should be the same as kibana alerting names theirs for consistencty
      "id" : "f6e64c00-0452-11ec-9b15-d13d79d162f3", <-- Id of the action is now here.
      "type" : "action" <-- Type should be "action"
    }
  ],  
  "migrationVersion": {
    "siem-detection-engine-rule-actions": "7.16.0"
  },
  "coreMigrationVersion": "8.0.0",
  "updated_at": "2021-09-15T22:18:48.369Z"
}
```

Manual testing
---
There are e2e tests but for any manual testing or verification you can do the following:

If you have a 7.14.0 system and can migrate it forward that is the most straight forward way to ensure this does migrate correctly and forward. You should see that the legacy notification system still operates as expected.

If you are a developer off of master and want to test different scenarios then this section is for below as it is more involved and harder to do but goes into more depth:

* Create a rule and activate it normally within security_solution
* Do not add actions to the rule at this point as we are exercising the older legacy system. However, you want at least one action configured such as a slack notification.
* Within dev tools do a query for all your actions and grab one of the `_id` of them without their prefix:

```json
# See all your actions
GET .kibana/_search
{
  "query": {
    "term": {
      "type": "action"
    }
  }
}
```

Mine was `"_id" : "action:879e8ff0-1be1-11ec-a722-83da1c22a481"`, so I will be copying the ID of `879e8ff0-1be1-11ec-a722-83da1c22a481`

Go to the file `detection_engine/scripts/legacy_notifications/one_action.json` and add this id to the file. Something like this:

```json
{
  "name": "Legacy notification with one action",
  "interval": "1m",  <--- You can use whatever you want. Real values are "1h", "1d", "1w". I use "1m" for testing purposes.
  "actions": [
    {
      "id": "879e8ff0-1be1-11ec-a722-83da1c22a481", <--- My action id
      "group": "default",
      "params": {
        "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
      },
      "actionTypeId": ".slack" <--- I am a slack action id type.
    }
  ]
}
```

Query for an alert you want to add manually add back a legacy notification to it. Such as:

```json
# See all your siem.signals alert types and choose one
GET .kibana/_search
{
  "query": {
    "term": {
      "alert.alertTypeId": "siem.signals"
    }
  }
}
```

Grab the `_id` without the alert prefix. For mine this was `933ca720-1be1-11ec-a722-83da1c22a481`

Within the directory of detection_engine/scripts execute the script:

```json
./post_legacy_notification.sh 933ca720-1be1-11ec-a722-83da1c22a481
{
  "ok": "acknowledged"
}
```

which is going to do a few things. See the file `detection_engine/routes/rules/legacy_create_legacy_notification.ts` for the definition of the route and what it does in full, but we should notice that we have now:

Created a legacy side car action object of type `siem-detection-engine-rule-actions` you can see in dev tools:

```json
# See the actions "side car" which are part of the legacy notification system.
GET .kibana/_search
{
  "query": {
    "term": {
      "type": {
        "value": "siem-detection-engine-rule-actions"
      }
    }
  }
}
```

Take note that this actually creates the rule migrated since this PR updated the code to produce new side cars. So we have to use some scripting to change the actions to utilize the old format.  However, before continuing you should verify that this does fire correctly and that the new format is working as expected. After that replace the structure with the older structure like so below and downgrade the migration version so that we can restart Kibana and ensure that this does migrate correctly forward:

```json
# Get your id of your rules side car above and then use this script to downgrade the data structure
POST .kibana/_update/siem-detection-engine-rule-actions:210f4c90-2233-11ec-98c6-ed2574588902
{
  "script" : {
    "source": """
    ctx._source.migrationVersion['siem-detection-engine-rule-actions'] = "7.15.0";
    ctx._source['siem-detection-engine-rule-actions'].actions[0].id = ctx._source.references[1].id;
    ctx._source['siem-detection-engine-rule-actions'].actions[0].remove('actionRef');
    ctx._source['siem-detection-engine-rule-actions'].ruleAlertId = ctx._source.references[0].id;
    ctx._source.references.remove(0);
    ctx._source.references.remove(0);
    """,
    "lang": "painless"
  }
}
```

Restart Kibana and now it should be migrated correctly and the system should fire the notifications as expected. You shouldn't see any errors in your console.

In the scripts folder execute the `find_rules.sh` and expect to see actions like so in the rule with the `id` still in the REST interface and we shouldn't see `actionRef` within the actions:

```json
"actions": [{
  "id": "42534430-2092-11ec-99a6-05d79563c01a",
  "group": "default",
  "params": {
    "message": "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
  },
  "action_type_id": ".slack"
}],
```

Take the rule id and query that as well using `./get_rule_by_id.sh`  and verify that the action also looks the same and is present within the rule.

You can also verify all of this within the UI's as well for rules to ensure the action is still present and as we expect it to be and work.

### 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
2021-10-06 17:52:28 -04:00
Byron Hulcher
3135075250
[App Search] Split Curation Detail views into tabs (#114117) 2021-10-06 17:17:33 -04:00
Stacey Gammon
6723fa583f
Add packages to our API documentation (#113564)
* Add packages

* Update docs

* Fix test and types

* debug heap size

* remove debug heap line

* updated docs
2021-10-06 17:02:57 -04:00
Cauê Marcondes
e5e27cc863
[APM] Updating default option for searchAggregatedTransactions setting (#114174)
* updating default option for searchAggregatedTransactions setting

* updating
2021-10-06 15:47:47 -04:00