Commit graph

30368 commits

Author SHA1 Message Date
Liza Katz 55b7905fb5
Es client cleanup (#54337)
* Add esClient instance to data.__LEGACY and replace old usages

* add es clinet to setup karma mock

* delete unneeded import

* fix get inner angular

* Fix karma test

* Fix vega browser test

* Update esClient usage

* ts fixes

* ts + karma tests

* update tests

* Fix karma test

* eslint

* Register default strategy from plugin

* export

* Revert map change

* Delete legacy saved objects client provider

* Fix management digest cycle

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-26 13:55:48 +02:00
Ryland Herrick 9c1c94121a
[Fix] Siem Telemetry Improvements (#55598)
* Fix typo in ML Job toggle state

We were passing the wrong argument in to this predicate function,
meaning that the job not correctly shown as loading if it's data feed
was loading.

* Refresh ML Popover after job has been toggled

Previously, toggling a job would put the component into a permanent
loading state. Now we wait for the callback to resolve before updating
the component's loading state, and once the job itself is updated the
reset will rerender as necessary.

* Rename folder for consistency

* Export our function as its common alias

Until we need to distinguish between different types of tracking, the
extra qualifiers on the name aren't really necessary.

* Add telemetry middleware for redux

Rather than adding lots of tracking calls throughout the app, this
allows us to track specific events as redux sees them, regardless of
their source.

* Track a timeline being saved

Whether this happens due to a new timeline or an update, this metric
signifies a timeline having been persisted to the user's index.

* Move 'timeline opened' tracking into middleware

* Only track timeline opening when we truly open it

This action fires for both opening and closing, which is not quite the
logic we need. This refactors the middleware to leverage
typescript-fsa to type these actions' payloads, allowing us to inspect
them. Hopefully we won't have to do this often.

* Track when a timeline name is modified

In the future we can fire the title as it's part of the payload, but for
now we can only say "someone changed the name of their timeline."

* Initialize telemetry in an NP-friendly way

With the previous solution, we were invoking createUiStatsReporter,
which pulls modules from ui/new_platform, in the module scope. Since
only a few components used this module, it was mostly fine.

However, with our new telemetry middleware the redux setup itself also
referenced this file, and thus indirectly ui/new_platform. This lead to
hundreds of tests breaking, as any test that loaded a module from the
store folder (actions, etc.) without also mocking ui/new_platform would
blow up when those modules were undefined.

Instead of adding hundreds of `jest.mock` calls and deferring the issue,
this creates a singleton module that is initialized during our plugin's
setup and can then be freely imported by any module thereafter.

Also throws an error in case this singleton gets misused; we should only
be initializing telemetry once, during plugin setup.

* Track when rules are enabled or disabled

* Update type of incoming function prop

This is always given an async method, currently, and we should type it
as such because we're now leveraging that fact with an await.

* Guard against errors from our telemetry calls

This ensures that we always have a tracking function so as to prevent
errors at the call sites. Also guards against errors during either setup
or from the underlying telemetry call.
2020-01-25 20:37:58 -06:00
Walter Rafelsberger 88ba41f39a
[ML] Anomaly Explorer: Fix cell selection when view-by is job id. (#55841)
Fixes loading influencers, charts and anomaly table if view-by selection is job ID and cells in the overall swimlanes are selected.

Previously, the check to return the job ids to filter on for the query would return the wrong value for a selection in the overall swimlane. This PR move the wrong and redundant code to a fixed util function getSelectionJobIds().
2020-01-25 12:07:03 +01:00
Frank Hassanabad a63e8a4304
[SIEM][Detection Engine] Critical blocker rule changes and ECS changes
## Summary

* Changes ECS `techniques` to the word `technique` as `techniques` is incorrect ECS and incorrect mapping and without this our product could crash
* Changes ECS `threats` to the word `threat` as `threats` is incorrect ECS and incorrect mapping and without this our product could crash
* Added histogram mapping for `signal.rule.threat.tactic.name` as that was missing
* Added `Elastic` and removed `EIA` for tags
* Updates unit tests
* Cleans up rules by removing extra characters and removing fields not required.
* Adds concrete index'es as this was a critical breaking bug
* Fixes issues with imports where imports could change an immutable from false to true and suddenly cause out of band immutables to occur.

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2020-01-24 22:18:52 -07:00
Xavier Mouligneau f4b4695c7b
[SIEM] [BUG] Detections inspect + refresh histogram (#55912)
* Fix flow of all rules

* fix the multitude http request + fix table timeline re-rendering

* add inspect on detections histogram + refresh detections histogram

* formatting inspect request&response

* Update x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals_histogram_panel/signals_histogram/index.tsx

Co-Authored-By: Garrett Spong <spong@users.noreply.github.com>

* fix type

Co-authored-by: Garrett Spong <spong@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 20:54:15 -05:00
Frank Hassanabad cb7c003c34
[SIEM][Detection Engine] Rules content additions
## Summary

Rule updates from @randomuserid and team


### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2020-01-24 18:17:22 -07:00
Xavier Mouligneau 88ee484f18
[SIEM] [BUG] Detections fix additional look back (#55928)
* fix time

* fix unnecessary export

* fix humanize
2020-01-24 19:19:58 -05:00
Josh Dover 703a3c22da Add @kbn/i18n to @kbn/ui-shared-deps (#55891)
* Add @kbn/i18n to @kbn/ui-shared-deps

* Use string DI syntax for i18n angular modules
2020-01-25 00:24:32 +02:00
Josh Dover 1bb59af44a
Add isSystemRequest support to Kibana Platform (#53734) 2020-01-24 15:20:09 -07:00
igoristic 2e6fbc396a
Doing fix on master (#55894) 2020-01-24 17:16:43 -05:00
Devin W. Hurley a6d1856222
[SIEM] [Detection Engine] Change Status to Last response (#55886)
* do not change rule status if rule is enabled/disabled

* keep the 'going to run' status when enabling rule
2020-01-24 17:03:28 -05:00
Chris Cowan 0e09e5f455
[Metrics UI] Fix Metrics Explorer exception when deleting metric (#55893) 2020-01-24 15:44:04 -06:00
Xavier Mouligneau 459b8c4df8
[SIEM] Detections bugs rules (#55885)
* Fix flow of all rules

* fix the multitude http request + fix table timeline re-rendering

* Update x-pack/legacy/plugins/siem/public/components/events_viewer/events_viewer.tsx

Co-Authored-By: Garrett Spong <spong@users.noreply.github.com>

Co-authored-by: Garrett Spong <spong@users.noreply.github.com>
2020-01-24 16:42:53 -05:00
Frank Hassanabad 5801de0800
[SIEM][Detection Engine] critical blocker, fixs broken rules versioning
## Summary

* Fixes broken rules versioning
* Fixes unit tests

Implementation is more safe in that it ensures that if you have a factory/immutable rule it will do an early bail out unless the immutable rule is asking for a version change from the file system.

If it's not an immutable it will still _not_ bump the version number if it is a change to the enabled/disabled only.

Testing:
---

* Test that if you enable either a factory or non-factory rule it does not bump the version number. 
* Test that if you go to an immutable rule on the file system and bump the version number on the file system and reinitialize it either through the UI or backend scripts then it will bump the version number.
* Test that if you update a non-factory rule then it does auto-increment the version number.

Things to look out for
---
Did I forget to whitelist anything in the code that would cause it to _not_ bump the version number for some reason?

## Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

- [x] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2020-01-24 13:54:07 -07:00
Mike Côté 4db0382259
Update CONTRIBUTING.md --ssl documentation to mention it covers Elasticsearch as well (#55876)
* Update CONTRIBUTING.md to mention --ssl flag works with Elasticsearch as well

* Change while to for
2020-01-24 15:35:04 -05:00
Wylie Conlon 25765a9d36 [Canvas] Improve expression autocomplete (#52035)
* [Canvas] Autocomplete improvements

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Poff Poffenberger <poffdeluxe@gmail.com>
2020-01-24 13:04:34 -06:00
Jamie Smith 7165b26b51
fix URL for handlebar docs for markdown, and make sure they are https (#55866) 2020-01-24 13:58:31 -05:00
Ryland Herrick 157ed3945b
[Fix] Hide timeline and ML Popover when SIEM has no data (#55754)
* Hide ML Popover when SIEM index DNE

* Hide timeline when SIEM has no data

In cases where there's nothing to inspect (i.e. the user hasn't
populated data), we don't want to show them the mostly inert timeline.

* Update snapshot for header

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 12:37:44 -06:00
Dima Arnautov 510587e431
[ML] Fix Anomaly Explorer swimlane tooltip issue (#55827)
* [ML] check drag start element

* [ML] remove conditional chaining from js
2020-01-24 18:51:25 +01:00
Mike Côté ea3aa9c9b1
Fix skipped alerting UI tests (#55058)
* Fix skipped alerting UI tests

* Fix switch click to use new pageobject function

* Use .click function directly instead of find then click

* Merge state variables into one for alerts and alert types

* Fix flaky tests by fixing react code

* Could this be it?? The one thing missing that caused all this flakiness??

* Cleanup convertAlertsToTableItems function

* Remove I from interface names, fix disabled boolean logic

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 12:50:22 -05:00
Andrew Cholakian 06aeb8196f
[Uptime] Expand timespan range to fix missing data in UI (#55250)
* [Uptime] Expand timespan range to fix missing data in UI

With a short timespan range of 10s as originally here we can miss data
in the case of long refresh intervals in ES or other delays in data
coming from heartbeat to ES. If data is more than 10s stale we show
empty screens. Expanding this to 5m provides most of the performance
benefits and also quite a bit of safety in terms of delays. It lets
users query very large timespans (say a year), and still only really
query 5m of data, keeping the general purpose of this perf enhancement
going.

* Remove unnecessary complexity

* Revert "Remove unnecessary complexity"

This reverts commit 97c74804f4.

* Check for data rather than field

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 10:07:49 -07:00
Gidi Meir Morris bb29cec20b
fixes shared types across alerting plugins (#55824)
This addresses two issues that have come up:

Alerting and Actions have TypeScript types that are needed across server and public plugins, and need to be extracted to a common path (thanks @chrisronline for bringing this to our attention)
Due to the above, types have been duplicated between the alerting and actions when needed in the Alerting UI, which has led to them diverging. This forces the UI to type check against the API, which will help reduce these errors in the future.
2020-01-24 17:06:59 +00:00
Chris Mark 943e450ead
Add dashboard in Stan kibana tutorial (#55837) 2020-01-24 18:16:31 +02:00
Thomas Neirynck 837c9092e3
[Maps] Should be able to open layer settings from add layer wizard 2020-01-24 10:59:08 -05:00
Thomas Neirynck 5c19f9db4e
[Maps] Do not mutate state in resetDataRequest (#55624) 2020-01-24 10:58:14 -05:00
Jean-Louis Leysens f7c53b5690
Disallow importing Joi client side (#55018)
* Disallow importing Joi client side

* Move elasticsearch lib into server folder

* Add a comment about the 'joi' eslint rule

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 15:38:44 +01:00
Jean-Louis Leysens b8f774866c
[SearchProfiler] Fix handling of bad profile data and update tab behaviour (#55806)
* Fix searchprofiler's ability to handle badly formed profile data
Also fix tab changing upon subsequent requests

* Fix comment typo
2020-01-24 15:37:03 +01:00
Nick Partridge 2eb6a2f3bc
Move response handlers into plugins (#55489)
* Duplicate and move response handlers into resp directories
* Fix agg_table mocha test failures
2020-01-24 08:24:19 -06:00
Dario Gieselaar b39076e2bd
[APM] Treat error.exception.stacktrace.line as optional (#55733) 2020-01-24 14:31:51 +01:00
Shahzad 6beb2b2c06
fix refresh pause (#55499)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 13:47:14 +01:00
Andrew Goldstein b9cd82d9d1
[SIEM] Security news feed (production) URL (#55811)
## [SIEM] Security news feed (production) URL

* Replaces the placeholder SIEM `News feed URL` setting `siem:newsFeedUrl`, with the production URL: `https://feeds.elastic.co/security-solution`

### Security news in the SIEM Overview Page (default theme)

![security-news-default](https://user-images.githubusercontent.com/4459398/73054746-64ec5a00-3e48-11ea-9dad-033a70ef00df.png)

### Security news in the SIEM Overview Page (dark theme)

![security-news-dark](https://user-images.githubusercontent.com/4459398/73054754-6c136800-3e48-11ea-8ab3-cf64e8ad9dbc.png)

### New default advanced setting

![siem-advanced-settings](https://user-images.githubusercontent.com/4459398/73054814-982ee900-3e48-11ea-8d12-4291b79dfe5d.png)

* We now handle a special case where in some environments, the version reported by Kibana includes `-SNAPSHOT` in the version, e.g. `8.0.0-SNAPSHOT`, which was resulting in an invalid feed URL (cc @tsg)

* Improves code coverage

* Desk-tested additional news feed translations

![translations](https://user-images.githubusercontent.com/4459398/73058250-7b96af00-3e50-11ea-9b7b-8cf1a9264f8c.png)
2020-01-24 05:32:25 -07:00
James Gowdy 47bfd11dd1
[ML] Adding text fields to datafeed start modal (#55560)
* [ML] Adding text fields to datafeed start modal

* updating strings

* fixing issue with date text being out of sync

* moving tab check to useEffect
2020-01-24 12:15:52 +00:00
Jean-Louis Leysens 6984cf1711
Move SplitPanel to kibana_react (#55529)
* split_panel component -> kibana_react

* Update useEffect for console warning

* `console` -> `kibana-react` i18n namespace

* Update when warning about children is emitted in split panel component

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 13:10:59 +01:00
Jean-Louis Leysens 43a7aa7fc0
[Console] Remove z-index from editor panes and move it to the resizer (#55813)
* Remove z-index from editor panes and move it to the resizer

* Update comment
2020-01-24 12:26:25 +01:00
Walter Rafelsberger fee22e8d94
[ML] Anomaly Explorer: Fix view by selection when filter is active. (#55717)
Fixes the view-by selection when a KQL filter gets active and restores previous behavior:
- If the filter includes AND view-by switches to Job ID.
- Otherwise the view-by selection switches to the first available option present in the KQL filter
- Additionally, the view-by dropdown options get filtered down to the options present in the KQL filter
2020-01-24 11:25:55 +01:00
Walter Rafelsberger ef4b395873
[ML] Singel Metric Viewer: Fix full refresh check. (#55726)
Fixes the check whether to do a full refresh of the page or not. lastRefresh was mistakenly part of the check. This fixes keeping the flyout open for rules editing.
2020-01-24 11:22:31 +01:00
Alejandro Fernández d40269c748
Fix the scale of the search markers (#55731)
The search markers where placed on the minimap using a different scale
than the density chart and time ruler. That made the log stream jump to
unexpected time positions when the user clicked on a search marker.

This also fixes an problem where the search markers didn't move
alongside the rest of the minimap when the user dragged and dropped it.
2020-01-24 11:16:11 +01:00
Sébastien Loix d3151327de
Fix text highlight in search result (#55695) 2020-01-24 14:52:46 +05:30
Shahzad d25d1bd84e
[Uptime] Clean Url to remove undefined/empty query params (#55386)
* fix usage of useParams

* update code

* update defaults

* update snaps
2020-01-24 09:13:17 +01:00
Maryia Lapata 14a559bfc4
[Discover] DocViews uses local angular (#55389)
* DocViews uses local angular

* Clean up

* Create embeddableInjector only when it's used

* Revert occasional changes

* Update unit test

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-24 10:45:46 +03:00
Mikhail Shustov 2f1628784a
[NP] add platform main principles (#53866)
* add platform main principles

* update docs

* unify styles

* remove guidelines. principles should cover this

* Apply suggestions from code review

Co-Authored-By: Josh Dover <me@joshdover.com>

* Apply suggestions from code review

Co-Authored-By: Rudolf Meijering <skaapgif@gmail.com>

* address comments

Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
2020-01-24 07:54:06 +01:00
spalger e67cc8514a Revert "[csp] allow blob styles when running from source (#54991)"
This reverts commit 375f0b42a7.
2020-01-23 23:32:10 -07:00
Matthias Wilhelm ac0953e08b
[Discover] Change default sort handling for index patterns without timefield (#54427)
Default sort is no longer in state. There's now a separate function to provide default sort for ES and UI, in case the user didn't actively select a field to sort by
2020-01-24 06:23:53 +01:00
patrykkopycinski 1e91775a7f
[SIEM] Overview Page - Expand Winlogbeat Stats (#55696) 2020-01-24 00:11:13 +01:00
Peter Schretlen e39ef65c4c
Add developer docs for built-in pagerduty and webhook actions. Add TOC. (#55352) 2020-01-23 17:00:14 -05:00
Brian Seeders 6fcf3f0005
Skip flaky custom appRoute tests 2020-01-23 16:58:13 -05:00
Thomas Neirynck 5a15ad123d
[Maps] use style-prop methods to determine state (#55607) 2020-01-23 15:56:11 -05:00
Anton Dosov 5daed94c30
[Filters] Incorrect result, when calling setFilters() with multiple duplicates between app and global filters (#55591) 2020-01-23 21:45:11 +01:00
Tim Sullivan e102ae673c
[Reporting/New Platform] Use the logger service from core (#55442)
* More Typescript Fixes

* [Reporting/New Platform] Use the logger service from core

* Add log tag

* fix jest tests

* ts fixes

* fix mocha test

* convert to jest
2020-01-23 13:40:05 -07:00
Wylie Conlon cda6b13f23
[Lens] Fix regression in field list for beats (thousands of fields) (#55625)
* [Lens] Fix regression in field list for beats

* Add api test
2020-01-23 14:52:43 -05:00