Commit graph

44845 commits

Author SHA1 Message Date
Kibana Machine
9f95a44fe3
[@kbn/securitysolution-es-utils] remove transport API in favour of typed public API (#113717) (#113831)
* remove transport API in favour of typed public API

* put elasticsearch_client back

* fix create index call

* fix setpolicy

* fix unit tests in SecuritySolution

Co-authored-by: Mikhail Shustov <restrry@gmail.com>
2021-10-04 17:41:09 -04:00
Dzmitry Lemechko
4d80db3ad9
[test/page_objects] validate selected dates for timepicker (#113597) (#113837)
* [test/page_objects] validate selected dates for timepicker

* unskip flaky test

* fix types check failure

* update tests

* update message

* unskip more tests
2021-10-04 17:27:48 -04:00
Kibana Machine
eee20307ad
[Uptime] Refactor snapshots into RTL (#113727) (#113836)
Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
2021-10-04 17:26:38 -04:00
Kibana Machine
5c794e0bcb
[Reporting] Improve _read code in ContentStream (#113237) (#113830)
Co-authored-by: Thomas Watson <w@tson.dk>
2021-10-04 17:00:08 -04:00
Kibana Machine
dad2009acd
prevent undefined filterQuery error (#113522) (#113818)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Sergi Massaneda <sergi.massaneda@elastic.co>
2021-10-04 16:22:14 -04:00
Kibana Machine
a5acdf5371
updates DevPrinciples URL (#113785) (#113819)
Co-authored-by: Kellen <9484709+goodroot@users.noreply.github.com>
2021-10-04 16:21:38 -04:00
Kibana Machine
2768124e07
[Fleet] Use elastic_agent package to build monitoring permissions for agent (#112730) (#113813)
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
2021-10-04 16:04:20 -04:00
Kibana Machine
58e534eefc
Better message for unanticipated authorisation errors (#113460) (#113806)
* Custom message for unanticipated 401 errors

* Refactor logout reasons

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Thom Heymann <190132+thomheymann@users.noreply.github.com>
2021-10-04 15:45:45 -04:00
Kibana Machine
344a4113af
🐛 Fix color fallback for different type of layers (#113642) (#113805)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
2021-10-04 15:36:53 -04:00
Kibana Machine
99431e7b48
[Security Solution] Migrates siem.notifications ruleAlertId to saved object references array (#113205) (#113800)
## Summary

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

* Migrates the legacy `siem.notifications` "ruleAlertId" to be within the references array
* Adds code to serialize and de-serialize "ruleAlertId" from the saved object references array
* Adds migration code to `kibana-alerting` to migrate on startup
* Adds `legacy_saved_object_references/README.md` which describes how to test and what those files are for.
* Updates earlier similar `signals/saved_object_references/README.md` after reviewing it during my work
* Names these files the format of `legacy_foo` since this is all considered legacy work and will be removed once the legacy notification system is removed after customers have migrated. 
* Adds unit tests
* Adds 2e2 tests

We only migrate if we find these conditions and cases:
* "ruleAlertId" is not `null`, `undefined` or malformed data
* The"ruleAlertId" references do not already have an exceptionItem reference already found within it.

We migrate on the common use case:
* "ruleAlertId" exists and is a string

We do these additional (mis-use) cases and steps as well. These should NOT be common things that happen but we safe guard for them here:
* If the migration is run twice we are idempotent and do NOT add duplicates or remove items.
* If the migration was partially successful but re-run a second time, we only add what is missing. Again no duplicates or removed items should occur.
* If the saved object references already exists and contains a different or foreign value, we will retain the foreign reference(s) and still migrate.

Before migration you should see data structures like this if you query:

```json
# Get the alert type of "siem-notifications" which is part of the legacy system.
GET .kibana/_search
{
  "query": {
    "term": {
      "alert.alertTypeId": "siem.notifications"
    }
  }
}
```

```json
"data..omitted": "data..omitted",
"params" : {
  "ruleAlertId" : "933ca720-1be1-11ec-a722-83da1c22a481" <-- Pre-migration we had this Saved Object ID which is not part of references array below
},
"actions" : [
  {
    "group" : "default",
    "params" : {
      "message" : "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
    },
    "actionTypeId" : ".slack",
    "actionRef" : "action_0" <-- Pre-migration this is correct as this work is already done within the alerting plugin
  },
  "references" : [
    {
      "id" : "879e8ff0-1be1-11ec-a722-83da1c22a481",
      "name" : "action_0", <-- Pre-migration this is correct as this work is already done within the alerting plugin
      "type" : "action"
    }
  ]
],
"data..omitted": "data..omitted",
```

After migration you should see data structures like this:
```json
"data..omitted": "data..omitted",
"params" : {
  "ruleAlertId" : "933ca720-1be1-11ec-a722-83da1c22a481" <-- Post-migration this is not used but rather the serialized version references is used instead.
},
"actions" : [
  {
    "group" : "default",
    "params" : {
      "message" : "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
    },
    "actionTypeId" : ".slack",
    "actionRef" : "action_0"
  },
  "references" : [
    {
      "id" : "879e8ff0-1be1-11ec-a722-83da1c22a481",
      "name" : "action_0",
      "type" : "action"
    },
    {
      "id" : "933ca720-1be1-11ec-a722-83da1c22a481", <-- Our id here is preferred and used during serialization.
      "name" : "param:alert_0", <-- We add the name of our reference which is param:alert_0 similar to action_0 but with "param"
      "type" : "alert" <-- We add the type which is type of alert to the references
    }
  ]
],
"data..omitted": "data..omitted",
```

## Manual testing 
There are e2e and unit 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"
      }
    }
  }
}
```

But more importantly what the saved object references are which should be this:

```json
# Get the alert type of "siem-notifications" which is part of the legacy system.
GET .kibana/_search
{
  "query": {
    "term": {
      "alert.alertTypeId": "siem.notifications"
    }
  }
}
```

If you need to ad-hoc test what happens when the migration runs you can get the id of an alert and downgrade it, then
restart Kibana. The `ctx._source.references.remove(1)` removes the last element of the references array which is assumed
to have a rule. But it might not, so ensure you check your data structure and adjust accordingly.
```json
POST .kibana/_update/alert:933ca720-1be1-11ec-a722-83da1c22a481
{
  "script" : {
    "source": """
    ctx._source.migrationVersion.alert = "7.15.0";
    ctx._source.references.remove(1);
    """,
    "lang": "painless"
  }
}
```

If you just want to remove your your "param:alert_0" and it is the second array element to test the errors within the console
then you would use
```json
POST .kibana/_update/alert:933ca720-1be1-11ec-a722-83da1c22a481
{
  "script" : {
    "source": """
    ctx._source.references.remove(1);
    """,
    "lang": "painless"
  }
}
```

Check your log files and should see errors about the saved object references missing until you restart Kibana. Once you restart then it will migrate forward and you will no longer see errors.

### 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: Frank Hassanabad <frank.hassanabad@elastic.co>
2021-10-04 15:30:01 -04:00
Kibana Machine
c7ae6fe96c
[Uptime] Supress fetch errors on no data screen (#113458) (#113797)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
2021-10-04 14:36:22 -04:00
Kibana Machine
64cedf1eee
Increase timeout for long-running unit test assertions. (#113122) (#113793)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
2021-10-04 18:21:59 +00:00
Kibana Machine
4913677f5f
fix priority reset bug (#113626) (#113789)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Sergi Massaneda <sergi.massaneda@elastic.co>
2021-10-04 14:20:03 -04:00
Kibana Machine
9f685ef2a4
[Stack Monitoring] Migrate Index Views to React (#113660) (#113784)
* index views

* fix type

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
2021-10-04 14:05:40 -04:00
Sébastien Loix
cef53a981a
[7.x] [console] Deprecate "proxyFilter" and "proxyConfig" on 8.x (#113555) (#113781)
* [console] Deprecate "proxyFilter" and "proxyConfig" on 8.x (#113555)

* Change MAJOR_VERSION to 7.16.0
2021-10-04 13:43:22 -04:00
Kibana Machine
b47f88afb4
[APM] Show APM Server stand-alone mode in Kibana Upgrade Assistant (cloud-only) (#113567) (#113778)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
2021-10-04 13:39:22 -04:00
Kibana Machine
d33e519c35
[Security] Add EQL rule test in CCS config (#112852) (#113777)
Co-authored-by: Domenico Andreoli <domenico.andreoli@elastic.co>
2021-10-04 13:33:17 -04:00
Kibana Machine
af114bf336
[TSVB] Update the series and metrics Ids that are numbers to strings (#113619) (#113772)
* [TSVB] Update the series and metrics Ids that are numbers to strings

* Minor changes

* Adds a unit test to TSVB plugin to test this case

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2021-10-04 13:21:34 -04:00
Kibana Machine
525aa24d65
[Fleet] Fix how we get the default output in the Fleet UI (#113620) (#113771)
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
2021-10-04 13:18:24 -04:00
Kibana Machine
6735f27f28
Adding range filter to ownerId aggregation (#113557) (#113761)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: ymao1 <ying.mao@elastic.co>
2021-10-04 12:34:23 -04:00
Kibana Machine
98d7a37c73
[7.x] [Uptime] Run Sample uptime tests using @elastic/synthetics (#112128) (#113531)
* [Uptime] Run Sample uptime tests using @elastic/synthetics (#112128)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* update test according to 7.x

* revert

Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
Co-authored-by: shahzad31 <shahzad31comp@gmail.com>
2021-10-04 16:28:53 +00:00
Kibana Machine
c4270f3890
[Discover] Extract fetch observable initialization to separate function (#108831) (#113760)
* Don't trigger autorefresh when there's no time picker
- because there's no UI for that

* Refactor and add test

* Add doc and test

* Refactor

* Remove index pattern without timefield filtering

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
2021-10-04 16:28:38 +00:00
Kibana Machine
06cfb7ba12
[Stack Monitoring] React migration kibana overview (#113604) (#113758)
* Create react Kibana template

* React Kibana overview

* Add breadcrumb to kibana overview

* fix linting errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kevin Lacabane <klacabane@gmail.com>
2021-10-04 12:26:28 -04:00
Aleh Zasypkin
a7a266a5d4
Remove jsonwebtoken and base64url dependencies. (#113723) (#113753)
# Conflicts:
#	renovate.json5
2021-10-04 12:08:05 -04:00
spalger
66d4fb4e76 Revert "Lint git index content on commit (#113300) (#113594)"
This reverts commit 8422a244b1.
2021-10-04 16:03:06 +00:00
spalger
b5090abace Revert "Revert "chore: add modifications to staging automatically after eslint fix (#113443) (#113611)""
This reverts commit da2f48caef.
2021-10-04 16:01:06 +00:00
Kibana Machine
362c29b714
[Security Solution][Endpoint] Show list of trusted application on the Policy Details (#112182) (#113742)
* New Artifact Collapsible card and Grid generic components
* Fleet setup test data loader - ignore 409 concurrent installs in data loader for fleet setup
* Adds `ContextMenuWithRouterSupport` prop for `maxWidth` and `truncateText` prop for `ContextMenuItemNaByRouter`
* trustedApps generator loader - use existing policies (if any) when loading TAs
* `CardCompressedHeaderLayout` support for `flushTop` prop

Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
2021-10-04 16:00:30 +00:00
Kibana Machine
52aeed67a7
[buildkite] Fix packer cache issues (#113769) (#113773)
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
2021-10-04 11:09:16 -04:00
Kibana Machine
d5cb31afe0
[Lens] move from slice to reducers/actions and simplify loading (#113324) (#113740)
* structure changes

* tests & fix for sessionId

* share mocks in time_range_middleware

* make switchVisualization and selectSuggestion one reducer as it's very similar

* CR

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Marta Bondyra <marta.bondyra@gmail.com>
2021-10-04 10:03:17 -04:00
Kibana Machine
f6597024ce
[Lens] Threshold: add padding to avoid axis label collision with threshold markers (#112952) (#113735)
* 🐛 Add padding to the tick label to fit threshold markers

* 🐛 Better icon detection

* 🐛 Fix edge cases with no title or labels

* 📸 Update snapshots

*  Add icon placement flag

*  Sync padding computation with marker positioning

* 👌 Make disabled when no icon is selected

* 🐛 Fix some edge cases with auto positioning

* Update x-pack/plugins/lens/public/xy_visualization/xy_config_panel/threshold_panel.tsx

Co-authored-by: Michael Marcialis <michael@marcial.is>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Marcialis <michael@marcial.is>

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Co-authored-by: Michael Marcialis <michael@marcial.is>
2021-10-04 09:27:37 -04:00
Tiago Costa
99ecde34d9
skip flaky suite (#106650) 2021-10-04 12:50:08 +01:00
Kibana Machine
518b730ce7
Unskips the visualize reporting functional test suite (#113535) (#113722)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2021-10-04 07:09:15 -04:00
Pierre Gayvallet
b0b8243bac
Deprecates the --plugins alias (#113595) 2021-10-04 11:09:26 +02:00
Kibana Machine
44b1a2e4cf
[ci-stats] Local metrics fixes (#113492) (#113710)
* Rename `{ group: 'yarn start', id: 'started' }` to `{ group: 'scripts/kibana', id: 'dev server started' }` for consistency
* Rename `{ group: '@kbn/optimizer' }` to `{ group: 'scripts/build_kibana_platform_plugins' }` for consistency
* Include email for Elastic employees
* Standardize on Unix paths
* Set `subProcess: true` if the timing is already captured by a parent.
* Move nestedTiming to global and use normalize-path

Co-authored-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-10-03 18:34:03 -04:00
Kibana Machine
53fa6f53a0
[buildkite] Fix unbound variable in post_build script (#113687) (#113688)
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
2021-10-01 19:51:55 -04:00
Kibana Machine
fe00c134d9
[Buildkite] Pull Request pipeline (#112029) (#113683)
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
2021-10-01 19:13:42 -04:00
Kibana Machine
7e7eb63703
[Cases] [104932] Remove newline characters from summary field and add tests (#113571) (#113668)
* [104932] Remove newline characters from summary field and add tests

* PR fix

Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kristof C <kpac.ja@gmail.com>
Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co>
2021-10-01 18:28:23 -04:00
Tre
40601a647d
[7.x] [Archive Migration] xpack..saved_objects_management/spaces_integration (#113047) (#113643)
* [Archive Migration] xpack..saved_objects_management/spaces_integration (#113047)

# Conflicts:
#	x-pack/test/functional/apps/saved_objects_management/spaces_integration.ts
#	x-pack/test/functional/es_archives/saved_objects_management/spaces_integration/data.json
#	x-pack/test/functional/es_archives/saved_objects_management/spaces_integration/mappings.json

* Drop unused symbol
2021-10-01 18:24:47 -04:00
CJ Cenizal
c385d49887
Revert "[Upgrade Assistant] Refactor telemetry (#112177)" (#113665)
This reverts commit 991d24bad2.
2021-10-01 15:17:16 -07:00
Kibana Machine
ac0ba881f6
Create standards.mdx (#113313) (#113654)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Stacey Gammon <gammon@elastic.co>
2021-10-01 15:58:12 -04:00
Kibana Machine
b91f8c8679
[logging] Upgrade ECS to 1.12 (#113583) (#113651)
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
2021-10-01 19:32:08 +00:00
Kibana Machine
f730038fff
Annotates beats tutorials with custom integration categories (#113565) (#113652)
Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
2021-10-01 15:29:49 -04:00
Dmitry Tomashevich
6b068c5972
[Discover] Fix doc viewer table columns (#113124) (#113637)
* [Discover] fix doc viewer table columns

* [Discover] apply suggestions

* [Discover] apply suggestion

* [Discover] fix action column

* [Discover] do not apply min-width to actions column

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-10-01 15:21:47 -04:00
Kibana Machine
8956e7f55e
[buildkite] Add a minimal flaky test suite runner job (#113575) (#113657)
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
2021-10-01 14:16:06 -04:00
Kibana Machine
c39e72ac38
Exclude cypress folders from Jest test coverage (#113482) (#113639)
Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
2021-10-01 13:51:40 -04:00
Tyler Smalley
da2f48caef Revert "chore: add modifications to staging automatically after eslint fix (#113443) (#113611)"
This reverts commit e30c1f5323.
2021-10-01 09:08:27 -07:00
Kibana Machine
d8a310ed6e
[Discover] Save collapse sidebar state in local storage (#113287) (#113616)
* [Discover] fix selected fields persist

* [Discover] apply solution for entire sidebar instead of "Selected fields" collapse button

* [Discover] update unit tests

* [Discover] update unit tests

* [Discover] improve tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Dmitry Tomashevich <39378793+Dmitriynj@users.noreply.github.com>
2021-10-01 10:48:09 -04:00
Kibana Machine
196ed668f6
fix sorting, pagination, state (#113563) (#113613)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
2021-10-01 10:37:12 -04:00
Kibana Machine
4814df2e11
[Fleet] Show beats replacements in integration browser (#113291) (#113615)
Display both beats and epr-packages in the integration browser. When there is overlap, the EPR-package equivalent is displayed. When the EPR-package is not yet ga, the beat-equivalent is displayed.

Co-authored-by: Thomas Neirynck <thomas@elastic.co>
2021-10-01 10:35:57 -04:00
Kibana Machine
e30c1f5323
chore: add modifications to staging automatically after eslint fix (#113443) (#113611)
After precommit hook runs with --fix flag changes are not added to staging. However it also does not
validate staging area since eslint is only looking for last changes on file not staging area this
results fellows to commit with linting errors which fails in CI. This commit resolves this issue by
adding fixed files right after linting to staging area.

Closes #52722

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Baturalp Gurdin <9674241+suchcodemuchwow@users.noreply.github.com>
2021-10-01 10:24:03 -04:00