Commit graph

166 commits

Author SHA1 Message Date
Dmitry Shevchenko c6aa4f625c
Fix exceptions page table pagination (#111000) 2021-09-03 21:38:45 +02:00
Spencer fecdba7eba
[eslint] add rule to prevent export* in plugin index files (#109357)
* [eslint] add rule to prevent export* in plugin index files

* deduplicate export names for types/instances with the same name

* attempt to auto-fix duplicate exports too

* capture exported enums too

* enforce no_export_all for core too

* disable rule by default, allow opting-in for help fixing

* update tests

* reduce yarn.lock duplication

* add rule but no fixes

* disable all existing violations

* update api docs with new line numbers

* revert unnecessary changes to yarn.lock which only had drawbacks

* remove unnecessary eslint-disable

* rework codegen to split type exports and use babel to generate valid code

* check for "export types" deeply

* improve test by using fixtures

* add comments to some helper functions

* disable fix for namespace exports including types

* label all eslint-disable comments with related team-specific issue

* ensure that child exports of `export type` are always tracked as types

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-01 18:05:45 -07:00
Stacey Gammon 9258ba5147
Adding owners to kibana plugins (#108407)
* Adding owners to kibana plugins

* Fix ui actions enhanced owner

* Account for virtual RAC team owning a plugin

* Fix empty githubTeam for ui actions
2021-08-17 10:21:06 -04:00
renovate[bot] 41162c3940
Update dependency @elastic/elasticsearch to ^8.0.0-canary.17 (#107536)
* Update dependency @elastic/elasticsearch to ^8.0.0-canary.15

* update tests for new error message building mechanism

* fix integration tests

* fix functional test

* mute new type errors

* fix new type errors

* bump es client to canaary.16

* fix integration test

* fix type errors in infra plugin

* mute type error in ml plugin

* fix type errors in monitoring plugin

* fix and mute errors in security solution plugin

* bump version to canary.18

* remove an unnecessary change

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: restrry <restrry@gmail.com>
2021-08-17 08:44:24 -04:00
Liza Katz e91baea5dc
[Data][Es Query] Use ES types instead of DslQuery (#108290)
* es-query types

* jest and lint

* cc

* options

* type

* type
2021-08-12 21:23:33 +02:00
David Sánchez de9d784035
Adds new operatorsList prop in exceptions builder to allow pass a list of operators. Add this prop in event filters form (#108015)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-12 12:59:33 +02:00
Spencer c0395c9ef6
[build_ts_refs] improve caches, allow building a subset of projects (#107981)
* [build_ts_refs] improve caches, allow building a subset of projects

* cleanup project def script and update refs in type check script

* rename browser_bazel config to avoid kebab-case

* remove execInProjects() helper

* list references for tsconfig.types.json for api-extractor workload

* disable composite features of tsconfig.types.json for api-extractor

* set declaration: true to avoid weird debug error

* fix jest tests

Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-08-10 22:12:45 -07:00
Ryland Herrick 8665f36cf3
[Security Solution, Lists] Replace legacy imports from 'elasticsearch' package (#107226)
* Remove legacy imports from 'elasticsearch' package

This prefers the newer types from '@elastic/elasticsearch'.

There was one instance where mock data was insufficient to satisfy the
newer analogous types; in all other cases this was just a find/replace.

* Fix type errors with a null guard

We know that this mock has hits with _source values, but we cannot
convey this to typescript as null assertions are disabled within this
project. This seems like the next best solution, preferable to a
@ts-expect-error.

* Fix a few more type errors

* Replace legacy type imports in integration tests

* refactors destructuring due to _source being properly declared as
  conditional

* Update more integration tests to account for our optional _source

Changes here fall into one of two categories:

* If the test was making an assertion on a value from _source, we simply
null chain and continue to assert on a possibly undefined value.

* If the test logic depends on _source being present, we first assert that
presence, and exit the test early if absent.

* Fix more type errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-08-05 15:36:44 -04:00
Thomas Watson c58148981c
Remove duplicate license comments (#106848) 2021-07-28 08:42:21 -06:00
Frank Hassanabad 5dd68dd7b3
[Security Solutions] Removes deprecated types in kbn-securitysolution-* for newer kbn-es-query types (#106801)
## Summary

Fixes https://github.com/elastic/kibana/issues/105731, by replacing these `any` types:

```json
type IFieldType = any;
type IIndexPattern = any;
type Filter = any;
```

With the types from `es-query` which are:
* IndexPatternFieldBase
* IndexPatternBase
* Filter

Note: I had to do a few creative casting to avoid having to use `FieldSpec` since that is not within the package `es-query` and is not planned to be within that package or another package for at least a while if ever.

### 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-07-27 09:12:02 -06:00
Frank Hassanabad 0a5c96b117
[Security Solutions] Fixes exception lists to be able to filter on os type (#106494)
## Summary

Fixes https://github.com/elastic/kibana/issues/102613, and targets `7.14.0` as a blocker/critical

Previously we never fully finished the plumbing for using the `os_types` (operating system type) in the exception lists to be able to filter out values based on this type. With the endpoint exceptions now having specific selections for os_type we have to filter it with exceptions and basically make it work.

Some caveats is that the endpoints utilize `host.os.name.casless` for filtering against os_type, while agents such as auditbeat, winlogbeat, etc... use `host.os.type`. Really `host.os.type` is the correct ECS field to use, but to retain compatibility with the current version of endpoint agents I support both in one query to where if either of these two matches, then that will trigger the exceptions.

* Adds e2e tests
* Enhances the e2e tooling to do endpoint exception testing with `os_types`.
* Adds the logic to handle os_type
* Updates the unit tests

### 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-07-22 12:54:40 -06:00
Frank Hassanabad cd667d06bc
[Security Solutions][Detection Engine] Creates an autocomplete package and moves duplicate code between lists and security_solution there (#105382)
## Summary

Creates an autocomplete package from `lists` and removes duplicate code between `lists` and `security_solutions`
* Consolidates different PR's where we were changing different parts of autocomplete in different ways.
* Existing Cypress tests should cover any mistakes hopefully

Manual Testing:
* Ensure this bug does not crop up again https://github.com/elastic/kibana/pull/87004
* Make sure that the exception list autocomplete looks alright

### 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-07-22 12:44:54 -06:00
Liza Katz a6af9d5050
[Es query] Move to package (#103530)
May the forces of bootstrapping helps us 🙏🏻 😉
2021-07-21 17:10:55 +02:00
Frank Hassanabad dd8a4a72e2
[Security Solutions] Removes the elastic legacy client from lists and security_solution plugins (#106130)
## Summary

Addressees https://github.com/elastic/kibana/issues/83910 by removing the elastic legacy client from:
* `lists` plugin
* `security_solution` plugin
* `kbn-securitysolution-es-utils` package

Removes found dead code in `security_solution` plugin:
* `server/lib/configuration/inmemory_configuration_adapter.ts`
* `server/lib/detection_engine/privileges/read_privileges.ts`
* `server/lib/configuration/index.ts`
* `server/lib/configuration/adapter_types.ts`
* `server/lib/compose/kibana.ts`
* `server/lib/ecs_fields/extend_map.test.ts`
* `server/lib/ecs_fields/extend_map.ts`
* `server/lib/index_fields/elasticsearch_adapter.ts`
* `server/lib/index_fields/index.ts`
* `server/lib/index_fields/mock.ts`
* `server/lib/index_fields/types.ts`
* `server/lib/source_status/elasticsearch_adapter.ts`
* `server/lib/source_status/index.ts`
* `server/lib/source_status/query.dsl.ts`
* `server/lib/source_status/types.ts`
* `server/lib/sources/configuration.test.ts`
* `server/lib/sources/configuration.ts`
* `server/lib/sources/index.ts`
* `server/lib/sources/types.ts`

Removes dead code in `lists` plugin:
* `server/schemas/common/get_call_cluster.mock.ts`
* `server/lib/ecs_fields/index.ts`
* `server/lib/framework/kibana_framework_adapter.ts`

Removes dead types from `security_solution` plugin:
* `server/lib/framework/types.ts`
* `server/lib/types.ts`

Removes dead functions from `security_solution` plugin:
* `server/utils/build_query/calculate_timeseries_interval.ts`
* `server/utils/runtime_types.ts`

### What to check as a reviewer
* Ensure that there is no left over words of `legacy` such as `legacy.something`
* Ensure there are no more `callAsCurrentUser` since that is all dead and gone
* Ensure anywhere you see `esClient.someThing` it returns the `.body` at the end or destructors it as in `{ body } = esClient.someThing`


### Risk Matrix

| Risk                      | Probability | Severity | Mitigation/Notes        |
|---------------------------|-------------|----------|-------------------------|
| Telemetry might stop working or have invalid values. | Med | High | We will have to manually test telemetry. Pinged people from telemetry for a code review |
| An REST route returns invalid values. | Med | High | e2e tests caught some of these already. The rest of the code was re-checked by hand |
| Deleted function/code might actually be still in use somewhere. | Low | High | e2e and unit tests should catch any of this. |



### 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-07-20 20:15:40 -04:00
Frank Hassanabad bdf1069e56
[Security Solutions][Detection Engine] Removes dead duplicated code and marks other duplicated code (#105374)
## Summary

* Removes dead duplicated code from `security_solution` and  `lists`
* Adds notes and TODO's where we still have duplicated logic
* Adds notes where I saw that the original deviated from the copy from modifications in one file but not the other.
* DOES NOT fix the bugs existing in one copy but not the other. That should be done when the copied chunks are collapsed into a package. Instead see this issue where I marked those areas: https://github.com/elastic/kibana/issues/105378

See these two files where things have deviated from our duplications as an example:
[security_solution/public/common/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field.tsx
)
[lists/public/exceptions/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/lists/public/exceptions/components/autocomplete/field.tsx)

Ref PR where fixes are applied to one of the files but not the other (could be other PR's in addition to this one):
https://github.com/elastic/kibana/pull/87004

### 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-07-13 16:23:58 -06:00
Davis Plumlee c6916eacc2
[Security Solution][Exceptions] Gets rid of rule exception comma delimiter for "is one of" operator (#104960) 2021-07-08 20:12:04 -04:00
Devin W. Hurley c77c7fbedb
[RAC] [RBAC] MVP RBAC for alerts as data (#100705)
An MVP of the RBAC work required for the "alerts as data" effort. An example of the existing implementation for alerts would be that of the security solution. The security solution stores its alerts generated from rules in a single data index - .siem-signals. In order to gain or restrict access to alerts, users do so by following the Elasticsearch privilege architecture. A user would need to go into the Kibana role access UI and give explicit read/write/manage permissions for the index itself.

Kibana as a whole is moving away from this model and instead having all user interactions run through the Kibana privilege model. When solutions use saved objects, this authentication layer is abstracted away for them. Because we have chosen to use data indices for alerts, we cannot rely on this abstracted out layer that saved objects provide - we need to provide our own RBAC! Instead of giving users explicit permission to an alerts index, users are instead given access to features. They don't need to know anything about indices, that work we do under the covers now.

Co-authored-by: Yara Tercero <yctercero@users.noreply.github.com>
Co-authored-by: Yara Tercero <yara.tercero@elastic.co>
2021-07-08 15:24:17 -04:00
David Sánchez eb9726987c
[Security Solution][Endpoint] Hide endpoint event filters list in detections tab (#102644)
* Add event filters filter on exception list to hide it in UI

* Fixes unit test and added more tests for showEventFilters

* fixes test adding showEventFilters test cases

* Pass params as js object instead of individual variables

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-23 16:04:23 +02:00
David Sánchez 537fcf4ff2
[Security Solution][Endpoint] Don't create event filters list from manifest manager (#102618)
* Check if endpoint event filters list exists before create and create it without specific id

* Removes creation of endpoint event filters list in manifest manager

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-22 18:49:34 +02:00
Davis Plumlee c52f5edfcc
[Security Solution][Exceptions] Fixes empty exceptions filter bug (#102583) 2021-06-21 18:34:11 -04:00
David Sánchez a8020ddb89
Fixes wrong list exception type when creating endpoint event filters list (#102522) 2021-06-18 09:33:25 +02:00
Ryland Herrick ac07ebba87
[Security Solution] kbn package for generic hook utils (#101976)
* Adds boilerplate for new hook-utils package

* Move existing, identified utils into our hook-utils package

Updates references, and fixes a few missing config that were preventing
packages from building.

* Extracts a common type and adds a little more JSdoc for clarity

* Adds new useObservable hook

Similar to useAsync (a nearly identical interface), this is meant to
wrap a thunk returning an observable, allowing conditional invocation
and progressive updates as the observable continues to emit.

* Remove orphaned test

This function (and its tests) were moved to the hook-utils package; this
was simply missed.

* Remove optional chaining from kbn package

The build system does not currently support these typescript features.
While a valid fix would also have been to build separate browser and
node targets a la #99390, the use here was very minimal and so changing
to a supported syntax was the most pragmatic fix.

* Update old reference in test file

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-17 12:09:17 -05:00
Mikhail Shustov d920682e4e
Update @elastic/elasticsearch to 8.0.0-canary13 (#98266)
* bump @elastic/elasticsearch to canary.7

* address errors in core

* address errors in data plugin

* address errors in Alerting team plugins

* remove outdated messages in Lens

* remove unnecessary comments in ML

* address errors in Observability plugin

* address errors in reporting plugin

* address errors in Rule registry plugin

* fix errors in Security plugins

* fix errors in ES-UI plugin

* remove unnecessary union.

* update core tests

* fix kbn-es-archiver

* update to canary 8

* bump to v9

* use new typings

* fix new errors in core

* fix errors in core typeings

* fix type errors in data plugin

* fix type errors in telemetray plugin

* fix data plugin tests

* fix search examples type error

* fix errors in discover plugin

* fix errors in index_pattern_management

* fix type errors in vis_type_*

* fix errors in typings/elasticsearch

* fix type errors in actions plugin

* fix type errors in alerting and apm plugins

* fix type errors in canvas and cases

* fix errors in event_log

* fix type errors in ILM and ingest_pipelines

* fix errors in lens plugin

* fix errors in lists plugin

* fix errors in logstash

* fix errors in metrics_entities

* fix errors in o11y

* fix errors in watcher

* fix errors in uptime

* fix errors in upgrade_assistant

* fix errors in task_manager

* fix errors in stack_alerts

* fix errors in security_solution

* fix errors in rule_registry

* fix errors in snapshot_restore

* fix remaining errors

* fix search intergration tests

* adjust assetion

* bump version to canary.10

* adapt code to new naming schema

* use mapping types provided by the client library

* Revert "adjust assetion"

This reverts commit 19b8fe0464.

* fix so intergration tests

* fix http integration tests

* bump version to canary 11

* fix login test

* fix http integration test

* fix apm test

* update docs

* fixing some ml types

* fix new errors in data plugin

* fix new errors in alerting plugin

* fix new errors in lists plugin

* fix new errors in reporting

* fix or mute errors in rule_registry plugin

* more ML type fixes

* bump to canary 12

* fix errors after merge conflict

* additional ML fixes

* bump to canary 13

* fix errors in apm plugin

* fix errors in fleet plugin

* fix errors in infra plugin

* fix errors in monitoring plugin

* fix errors in osquery plugin

* fix errors in security solution plugins

* fix errors in transform plugin

* Update type imports for ES

* fix errors in x-pack plugins

* fix errors in tests

* update docs

* fix errors in x-pack/test

* update error description

* fix errors after master merge

* update comment in infra plugin

* fix new errors on xpack tests/

Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
2021-06-08 15:06:06 +02:00
David Sánchez cec62cb706
[Security Solution][Endpoint] Add event filters summary card to the fleet endpoint tab (#100668)
* Shows event filters card on fleet page

* Uses aggs instead of while loop to retrieve summary data

* Add request and response types in the lists package

* Fixes old import

* Removes old i18n keys

* Removes more old i18n keys

* Use consts for exception lists url and endpoint event filter list id

* Uses event filters service to retrieve summary data

* Fixes addressed pr comments such as changing the route without underscore, adding aggs type, validating response, and more

* Uses useMemo instead of useState to memoize object

* Add new e2e test for summart endpoint

* Handle api errors on event filters and trusted apps summary api calls

* Add api error message to the toast

* Fix wrong i18n key

* Change span tag by react fragment

* Uses styled components instead of modify compontent style directly and small improvements on test -> ts

* Adds curls script for summary route

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-05-28 18:07:54 +02:00
David Sánchez ca324c63be
Removes event filters feature flag and exposes this feature by default (#100389)
* Removes event filters feature flag and expose this feature by default

* Fixes manifest unit test

* Fixes functional test adding event filter list case

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-05-25 15:19:42 +02:00
Frank Hassanabad aa2f5b535d
[Security Solution] Utilizes constants package and deletes duplicate code (#100513)
## Summary

Utilizes constants package and deletes duplicate code

* Renames the `securitysolution-constants` to be `securitysolution-list-constants` to be specific
* Deletes duplicated code found during cleanup
* Moves more tests into the packages found along the way with the duplicated code
* Moves `parseScheduleDates` from `@kbn/securitysolution-io-ts-types` to `@kbn/securitysolution-io-ts-utils`

### 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-05-24 18:38:14 -06:00
Mikhail Shustov 95e8eed7d1
security solution and lists to TS incremental builds (#100447)
* lists to ts incremental builds

* security_solution to ts incremental

* import ResizeObserver explicitly as it is not declared in dom types
2021-05-24 16:34:29 +02:00
Frank Hassanabad 192c8ba743
Adds two more packages and moves files into the packages (#100375)
## Summary

* Adds package `kbn-securitysolution-list-api`
* Adds package `kbn-securitysolution-list-hooks`
* Moves files into the packages
* Moves a few additional types into the other packages such as the `kbn-securitysolution-io-ts-types` package to remove more things from the shard_export/shared_import between lists and security solution
* Removes more duplicated code

### 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-05-20 12:36:07 -06:00
Frank Hassanabad 9bf488e826
[Security Solutions] Re-arranges and adds more packages to remove copied code (#100310)
## Summary

* Creates a `securitysolution-list-utils` packaged and moves the first set of utilities into there
* Fixes a slight bug with `kbn-securitysolution-io-ts-list-types` where the wrong name was used
* Moves _all_ of the lists schemas and types into the package `kbn-securitysolution-io-ts-list-types`
* Removes copied code found in a few places

## Tech debt
* Some spots I have to use an `any` in the package as Kibana kbn packages don't have the types I need
* Some spots I copy constants until we can straighten out those pieces.
* I keep copied mock files until we figure out how to share mocks from these packages without adding weight or we create dedicated mock packages for all of this. 


### 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-05-19 15:59:52 -06:00
Frank Hassanabad e15b887e43
[Security Solutions] Replaces most deprecated io-ts alerting and list types (#100234)
## Summary

Replaces most of the deprecated io-ts alerting and list types within securitysolution as part of Phase 3 of 4 phases outlined in earlier PR's such as https://github.com/elastic/kibana/pull/99260

### 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-05-17 23:28:06 -06:00
Frank Hassanabad bfe08d25c5
[Security Solutions] Removes deprecation and more copied code between security solutions and lists plugin (#100150)
## Summary

* Removes deprecations 
* Removes duplicated code

### 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-05-14 16:56:08 -06:00
Frank Hassanabad 7dd29a56ad
[Security Solutions] Breaks down the io-ts packages to decrease plugin size (#100058)
## Summary

The io-ts package was too large and needed to broken down more by domain to decrease the lists plugin size and any other plugin wanting to use the packages will not incur big hits as well.

Before we had one large io-ts package:

```
@kbn/securitysolution-io-ts-utils
```

Now we have these broken down 4 packages:

```
@kbn/securitysolution-io-ts-utils
@kbn/securitysolution-io-ts-types
@kbn/securitysolution-io-ts-alerting-types
@kbn/securitysolution-io-ts-list-types   
```

Deps between these packages are:

```
@kbn/securitysolution-io-ts-utils (none)
@kbn/securitysolution-io-ts-types -> @kbn/securitysolution-io-ts-utils
@kbn/securitysolution-io-ts-alerting-types -> @kbn/securitysolution-io-ts-types, @kbn/securitysolution-io-ts-utils
@kbn/securitysolution-io-ts-list-types  -> @kbn/securitysolution-io-ts-types, @kbn/securitysolution-io-ts-utils
```

Short description and function of each (Also in each of their README.md):

```
@kbn/securitysolution-io-ts-utils, Smallest amount of utilities such as format, validate, etc...
@kbn/securitysolution-io-ts-types, Base types such as to_number, to_string, etc...
@kbn/securitysolution-io-ts-alerting-types, Alerting specific types such as severity, from, to, etc...
@kbn/securitysolution-io-ts-list-types, list specific types such as exception lists, exception list types, etc...
```

### 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-05-13 15:36:06 -06:00
Frank Hassanabad f492feee6e
[Security Solutions][Lists] Trims down list plugin size by breaking out the exception builder into chunks by using react lazy loading (#99989)
## Summary

Trims down the list plugin size by breaking out the exception builder into a dedicated chunk by using React Suspense and React lazy loading.

Before this PR the page load bundle size was `260503`, after the page load bundle size will be `194132`:

You can calculate this through:
```ts
node ./scripts/build_kibana_platform_plugins --dist --focus lists
cat ./x-pack/plugins/lists/target/public/metrics.json
```

Before
```json
[
  {
    "group": "@kbn/optimizer bundle module count",
    "id": "lists",
    "value": 227
  },
  {
    "group": "page load bundle size",
    "id": "lists",
    "value": 260503, <--- Very large load bundle size
    "limit": 280504,
    "limitConfigPath": "packages/kbn-optimizer/limits.yml"
  },
  {
    "group": "async chunks size",
    "id": "lists",
    "value": 0
  },
  {
    "group": "async chunk count",
    "id": "lists",
    "value": 0
  },
  {
    "group": "miscellaneous assets size",
    "id": "lists",
    "value": 0
  }
]
```

After:
```json
[
  {
    "group": "@kbn/optimizer bundle module count",
    "id": "lists",
    "value": 227
  },
  {
    "group": "page load bundle size",
    "id": "lists",
    "value": 194132, <--- Not as large bundle size
    "limit": 280504,
    "limitConfigPath": "packages/kbn-optimizer/limits.yml"
  },
  {
    "group": "async chunks size",
    "id": "lists",
    "value": 70000
  },
  {
    "group": "async chunk count",
    "id": "lists",
    "value": 1
  },
  {
    "group": "miscellaneous assets size",
    "id": "lists",
    "value": 0
  }
]
```

### 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-05-13 14:05:02 -06:00
Frank Hassanabad 6d80bf7a21
[Security Solutions] Removes circular dependencies and introduces kbn-security-solution-es-utils package (#99828)
## Summary

Fixes the hopefully last circular dependency issues between security solutions and lists.

* Adds a package of `@kbn/securitysolution-es-utils` and moves files from security solutions into that package.
* Re-ingests that package back into lists 

Before this PR if you ran:

```ts
node scripts/find_plugins_with_circular_deps.js --debug
```

Then you would get:

```
 debg !!!!!!!!!!!!!! CIRCULAR DEPENDENCIES FOUND !!!!!!!!!!!!!!
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      ! Circular dependencies were found, you can find below  !
      ! all the paths involved.                               !
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 debg   01) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts
        02) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/lib/framework/kibana_framework_adapter.ts -> x-pack/plugins/security_solution/server/types.ts
        03) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/endpoint/types.ts -> x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts
        04) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/endpoint/types.ts -> x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts -> x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts
        05) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/endpoint/types.ts -> x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts -> x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts -> x-pack/plugins/security_solution/server/endpoint/services/index.ts -> x-pack/plugins/security_solution/server/endpoint/services/artifacts/index.ts -> x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/index.ts -> x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts
        06) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/endpoint/types.ts -> x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts -> x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts -> x-pack/plugins/security_solution/server/endpoint/services/index.ts -> x-pack/plugins/security_solution/server/endpoint/services/artifacts/index.ts -> x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/index.ts -> x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.ts -> x-pack/plugins/security_solution/server/endpoint/lib/artifacts/index.ts -> x-pack/plugins/security_solution/server/endpoint/lib/artifacts/lists.ts
        07) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/endpoint/types.ts -> x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts -> x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts -> x-pack/plugins/security_solution/server/fleet_integration/handlers/install_prepackaged_rules.ts
        08) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/compose/kibana.ts -> x-pack/plugins/security_solution/server/endpoint/types.ts -> x-pack/plugins/security_solution/server/endpoint/endpoint_app_context_services.ts -> x-pack/plugins/security_solution/server/fleet_integration/fleet_integration.ts -> x-pack/plugins/security_solution/server/fleet_integration/handlers/install_prepackaged_rules.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/add_prepackaged_rules_route.ts
        09) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts
        10) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts
        11) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/query.ts
        12) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/query.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/search_after_bulk_create.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/filter_events_against_list.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/filters/types.ts
        13) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threat_match.ts
        14) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/threat_match.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_threat_signals.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/get_threat_list.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/types.ts
        15) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/signal_rule_alert_type.ts -> x-pack/plugins/security_solution/server/lib/detection_engine/signals/executors/ml.ts
        16) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/index.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/handlers.ts
        17) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/index.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/handlers.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/service.ts
        18) x-pack/plugins/lists/server/index.ts -> x-pack/plugins/lists/server/plugin.ts -> x-pack/plugins/lists/server/routes/init_routes.ts -> x-pack/plugins/lists/server/types.ts -> x-pack/plugins/lists/server/services/lists/list_client.ts -> x-pack/plugins/lists/server/siem_server_deps.ts -> x-pack/plugins/security_solution/server/index.ts -> x-pack/plugins/security_solution/server/plugin.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/index.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/handlers.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/service.ts -> x-pack/plugins/security_solution/server/endpoint/routes/trusted_apps/mapping.ts

 debg !!!!!!!!!!!!!!!!! UP TO DATE ALLOWED LIST !!!!!!!!!!!!!!!!!!
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      ! The declared circular dependencies allowed list is up    !
      ! to date and includes every plugin listed in above paths. !
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      The allowed circular dependencies list is (#3):
      'x-pack/plugins/lists -> x-pack/plugins/security_solution',
 succ None non allowed circular dependencies were found
```

Now you get:

```
  debg !!!!!!!!!!!!!!!!! UP TO DATE ALLOWED LIST !!!!!!!!!!!!!!!!!!
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      ! The declared circular dependencies allowed list is up    !
      ! to date and includes every plugin listed in above paths. !
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      The allowed circular dependencies list is (#1):
      'x-pack/plugins/lists -> x-pack/plugins/security_solution',
 succ None non allowed circular dependencies were found
```

### 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-05-12 15:55:37 -06:00
Frank Hassanabad c092fbfe1a
[Security Solutions] (Phase 3, part 1) Removes dependency on security_solution plugin from lists (#99431)
## Summary

Removes the dependency of security_solution from the lists plugin

* Removes some of the deprecated types in favor of the new kbn package
* Adds a workaround in the kbn packages of removing the ?? and `a?.b?.c` typescript since kbn packages cannot transpile it
* Exposes the test_utils from the kbn package 

### 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-05-10 10:16:19 -06:00
Yara Tercero ebe85665a9
[Security Solution][Exceptions] - Fix operator logic for large value lists (#99490)
### Summary
Logic for operators was off, this fix adds unit tests to ensure this bug is not hit again and updates logic
2021-05-10 01:14:24 -04:00
David Sánchez 35f4be4387
[Security Solution][Endpoint] User can edit existing event filters from the list (#98898)
* Makes width 100% to allow multilang

* Removes state/index types and move those types into the parent types file

* Allows fill form from existing exception by id. Adds unit tests. Fixes wrong comments display when there is more than one comment.

* Allows user update an existing event filter. Adds unit tests. Fixes some wrong behaviours when opening the flyout after create/update action

* Fixes typo

* Fixes wrong entry type

* Uses selectors when it's possible instead of accessing directly to state object

* Fixes typechecks

* Allows edit from the card edit button. Removes unused imports and fixes some types

* Reverts type name

* Changes reducer to don't add entry to the list manually after creation, list will be reloaded with api call. Also check always if data exists to display the add new entry button at the first time
2021-05-06 18:13:55 +02:00
Frank Hassanabad 92da1059bd
Added deprecation to all the io-ts types and copies of them (#99260)
## Summary

Adds deprecation to all the io-ts types and copies of them found in the code base.

Phase 1 (Completed): Copy all the utilities to the `packages/kbn-securitysolution-io-ts-utils`
Phase 2: Add all the deprecation messages about them to the code base
Phase 3+: Teams and others will eventually remove/replace them with the utils from `kbn-securitysolution-io-ts-utils`
2021-05-04 17:00:45 -06:00
Kevin Logan 5203859cf9
[Security Solution][Detections] Make Endpoint Exception field options aware of OS, introduce OS selection to Endpoint Exceptions flow (#95014) 2021-04-30 16:18:40 -04:00
Ashokaditya c93e028e0c
[Security Solution][Endpoint] Allow wildcard in trusted app paths (#97623)
* show operator dropdown for path field

refs elastic/security-team/issues/543

* update translation to use consistent values

refs elastic/security-team/issues/543

* update schema to validate path values

refs elastic/security-team/issues/543

* add tests for field and operator values

refs elastic/security-team/issues/543

* review changes

refs elastic/security-team/issues/543

* update schema to enforce dropdown validation for PATH field

refs elastic/security-team/issues/543

* add tests for schema updates

refs 1deab39453
refs elastic/security-team/issues/543

* optimise dropdown list for re-renders

refs elastic/security-team/issues/543

* align input fields and keep alignments when resized

refs elastic/security-team/issues/543

* correctly enter operator data on trusted app CRUD

refs elastic/security-team/issues/543

* update tests

refs 2ac56ee839
refs elastic/security-team/issues/543

* remove redundant code

review changes

* better type assertion

review changes

* move operator options out of component

- these do not depend on component props and thus no need to have it within a useMemo callback.

- review changes

* derive keys from operator entry field

review changes

* update type

* use custom styles for aligning input fields

review changes

* add a custom type for trusted_apps operator

undo changes from list plugin and server/lib/detection_engine

refs 2ac56ee839
refs elastic/security-team/issues/543

* add wildcard entry type

refs elastic/security-team/issues/543
refs https://github.com/elastic/kibana/pull/97623#pullrequestreview-642618462

* use the new entry type

refs elastic/security-team/issues/543
refs https://github.com/elastic/kibana/pull/97623#pullrequestreview-642618462

* update tests

refs elastic/security-team/issues/543
refs https://github.com/elastic/kibana/pull/97623#pullrequestreview-642618462

* update name for wildcard type so that it can be used also for cased inputs

refs elastic/security-team/issues/543
refs f9cb7eddda

* update artifacts to support wildcard entries

refs elastic/security-team/issues/543

* add tests for list schemas

refs f9cb7eddda
refs elastic/security-team/issues/543

* add placeholders for path values

review changes
elastic/kibana/pull/97623#discussion_r620617999

* ignore type check for now

* add type assertion

refs 284352ec9a

* remove unnecessary test

refs 2ac56ee839

* fix types

refs f9cb7eddda
refs b3f5dc4553

* add a note to entries

review changes

refs dbd3532149

* remove redundant type assertions

review changes
refs bcf615ac98
refs b3f5dc4553

* move placeholder text logic to utils

review changes elastic/kibana/pull/97623#discussion_r621673881

refs 6f2d0d7810

* pass the style as prop

review changes

* update api doc

CI check suggestion

* make placeholderText a function expression

review suggestion

elastic/kibana/pull/97623/commits/2dc4fd390cf5ea0e4fa67b3f5fc2561cbb29555e

* use semantic names for functions

refs 330731ebfc

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-29 14:54:19 +02:00
David Sánchez bc240f0af7
[Security Solution] User can select event from event list and create a filter (#96940)
* Initial version of event filtering form/dialog. Pending to add all redux services

* Uses redux store instead of props to get the form values

* Manage errors on redux

* Creates even filter list on service constructor

* Add os type selector depending on form parent by props. Also added create action

* Allows add exception to an event. This commit has to be reviewed and maybe it will change depending on next changes

* Fix imports because changes on ExceptionBuilder component and add needed type export

* Adds constants. Rename eventFilters to eventFilter. Add http wrapper as a hook to check if the list has been created or not

* Adds missing files on last commit.

* Relocate async resource state to be shared between different pages

* Use async resource state to manage async operations on components. Relocate initial entry status to an utils module instead of hook.

* Adds comments into redux store from component

* Fixes typechecks and wrong imports

* Fixes translations and adds subheader and description modal

* Relocates form description

* Removes unused import

* Sanitize entries before submit to remove entry.id

* Missed file on last commit

* Use specific fields for endpoint_event type builder

* Split error field for each kind of errors to prevent unexpected renders. Adds unit test for event filter form component

* Set event.kind == event by default

* Changes folder names. Add notifications when success. Remove default event.king

* Adds notifications when api error and fixed multiple notifications showed for same error

* Adds new test for event filter modal and changes component name to be consistent

* Adds unit tests for event filter notification

* Adds middleware unit tests. Also isolate common event for all tests

* Adds unit tests for event filter reducer

* Adds unit tests for event filter selector

* Fixes same key on different multilanguages. Fixes naming incoherence

* Adds feature flag for event filtering

* Fixes unit tests and weird behavior when changing items after name or comments on event filter form

* Removes unused import

* Fixes unit tests. Add imports from lists plugin. Add expects on tests. Change some names

* Renames everything from eventFilter to eventFilters (plural)

* Rename state variable

* Create hook for notifications instead of a component. Removes className from modal body.

* Updates available fields for enpoint events builder

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-22 10:08:33 +02:00
Nathan L Smith d5bb7d6645
Use EuiThemeProvider in lists plugin tests and stories (#96129)
Remove `getMockTheme` and use `EuiThemeProvider` from the kibana_react plugin.

Use the CSF-style decorators with `EuiThemeProvider` in the stories.

No functional changes, but should be less code to maintain.
2021-04-13 13:49:25 -05:00
Paul Tavares b33022f680
[Security Solution][Artifacts] Artifact creation for Endpoint Event Filtering (#96499)
* generate endpoint event filters artifacts
* Add ExperimentalFeature object to the initialization params of ManifestManager
* create event filters artifacts if feature flag is on
* change artifact migration to be less chatty in the logs (also: don't reference Fleet)
2021-04-12 11:58:19 -04:00
David Sánchez 21f38afd27
[SECURITY SOLUTION] Add new exception list type and feature flag for event filtering (#96037)
* New exception list type for event filtering
* New feature flag for event filtering
2021-04-07 15:01:54 -04:00
Paul Tavares 9a0c73e515
[Security Solution][Endpoint] Endpoint Event Filtering List, Test Data Generator and Loader (#96263)
* Added new const to List plugin for new Endpont Event Filter list
* Data Generator for event filters ++ script to load event filters (WIP)
* refactor `generate_data` to use `BaseDataGenerator` class
2021-04-07 12:36:28 -04:00
Yara Tercero 92b9482875
[Security Solution][Exceptions] - Moves remaining exceptions builder logic into lists plugin (#95266)
## Summary

Moves part of the exceptions UI out of the security solution plugin and into the lists plugin. In order to keep PRs (relatively) small, I am moving single components at a time. This should also then help more easily pinpoint the source of any issues that come up along the way.

The next couple PRs will focus on the exception builder. This one in particular is focused on moving over the `ExceptionBuilderComponent` which deals with rendering numerous exception items and their entries.

Quick Summary:
- `x-pack/plugins/security_solution/public/common/components/exceptions/builder/` → ` x-pack/plugins/lists/public/exceptions/components/builder/`
  - Corresponding unit test file moved as well 
  - Updated security solution exception builder to pull `ExceptionBuilderComponent` from lists plugin
2021-04-06 20:26:15 +02:00
Yara Tercero 17d3907730
[Security Solution][Exceptions] - Moves ExceptionItem component to lists plugin (#95246)
## Summary

Moves part of the exceptions UI out of the security solution plugin and into the lists plugin. In order to keep PRs (relatively) small, I am moving single components at a time. This should also then help more easily pinpoint the source of any issues that come up along the way.

The next couple PRs will focus on the exception builder. This one in particular is focused on moving over the `BuilderExceptionItem` which deals with rendering the individual exception items.
2021-03-26 20:59:49 -07:00
Yara Tercero 2aae753c54
[Security Solution][Exceptions][Builder] -Move exception builder entry item exceptions ui over to lists (#94515)
## Summary

Beginning to move the exceptions UI out of the security solution plugin and into the lists plugin. In order to keep PRs (relatively) small, I plan to move single components at a time. This should also then help more easily pinpoint the source of any issues that come up along the way.

The next couple PRs will focus on the exception builder. This one in particular is focused on moving over the `BuilderEntryItem` which deals with rendering the individual exception item entries. An entry can be of type `match`, `match_any`, `list`, `exists`, or `nested`. The component makes use of the autocomplete fields which use the index patterns to display possible fields and field values. 

One of the decisions made in this PR was to have consumers of the `BuilderEntryItem` pass through the autocomplete service as opposed to the `lists` plugin adding it as a dependency. The reason being that it is likely that plugins using the lists plugin will already be consuming either the data plugin or if alerting takes exceptions in, then they'll be consuming alerting. In an effort to avoid some possible icky circular dependency issues, though it best to make the service passed in, as we had already been doing with the hooks in the `lists` plugin.
2021-03-26 13:05:27 -07:00
David Sánchez 2af094a63d
[Security Solution] Put Artifacts by Policy feature behind a feature flag (#95284)
* Added sync_master file for tracking/triggering PRs for merging master into feature branch

* removed unnecessary (temporary) markdown file

* Trusted apps by policy api (#88025)

* Initial version of API for trusted apps per policy.

* Fixed compilation errors because of missing new property.

* Mapping from tags to policies and back. (No testing)

* Fixed compilation error after pulling in main.

* Fixed failing tests.

* Separated out the prefix in tag for policy reference into constant.

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

* [SECURITY_SOLUTION][ENDPOINT] Ability to create a Trusted App as either Global or Policy Specific (#88707)

* Create form supports selecting policies or making Trusted app global
* New component `EffectedPolicySelect` - for selecting policies
* Enhanced `waitForAction()` test utility to provide a `validate()` option

* [SECURITY SOLUTION][ENDPOINT] UI for editing Trusted Application items (#89479)

* Add Edit button to TA card UI
* Support additional url params (`show`, `id`)
* Refactor TrustedAppForm to support Editing of an existing entry

* [SECURITY SOLUTION][ENDPOINT] API (`PUT`) for Trusted Apps Edit flow (#90333)

* New API route for Update (`PUT`)
* Connect UI to Update (PUT) API
* Add `version` to TrustedApp type and return it on the API responses
* Refactor - moved some public/server shared modules to top-level `common/*`

* [SECURITY SOLUTION][ENDPOINT] Trusted Apps API to retrieve a single Trusted App item (#90842)

* Get One Trusted App API - route, service, handler
* Adjust UI to call GET api to retrieve trusted app for edit
* Deleted ununsed trusted app types file
* Add UI handling of non-existing TA for edit or when id is missing in url

* [Security Solution][Endpoint] Multiple misc. updates/fixes for Edit Trusted Apps (#91656)

* correct trusted app schema to ensure `version` is not exposed on TS type for POST
* Added updated_by, updated_on properties to TrustedApp
* Refactored TA List view to fix bug where card was not updated on a successful edit
* Test cases for card interaction from the TA List view
* Change title of policy selection to `Assignment`
* Selectable Policy CSS adjustments based on UX feedback

* Fix failing server tests

* [Security Solution][Endpoint] Trusted Apps list API KQL filtering support (#92611)

* Fix bad merge from master
* Fix trusted apps generator
* Add `kuery` to the GET (list) Trusted Apps api

* Refactor schema with Put method after merging changes with master

* WIP: allow effectScope only when feature flag is enabled

* Fixes errors with non declared logger

* Uses experimental features module to allow or not effectScope on create/update trusted app schema

* Set default value for effectScope when feature flag is disabled

* Adds experimentals into redux store. Also creates hook to retrieve a feature flag value from state

* Hides effectPolicy when feature flag is not enabled

* Fixes unit test mocking hook and adds new test case

* Changes file extension for custom hook

* Adds new unit test for custom hook

* Hides horizontal bar with feature flag

* Compress text area depending on feature flag

* Fixes failing test because feature flag

* Fixes wrong import and unit test

* Thwrows error if invalid feature flag check

* Adds snapshoot checks with feature flag enabled/disabled

* Test snapshots

* Changes type name

* Add experimentalFeatures in app context

* Fixes type checks due AppContext changes

* Fixes test due changes on custom hook

Co-authored-by: Paul Tavares <paul.tavares@elastic.co>
Co-authored-by: Bohdan Tsymbala <bohdan.tsymbala@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Paul Tavares <56442535+paul-tavares@users.noreply.github.com>
2021-03-26 11:32:46 +01:00
Tomas Della Vedova 238791b942
ES client : use the new type definitions (#83808)
* Use client from branch

* Get type checking working in core

* Fix types in other plugins

* Update client types + remove type errors from core

* migrate Task Manager Elasticsearch typing from legacy library to client library

* use SortOrder instead o string in alerts

* Update client types + fix core type issues

* fix maps ts errors

* Update Lens types

* Convert Search Profiler body from a string to an object to conform to SearchRequest type.

* Fix SOT types

* Fix/mute Security/Spaces plugins type errors.

* Fix bootstrap types

* Fix painless_lab

* corrected es typing in Event Log

* Use new types from client for inferred search responses

* Latest type defs

* Integrate latest type defs for APM/UX

* fix core errors

* fix telemetry errors

* fix canvas errors

* fix data_enhanced errors

* fix event_log errors

* mute lens errors

* fix or mute maps errors

* fix reporting errors

* fix security errors

* mute errors in task_manager

* fix errors in telemetry_collection_xpack

* fix errors in data plugins

* fix errors in alerts

* mute errors in index_management

* fix task_manager errors

* mute or fix lens errors

* fix upgrade_assistant errors

* fix or mute errors in index_lifecycle_management

* fix discover errors

* fix core tests

* ML changes

* fix core type errors

* mute error in kbn-es-archiver

* fix error in data plugin

* fix error in telemetry plugin

* fix error in discover

* fix discover errors

* fix errors in task_manager

* fix security errors

* fix wrong conflict resolution

* address errors with upstream code

* update deps to the last commit

* remove outdated comments

* fix core errors

* fix errors after update

* adding more expect errors to ML

* pull the lastest changes

* fix core errors

* fix errors in infra plugin

* fix errors in uptime plugin

* fix errors in ml

* fix errors in xpack telemetry

* fix or mute errors in transform

* fix errors in upgrade assistant

* fix or mute fleet errors

* start fixing apm errors

* fix errors in osquery

* fix telemetry tests

* core cleanup

* fix asMutableArray imports

* cleanup

* data_enhanced cleanup

* cleanup events_log

* cleaup

* fix error in kbn-es-archiver

* fix errors in kbn-es-archiver

* fix errors in kbn-es-archiver

* fix ES typings for Hit

* fix SO

* fix actions plugin

* fix fleet

* fix maps

* fix stack_alerts

* fix eslint problems

* fix event_log unit tests

* fix failures in data_enhanced tests

* fix test failure in kbn-es-archiver

* fix test failures in index_pattern_management

* fixing ML test

* remove outdated comment in kbn-es-archiver

* fix error type in ml

* fix eslint errors in osquery plugin

* fix runtime error in infra plugin

* revert changes to event_log cluser exist check

* fix eslint error in osquery

* fixing ML endpoint argument types

* fx types

* Update api-extractor docs

* attempt fix for ese test

* Fix lint error

* Fix types for ts refs

* Fix data_enhanced unit test

* fix lens types

* generate docs

* Fix a number of type issues in monitoring and ml

* fix triggers_actions_ui

* Fix ILM functional test

* Put search.d.ts typings back

* fix data plugin

* Update typings in typings/elasticsearch

* Update snapshots

* mute errors in task_manager

* mute fleet errors

* lens. remove unnecessary ts-expect-errors

* fix errors in stack_alerts

* mute errors in osquery

* fix errors in security_solution

* fix errors in lists

* fix errors in cases

* mute errors in search_examples

* use KibanaClient to enforce promise-based API

* fix errors in test/ folder

* update comment

* fix errors in x-pack/test folder

* fix errors in ml plugin

* fix optional fields in ml api_integartoon tests

* fix another casting problem in ml tests

* fix another ml test failure

* fix fleet problem after conflict resolution

* rollback changes in security_solution. trying to fix test

* Update type for discover rows

* uncomment runtime_mappings as its outdated

* address comments from Wylie

* remove eslint error due to any

* mute error due to incompatibility

* Apply suggestions from code review

Co-authored-by: John Schulz <github.com@jfsiii.org>

* fix type error in lens tests

* Update x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.ts

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>

* Update x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex_service.test.ts

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>

* update deps

* fix errors in core types

* fix errors for the new elastic/elasticsearch version

* remove unused type

* remove unnecessary manual type cast and put optional chaining back

* ML: mute Datafeed is missing indices_options

* Apply suggestions from code review

Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>

* use canary pacakge instead of git commit

Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
Co-authored-by: Wylie Conlon <wylieconlon@gmail.com>
Co-authored-by: CJ Cenizal <cj@cenizal.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: restrry <restrry@gmail.com>
Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: John Schulz <github.com@jfsiii.org>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
2021-03-25 04:47:16 -04:00