Commit graph

46687 commits

Author SHA1 Message Date
Clint Andrew Hall
fae5946eee
[fleet] Divide and mock Storybook context, create Home story (#113064)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 22:45:56 -04:00
Jonathan Budzenski
73af4f8054 fix skip. #113067 2021-09-27 21:09:42 -05:00
John Dorlus
39e06326dc
Migrate Index Management Functional Tests To Use Test User (#113078)
* Added config and code to make index management use test user.

* Removed unused reference.

* Changed config back to only modifying the permissions on the indices.

* Fixed assertion for new permission.
2021-09-27 20:47:44 -04:00
Clint Andrew Hall
7f3182a1a6
[fleet] Fix over-call to chrome service in useBreadcrumb (#113065)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 19:47:12 -05:00
Frank Hassanabad
de43a3b83d
[Security Solutions] Adds back the legacy actions and notification system in a limited fashion (#112869)
## Summary

Fixes https://github.com/elastic/security-team/issues/1759

Related earlier PR, https://github.com/elastic/kibana/pull/109722, where these were removed to where they could no longer function. This PR adds them back to where they will function for existing users. The end goal is to have users naturally migrate as they update, enable/disable, or create new rules. 

What this PR does:
* Adds back the legacy side car actions `siem-detection-engine-rule-actions`
* Adds back the legacy hidden alert of `siem.notifications`
* Adds back unit tests where they existed. Both of these systems did not have existing e2e tests.
* Re-adds the find feature and functionality which should show the rules with legacy and non-legacy notifications/side car actions during a REST find operation.
* Updates the logic for when to show a legacy vs. non-legacy notification/side car action.
* Adds a new route called `/internal/api/detection/legacy/notifications` which is only for developer and tests for us to maintain this system for the foreseeable future.
* Adds script to exercise creating old notifications `detection_engine/scripts/post_legacy_notification.sh`
* Adds a data file for the script to use as an example for ad-hoc testing, `scripts/legacy_notifications/one_action.json`
* Adds within `security_solution/server/types.ts` `ActionsApiRequestHandlerContext` so that if we need to directly access actions within plugins we can. I do not use it here, but it should have been existing there and is good to have it in case we need it at this point within REST routes.
* When adding back the files and changes, I use the kibana-core approach of prefixing files, functions, types, etc... with the words `legacyFoo`. The files are named `legacy_foo.ts`. Everything has `@deprecation` above them as well. The intent here is all of this should hopefully make it unambiguously clear which parts of the notification system are for the new system/existing API and which ones are only for the deprecated legacy system. There exists some parts of the system that are used within _both_ and the hope is that we can keep the legacy pieces separate from the non-legacy pieces for strangling the legacy pieces.   
* This adds a new linter rule to prevent users from easily importing files named `legacy_foo.ts` or `foo_legacy.ts` we are using here and can also use for other similar legacy parts of the system we have.  This seems to be the established pattern that kibana-core does as well looking through the linters and code base.
* Removes some dead import/export code and types instead of maintaining them since they are no longer used.

What this PR does not do (but are planned on follow ups):
* This PR does not add migration logic in most conditions such as a user enabling/disabling a rule, editing a rule unless the user is explicitly changing the actions by turning off the notification and then re-adding the notification.
* This PR does not log any information indicating to the user that they are running legacy rules or indicates they have that.
* This PR does not allow the executors or any UI/UX, backend to re-add a legacy notification. Instead only the hidden REST route of `/internal/api/detection/legacy/notifications` allows us to do this for testing purposes.
* This PR does not migrate the data structure of actions legacy notification system `siem-detection-engine-rule-actions` to use saved object references.
* If you delete an alert this will not delete the side car if it detects one is present on it.
* If you update an alert notification with a new notification this will not remove the side car on the update.

**Ad-hoc testing instructions**
How to do ad-hoc testing for various situations such as having a legacy notification system such as a user's or if you want to mimic a malfunction and result of a "split-brain" to where you have both notification systems running at the same time due to a bug or regression:

Create a rule and activate it normally within security_solution:
<img width="1046" alt="Screen Shot 2021-09-22 at 2 09 14 PM" src="https://user-images.githubusercontent.com/1151048/134416564-e4e001a7-1086-46a1-aa8d-79880f70cc35.png">

Do not add actions to the rule at this point as we will first exercise the older legacy system. However, you want at least one action configured such as a slack notification:
<img width="575" alt="Screen Shot 2021-09-22 at 2 28 16 PM" src="https://user-images.githubusercontent.com/1151048/134417012-58e63709-5447-4832-8866-f82be1b9596b.png">

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
```bash
./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"
      }
    }
  }
}
```

Note in the response:
```json
          "siem-detection-engine-rule-actions" : {
            "ruleAlertId" : "933ca720-1be1-11ec-a722-83da1c22a481", <--- NOTE, not migrated to references yet
            "actions" : [
              {
                "action_type_id" : ".slack",
                "id" : "879e8ff0-1be1-11ec-a722-83da1c22a481", <--- NOTE, not migrated to references yet
                "params" : {
                  "message" : "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
                },
                "group" : "default"
              }
            ],
            "ruleThrottle" : "1m", <--- Should be the same as the interval in "one_action.json" config
            "alertThrottle" : "1m" <--- Should be the same as the interval in "one_action.json" config
          },
          "type" : "siem-detection-engine-rule-actions",
          "references" : [ ],
```

Created a `siem.notification` rule instance which you can see in dev tools as well:
```json
# Get the alert type of "siem-notifications" which is part of the legacy system.
GET .kibana/_search
{
  "query": {
    "term": {
      "alert.alertTypeId": "siem.notifications"
    }
  }
}
```

Take note from the `siem.notifications` these values which determine how/when it fires and if your actions are set up correctly:
```json
            "name" : "Legacy notification with one action" <--- Our name from one_action.json 
            "schedule" : {
              "interval" : "1m" <--- Interval should match interval in one_action.json
            },
            "enabled" : true, <--- We should be enabled
            "actions" : [
              {
                "group" : "default",
                "params" : {
                  "message" : "Hourly\nRule {{context.rule.name}} generated {{state.signals_count}} alerts"
                },
                "actionTypeId" : ".slack", <--- Our actionID
                "actionRef" : "action_0"
              }
            ],
```


And that now there exists a task within task manager that will be executing this:
```json
# Get the tasks of siem notifications to ensure and see it is running
GET .task-manager/_search
{
  "query": {
    "term": {
      "task.taskType": "alerting:siem.notifications"
    }
  }
}
```

You can double check the interval from the result of the query to ensure it runs as the configuration test file shows it should be:
```json
            "schedule" : {
              "interval" : "1m"
            },
```

Within time you should see your action execute like the legacy notification system:
<img width="876" alt="Screen Shot 2021-09-22 at 2 55 28 PM" src="https://user-images.githubusercontent.com/1151048/134422639-80523abb-f43c-4f7c-abef-a60062bef139.png">

If you go to edit the rule you should notice that the rule now has the side car attached to it within the UI:
<img width="1050" alt="Screen Shot 2021-09-22 at 8 08 54 PM" src="https://user-images.githubusercontent.com/1151048/134445265-fa0a330b-3238-48e2-aef3-6042c7e9aa69.png">

You can also look at your log messages in debug mode to verify the behaviors of the legacy system and the normal rules running.

Compare these data structures to a 7.14.x system in cloud to ensure the data looks the same and the ad-hoc testing functions as expected.

Check the scripts of `./find_rules.sh`, `./read_rules.sh` to ensure that the find REST route returns the legacy actions when they are there.

### 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
2021-09-27 17:18:03 -06:00
Jonathan Budzenski
90792cf738
Bump lmdb-store to 1.6.8 (#112743)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 17:42:19 -04:00
Ece Özalp
5955ed550a
[Security Solution] Fix inspect button bug on the overview page (#113161)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 17:14:30 -04:00
Jonathan Budzenski
96bfe341c4
[docs] Update keystore location (#111994)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 16:12:45 -05:00
Joey F. Poon
94e7844301
[Security Solution] update endpoint list api to support united index (#112758) 2021-09-27 14:51:31 -05:00
Jason Stoltzfus
1767bee636
Added a SuggestionsTable to Curations view (#113123) 2021-09-27 15:50:53 -04:00
Diana Derevyankina
3e5d5f4415
[Viz] legend duplicates percentile options when chart has both left & right Y axes (#113073)
* [Viz] legend duplicates percentile options when chart has both left & right Y axes

* Update comment for isPercentileIdEqualToSeriesId

* Remove Dimension interface

* Replace partial aspect with whole aspect value

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 22:15:54 +03:00
Tim Sullivan
cb37ae8142
[Reporting] Stabilize CSV export tests (#112204)
* [Reporting] Stabilize CSV export tests

* add debugging logging for results metadata

* restore accidentally deleted tests

* restore "large export" test

* remove redundant availability test

* do not filter and re-save

* fix getHitCount

* fix large export test

* skip large export test :(

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 11:44:29 -07:00
Ece Özalp
76d966a33a
[CTI] adds Risky Host Overview Card (#109553) 2021-09-27 14:28:09 -04:00
Spencer
6612f2b533
[optimizer] keep classnames to support constructor.name (#113119)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-09-27 13:04:10 -05:00
Christiane (Tina) Heiligers
96379a5be3
Decouples saved objects management from legacy saved objects loaders (#113031)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 13:36:05 -04:00
Zacqary Adam Xeper
add8f130cf
[Stack Monitoring] Convert standalone_clusters directory to typescript (#112696)
* [Stack Monitoring] Convert standalone_clusters directory to typescript

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 13:07:55 -04:00
Zacqary Adam Xeper
dc024442ec
[Stack Monitoring] Convert setup directory to typescript (#112584)
* [Stack Monitoring] Convert setup directory to typescript

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 13:02:52 -04:00
Byron Hulcher
40dbe1a161
[App Search] Continue polling empty engines even when they have a schema (#112915) 2021-09-27 13:00:31 -04:00
Michael Dokolin
16aa9bf85f
[Expressions] Partial results example plugin (#113001)
* Update mapColumn expression function implementation to support partial results
* Add partial results example plugin
2021-09-27 18:54:05 +02:00
Vadim Yakhin
9e95786b42
[Workplace Search] Remove unused components and redundant link (#112971)
* Remove user_icon and user_option_item components

They are no longer needed after the removal of Standard Auth

* Remove link wrapping image

It duplicates the link below the image and creates a redundant "external link" icon

* Fix typo

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 11:24:12 -05:00
Thomas Neirynck
be1ee57a03
[Fleet] Add custom integrations API (#112481)
Add a new plugin `custom_integrations`. This plugin allows for the registration of data-integrations tutorials. The Fleet-integrations app will display these alongside the existing Elastic Agent integrations.
2021-09-27 11:54:43 -04:00
Chris Roberson
0d3fa769b5
[Actions] Add preconfigured actions to our telemetry data (#112514)
* Add preconfigured action telemetry

* Revert this change

* Treat the preconfigured action ids the same as the non preconfigured ones

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 11:17:02 -04:00
Maja Grubic
c0d68aac32
[Saved Search Embeddable] Add view action (#112396)
* [Saved Search Embeddable] Add view action

* Fix typescript and lint errors; add tests

* Add a functional test

* Fix a unit test

* Renaming action

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 16:14:49 +02:00
Walter Rafelsberger
ae4e7ccc51
[ML] Transforms: Align privileges checks with ML plugin. (#112970)
To check the available node count, the ML plugin has an additional privileges check before returning the result. This PR uses the same approach for the corresponding transforms node endpoint.
2021-09-27 15:35:27 +02:00
Robert Oskamp
314227d259
[ML] Functional tests - stabilize custom URLs tests (#113096)
This PR stabilizes the functional custom URLs tests by adding retries for the dashboard and other type URL save service methods, similar to what we already have in the discover type URL save service method.
2021-09-27 15:30:24 +02:00
Tiago Costa
d2d0da7c7d
skip flaky suite (#113082) 2021-09-27 13:16:19 +01:00
Anton Dosov
ac0fd7ced6
[uiActionsEnhanced] reduce bundle size (#112956) 2021-09-27 14:00:48 +02:00
Tiago Costa
5f264441f3
skip flaky suite (#93354) 2021-09-27 12:58:59 +01:00
Robert Oskamp
149d4025b9
[ML] Functional tests - re-enable tests after ES fix (#113095)
With the Elasticsearch fix https://github.com/elastic/elasticsearch/pull/77801 merged, we can now re-enable the test suites that have been skipped due to the corresponding sort optimization issue.
2021-09-27 13:38:05 +02:00
Yulia Čech
bbc0713c2e
[ILM] Added max_primary_shard_size input to shrink action (#111394)
* [ILM] Added `max_primary_shard_size` input to shrink action (hot and warm phases)

* [ILM] Fixed form serializer and deserializer

* [ILM] Added CITs for shrink action

* [ILM] Fixed i18n issues

* [ILM] Made `number_of_shards` the default option for the shrink action

* [ILM] Fixed i18n files

* [ILM] Added default value of 1 to the number of shards input in shrink action

* [ILM] Switched to a radio button group for shrink options

* [ILM] Back to shorter labels in the radio button group

* [Snapshot & Restore] Fixed eslint issues

* Update x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

* [ILM] Added key to the shrink field fixing shared state

* [ILM] Removed duplicated i18n strings

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
2021-09-27 13:18:18 +02:00
juliaElastic
aeaad1ff55
[Fleet] cleanup old package assets (#112644)
* cleanup on server side

* cleanup all older versions

* fixed type errors

* added unit tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 05:51:46 -04:00
Diana Derevyankina
6a950a3c27
[TSVB] Series hidden via click reappear on auto refresh (#112807)
* [TSVB] Series hidden via click reappear on auto refresh

* Move mainAxisGroupId back to render

* Remove blank line in vis.js

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 12:38:25 +03:00
Pierre Gayvallet
d2bd7f8487
Throw error during startup if scripting is disable in ES (#113068) 2021-09-27 11:35:25 +02:00
Marta Bondyra
48be0ca3b5
[Graph] remove warning and logs from console when testing (#113074)
* [Graph] simplify use_workspace_loader tests

* get rid of the warning about the same keys

* get rid the warning about not found method

* warning about the same keys

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 11:33:33 +02:00
Marta Bondyra
cfe084829f
[Visualize] [Lens] remove warning and logs from console when testing (#113070)
* date_ranges console.warn removed

* lens app console info remved

* percentailize i18n & generate id removed

* vega_parser.test canvas mock warning removed

* vega console logs removed from tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 11:32:47 +02:00
Stratoula Kalafateli
2fd7f85877
[TSVB] Resolves the flakiness on url drilldowns functional tests (#112809)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 12:32:24 +03:00
Stratoula Kalafateli
dece5fd01d
Remove all kibana.yml deprecations from visEditors plugins (#112643)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 12:26:01 +03:00
Marco Liberati
b303d0fecd
[Lens] [Documentation] More Lens advanced questions answered (#111601)
Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-27 10:13:12 +02:00
Mat Schaffer
970394b8a9
[Stack Monitoring] Beats Overview view migration (#112377)
* Wire up a stub beats overview page

* Filling in some bits

* Figured out this todo already

* Fix importa and product name

* Wire up BeatsOverview component

* Set breadcrumbs

* Add "beats" part to breadcrumbs

* Remove unused vars copied from ES overview

* Use passed data rather than outer scope

* Fixing basic type checks

* Fix breadcrumb type issues

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-26 23:40:59 -04:00
Jonathan Budzenski
d27c72302d skip flaky suite. #104578 2021-09-26 16:29:06 -05:00
Jonathan Budzenski
0a30434086 skip flaky suite. #100296 2021-09-26 16:06:40 -05:00
Jonathan Budzenski
affeb996fd skip flaky suite. #113067 2021-09-26 10:39:31 -05:00
Jonathan Budzenski
bffe5cfc47
[ci] sync storybook builds between jenkins and buildkite (#113071) 2021-09-24 13:35:13 -04:00
Khristinin Nikita
46d68705e6
Set default value for Indicator index query (#112300)
* Change deafult value for indicator query

* Move threat math query to constants

* Use existing constantant for Cypress test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-24 06:58:48 -04:00
Yuliia Naumenko
03cd9e8886
[Actions][Connectors] Modify email connector UI flyout to support OAuth 2.0 Client Credentials flow for MS Exchange provider (#112375)
* [Actions][Connectors] Modify email connector UI flyout to support OAuth 2.0 Client Credentials flow for MS Exchange provider

* fixed test

* added unit test

* added validation unit test

* fixed fn test

* fixed prettier

* -

* Update email_connector.test.tsx

* Update use_email_config.test.ts

* fixed due to comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-23 19:39:26 -07:00
Tim Sullivan
03007d0150
[Reporting] Add output size stats to telemetry metrics (#112037)
* [Reporting] Add output size stats to telemetry metrics

* fix types

* add output_size for each jobtype

* add size metrics for each job type

* use more mock data in unit tests

* clean up test

* update test snapshots

* update telemetry mapping

* SizeMetrics => SizePercentiles

* DocCount interface

* fix tests

* Update get_export_stats.ts

* update snapshots
2021-09-23 16:14:35 -07:00
Jonathan Budzenski
09e7093b7d skip flaky suite. #112812 2021-09-23 17:10:26 -05:00
Marius Dragomir
aa98fab25e
[Stack Functional Integration] Add minimal hearbeat tests (#112986)
* add hearbeat tests and convert to TS

* fix ts errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-23 22:02:41 +02:00
Nicolas Chaulet
94368aae59
[Fleet] Rename misleading functions setupIngestManager and createPolicyChangeAction (#113016) 2021-09-23 15:42:18 -04:00
Jonathan Budzenski
f5ccf18da1 skip flaky suite. #70928 2021-09-23 14:36:12 -05:00