Commit graph

239 commits

Author SHA1 Message Date
Khristinin Nikita
35e02bcf64
Add sorting for exceptions cards (#145070)
## Add sorting for shared exceptions

Currently is possible to sort by Name, Created At, Created By


https://user-images.githubusercontent.com/7609147/201640150-dc9d53e4-0d34-4da1-8522-9899d35e7359.mov

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Devin W. Hurley <snowmiser111@gmail.com>
2022-11-15 13:55:38 -07:00
Khristinin Nikita
4868e2118d
Rule duplication with/without exceptions (#144782)
## Rule duplication with/without exceptions

Majority of work done by @yctercero in this
[branch](https://github.com/yctercero/kibana/tree/dupe)
Some integration tests are left, but PR is ready for review.

2 flow when you duplicate rule:

### Without exceptions 
Don't duplicate any exceptions

### With exceptions 
Shared exceptions should duplicate reference
Rule default exceptions are not duplicated by reference, but create a
copy of exceptions. So if you remove it from duplicate rules, the
original rule is not changed.




https://user-images.githubusercontent.com/7609147/200863319-4cb56749-42dd-42d8-8896-f45782c21838.mov


# TODO;

[] integrations tests
[] cypress tests

Co-authored-by: Yara Tercero <yara.tercero@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-11-15 11:43:40 -07:00
Devin W. Hurley
c1070e63a1
[Security Solution] [Exceptions] Updates the exceptions list table to match mockups (#142289)
Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co>
2022-11-02 08:41:48 -07:00
spalger
52f2b33a07
[auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05:00
Yara Tercero
6c5d816c01
[Security Solution][Exceptions] - Update add/edit exception flyouts (#143127)
* squashed commit of updates to add/edit flyouts for exception, added cypress tests and unit tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Devin W. Hurley <devin.hurley@elastic.co>
2022-10-19 15:13:18 -04:00
Yara Tercero
0149bd063c
[Security Solution][Exceptions] - Common flyout components (#142054)
## Summary

Adds components shared between new add/edit exception flyouts. Does not yet modify the flyouts themselves. Trying to break down what would be an even larger PR into chunks.
2022-10-05 11:38:33 -07:00
Wafaa Nasr
0fcfaec2dd
remove alignCenter to prevent the icon from adjusting (#141365)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-09-22 18:16:31 +02:00
Davis Plumlee
51699fa21a
[Security Solution] Value list exceptions (#133254) 2022-09-19 22:41:28 +02:00
Yara Tercero
194e0d7144
[Security Solution][Exceptions] - Initial updates to exceptions viewer UX (#138770)
## Summary

**API changes**
- Adds API for determining the list-rule references. 
- Updates the exception items find api to include the `search` param which allows for simple search queries - used with the EUI search bar

**UI updates**
- Moved the exception components into new `rule_exceptions` folder per suggested folder structure updates listed [here](https://github.com/elastic/kibana/issues/138600)
- Updates the rule details tabs to split endpoint and rule exceptions into their own tabs
- Updates the viewer utilities header now that these different exception types are split
- Updates exception item UI to match new designs
- Updates the UI for when there are no items
- Removes `use_exception_list_items` hook as it is no longer in use
- Flyouts (add/edit) remain untouched
2022-09-08 16:41:52 -04:00
David Sánchez
e459752466
[Security Solution][Endpoint] New route for create an exception list and return the existing one if it already exists (#139618)
* new route for create an exception list and return the existing one if alredy exists

* Fixes unit test and shows error when ignore_existing set to false and there is a conflict

* Remove query param and update route name to be more specific

* Fixes unit test

* Enforce list_id and type types for internal route. Added unit tests

* Uses existing constants to define list_ids

* Don't create host isolation exeptions api client if not needed when checking links availability

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-09-08 11:42:35 +02:00
Wafaa Nasr
f107c273af
Fix/100018 import value list sorting (#138381)
* add sortField and sortOrder to findLists params

* move tests for list-hooks

* pass sortField and sortOrder from Flyout component + tests + remove obsolete test files

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-08-10 13:07:32 +02:00
Yara Tercero
1327c88117
[Security Solution][Lists] - Update lists index template logic (#133067)
## Summary

The lists plugin stores large value lists in two data indices - `.lists-*` and `.items-*`. These were still using the legacy ES template. This PR updates relevant routes to now use the new index templates.

- `createListsIndexRoute` now uses the new template routes and checks for legacy templates to delete them
- `deleteListsIndex` now uses up to date ES API 
- Updates the templates to follow new structure
2022-07-26 15:43:03 -05:00
Marshall Main
fe97c24de2
[Security Solution][Platform] Only allow wildcard exceptions on string fields (#137129)
* Only allow wildcard exceptions on string fields

* Fix unit tests and move to the right place
2022-07-26 12:41:19 -07:00
Pierre Gayvallet
0645a3ba38
Create common and api types packages for the savedObjects domain (#136722)
* Creating empty @kbn/core-saved-objects-common package

* start moving types around

* start fixing imports

* fix entrypoint exports

* fix external import

* create explicit ISavedObjectsRepository interface

* fix another external usage

* rewrite browser exports

* create explicit SavedObjectsClientContract interface

* move client/repository types to @kbn/core-saved-objects-api-server

* start fixing imports

* one more

* fix global re-exports

* fix some browser-side imports

* fix more violations

* prepare the browser-side client

* fix one more usage

* fix external usage

* fix more external usages

* one more

* Create @kbn/core-saved-objects-api-browser package

* fix more usages of error helper

* fix more internal imports

* use interface for SSO

* adapt more imports

* damn those types were a mess

* fix more usages of SSO

* Revert "fix more usages of SSO"

This reverts commit 07a12e5353.

* Revert "use interface for SSO"

This reverts commit 6240fc86c5.

* export the interface with the old name instead.

* adapt tests concrete usages of SSO

* export reference type, more fixes

* this gonna be long

* one more

* other resolve type change

* more usages

* Am I getting close?

* yet more fixes

* back to client impl

* fix bulkGetting undefined

* fix SS mock

* some cleanup

* self-review

* fix new usages
2022-07-26 04:01:33 -07:00
Pierre Gayvallet
3508350446
Migrate server-side ES domain to packages (#136297)
* create es types package

* start moving client types to @kbn/core-elasticsearch-server

* move ElasticsearchClientConfig to package

* start adapting usages

* start fixing imports

* fix more imports

* just a bit more

* move service types

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* fix more internal types

* move retry call cluster helpers outside of client package

* move client code and mocks to packages

* fix imports

* adapt external usages

* adapt more external usages

* adapt more external usages 2

* fix mocked module

* create empty domain packages

* more external usages fix

* move ALL the things (again)

* mock external import fix

* fix tests, add test dependencies

* fix some internal usages

* fix more internal usages

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* fix cli_setup usage

* desperate times force desperate decisions

* fix misc stuff

* update snapshots (?!)

* fix mocked package

* self review

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-07-20 10:07:48 +02:00
Marshall Main
aaa3107dbc
[Security Solution][Alerts] Detection engine wildcard exceptions (#136147)
* Implement wildcard exceptions for detection rules

* Fix index pattern retrieval on edit exceptions flyout

* Fix API integration test logic

* Fix entry_renderer linting

* Remove bad fix idea

* Add 'does not match' operator to UI

* Fix test

* Add unit tests

* Add wildcard exceptions to list of DE exception operators

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-19 15:03:47 -07:00
Tiago Costa
302bd423f3
chore(NA): eslint rule for disallowing naked eslint-disable (#136408)
* chore(NA): eslint rule for disallowing naked eslint-disable

* chore(NA): export new rule and update docs

* chore(NA): creation of rule in ts

* chore(NA): new corrected rule in ts

* refact(NA): remove old logic from older plugin

* docs(NA): update documentation

* docs(NA): update documentation

* docs(NA): update documentation

* refact(NA): include edge cases for better locating errors

* chore(NA): changed regex name

* docs(NA): correct name rule on docs

* refact(NA): use dedent in the template literals

* refact(NA): check for undefined

* fix(NA): introduces support for eslint-disable-line

* chore(NA): fix extra space

* test(NA): created more test cases

* chore(NA): rename plugin to eslint-plugin-disable

* docs(NA): update nav and operations landing page ids for eslint rule

* test(NA): use messageIds on test

* chore(NA): complete naked eslint disables with specific rules

* chore(NA): specific rules for a few naked eslint disable

* chore(NA): add focused eslint disable on big reindex_operation_with_large_error_message.ts file

* chore(NA): changes according PR feedback

* chore(NA): include specific eslint rules on latest naked eslint disable

* chore(NA): missing eslint disable specific rule

* fix(NA): remove comment for js annotator

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-19 17:11:04 +01:00
Yara Tercero
ff3853cfa9
[Security Solution][Exceptions] - Fixes exception builder bug that includes matches operator (#136340)
## Summary

Addresses Kibana issue #36224
2022-07-19 08:15:49 -07:00
Mat Schaffer
35fab1c4a5
Remove/replace uses of "sanity" in comments and test code (#134541) 2022-06-30 19:21:23 -07:00
Pierre Gayvallet
98c73d5278
Introduce the KibanaRequest interface (#135401)
* Introduce the IKibanaRequest interface

* swap to keeping the KibanaRequest name for the interface

* adapt usages

* fix mock

* export CoreKibanaRequest for now...

* adapt imports from tests

* lint

* more missed usages in tests

* fix another instanceof...

* improve tsdoc
2022-06-30 15:35:08 +02:00
Yara Tercero
4235294f08
[Security Solution][Exceptions] - Fix exceptions builder validation bug (#131989)
Addresses #86258

The variable tracking state needed to be cleared on operator change. If you didn't change operators, then invalidating and then validating an entry worked as expected, but if you switched operators, the error state was not being cleared causing the builder to read that there was an error state.
2022-05-11 10:49:07 -07:00
Pierre Gayvallet
a02c00b8a3
Change ContextContainer to lazily initialize providers (#129896)
* Change ContextContainer to lazily initialize providers

* Introduce CustomRequestHandlerContext, start adapting usages

* adapt IContextProvider's return type

* start fixing violations

* fixing violations - 2

* adapt home routes

* fix remaining core violation

* fix violations on core tests

* fixing more violations

* fixing more violations

* update generated doc...

* fix more violations

* adapt remaining RequestHandlerContext

* fix more violations

* fix non-async method

* more fixes

* fix another await in non async method

* add yet another missing async

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* add yet yet another missing async

* update fleet's endpoints

* fix telemetry endpoints

* fix event_log endpoints

* fix some security unit tests

* adapt canvas routes

* adapt alerting routes

* adapt more so_tagging routes

* fix data_enhanced routes

* fix license_management routes

* fix file_upload routes

* fix index_management routes

* fix lists routes

* fix snapshot_restore routes

* fix rule_registry routes

* fix ingest_pipelines routes

* fix remote_clusters routes

* fix index_lifecycle_management routes

* improve and fix the lazy implementation

* fix triggers_actions_ui endpoints

* start fixing unit tests

* fix cases routes

* fix transform routes

* fix upgrade_assistant routes

* fix uptime route wrapper

* fix uptime route wrapper bis

* update osquery routes

* update cross_cluster_replication routes

* fix some ML routes / wrappers

* adapt maps routes

* adapt rollup routes

* fix some canvas unit tests

* fix more canvas unit tests

* fix observability wrapper

* fix (?) infra type hell

* start fixing monitoring

* fix a few test plugins

* woups

* fix yet more violations

* fixing UA  tests

* fix logstash handlers

* fix fleet unit tests

* lint?

* one more batch

* update security_solution endpoints

* start fixing security_solution mocks

* start fixing security_solution tests

* fix more security_solution tests

* fix more security_solution tests

* just one more

* fix last (?) security_solution tests

* fix timelion javascript file

* fix more test plugins

* fix transforms context type

* fix ml context type

* fix context tests

* fix securitySolution withEndpointAuthz tests

* fix features unit tests

* fix actions unit tests

* fix imports

* fix duplicate import

* fix some merge problems

* fix new usage

* fix new test

* introduces context.resolve

* down the rabbit hole again

* start fixing test type failures

* more test type failures fixes

* move import comment back to correct place

* more test type failures fixes, bis

* use context.resolve for security solution rules routes

* fix new violations due to master merge

* remove comment

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-04-22 13:15:58 +02:00
Nodir Latipov
7c01257055
[Unified Search] Move autocomplete logic to unified search plugin (#129977)
* feat: move autocomplete logic from data plugin to unified search

* minor fix after comments

* updated Documentation: data.autocomplete -> unifiedSearch.autocomplete

* changed renameFromRoot order for autocomplete

* removed extra renameFromRoot in config deprecations, updated test

* added configPath for unified search plugin

* Update kibana.json

* updated path to autocomplete

* fix conflict

* fix conflict

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* fix Linting

* fix functional_with_es_ssl test
2022-04-22 11:02:56 +05:00
spalger
3730dd0779 fix all violations 2022-04-16 01:37:30 -05:00
Frank Hassanabad
7023ca6966
[Security Solutions] Adds API docs for value lists (#129962)
## Summary

Adds API docs for value lists

### Checklist

- [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials
2022-04-12 14:29:29 -07:00
Frank Hassanabad
4ff0a6e0af
Improved API documentation for exception lists (#129828)
## Summary

Improves the API documentation for exception lists

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials
2022-04-11 13:32:50 -06:00
Madison Caldwell
11bba0a04b
[Security Solution] Consider exceptions when loading threshold alert timelines (#128495)
* Add exceptions to threshold timeline

* Tests and error handling

* Fix unit tests

* Add alias for exceptions filter

* Fix tests

* Type fixes

Co-authored-by: Marshall Main <marshall.main@elastic.co>
2022-03-29 15:09:55 -04:00
David Sánchez
a07c47c652
Set filter to undefined when it's empty on findExceptionLists method (#128455)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-29 12:44:31 +02:00
David Sánchez
968f350989
Create generic get filter method to be used with an array of list id's (#127983)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-03-24 08:23:21 +01:00
Ashokaditya
0d0ff4e749
[Security Solution][Endpoint] Update warning text for event filter matches operator (#127958)
* Update warning text for event filter matches operator when file path has wildcards

fixes elastic/security-team/issues/3199

* update text

review changes
2022-03-17 13:10:28 -07:00
Ashokaditya
9d53810791
[Security Solution][Endpoint] Adds matches wildcard operator for file.path.text field for Event Filters (#125202)
* labels for wildcard path entries

fixes elastic/security-team/issues/2525

* consistent naming and add missing tests

refs elastic/kibana/pull/120679

* add autocompletion for wildcard

fixes elastic/security-team/issues/2525

* ensure event filter artifacts have correct wildcard type for process.name entry

fixes elastic/security-team/issues/2525
fixes elastic/security-team/issues/2723

* set warning for input values

fixes elastic/security-team/issues/2525

* lift path validations to packages

fixes elastic/security-team/issues/2525

* Add more tests

fixes elastic/security-team/issues/2525

* Add wildcards to event filter generator

* fix merge i18n check

* Remove not match/excluded operator for now

review changes

* add mixed entries for wildcard

review changes

* comparison typo

refs 06c868b6d1

* fix vulnerable regex

review changes

* ignore empty space on input

review changes

* update component

review changes

* use const enum

review changes

* update type imports to use ConditionEntryField, OperatingSystem, TrustedAppEntryTypes
2022-03-02 11:55:58 -07:00
Davis Plumlee
2aafd3be99
[Security Solution] Exceptions Flyout follow-up (#125159) 2022-02-23 18:44:45 -05:00
Yara Tercero
f894d8673b
[Security Solution][Lists] - Fix exception list with comments import bug (#124909)
### Summary

Addresses https://github.com/elastic/kibana/issues/124742

#### Issue TLDR
Import of rules that reference exception items with comments fail. Failure message states that comments cannot include `created_at`, `created_by`, `id`.
2022-02-16 08:20:17 -07:00
Frank Hassanabad
81c5fbf538
[Security Solutions] Exposes the search_after and point in time (pit) from saved objects to exception lists (#125182)
## Summary

Exposes the functionality of
* search_after
* point in time (pit)

From saved objects to the exception lists. This _DOES NOT_ expose these to the REST API just yet. Rather this exposes it at the API level to start with and changes code that had hard limits of 10k and other limited loops. I use the batching of 1k for this at a time as I thought that would be a decent batch guess and I see other parts of the code changed to it. It's easy to change the 1k if we find we need to throttle back more as we get feedback from others.

See this PR where `PIT` and `search_after` were first introduced: https://github.com/elastic/kibana/pull/89915
See these 2 issues where we should be using more paging and PIT (Point in Time) with search_after: https://github.com/elastic/kibana/issues/93770 https://github.com/elastic/kibana/issues/103944

The new methods added to the `exception_list_client.ts` client class are:
* openPointInTime
* closePointInTime
* findExceptionListItemPointInTimeFinder
* findExceptionListPointInTimeFinder
* findExceptionListsItemPointInTimeFinder
* findValueListExceptionListItemsPointInTimeFinder

The areas of functionality that have been changed:
* Exception list exports
* Deletion of lists
* Getting exception list items when generating signals

Note that currently we use our own ways of looping over the saved objects which you can see in the codebase such as this older way below which does work but had a limitation of 10k against saved objects and did not do point in time (PIT)

Older way example (deprecated):
```ts
  let page = 1;
  let ids: string[] = [];
  let foundExceptionListItems = await findExceptionListItem({
    filter: undefined,
    listId,
    namespaceType,
    page,
    perPage: PER_PAGE,
    pit: undefined,
    savedObjectsClient,
    searchAfter: undefined,
    sortField: 'tie_breaker_id',
    sortOrder: 'desc',
  });
  while (foundExceptionListItems != null && foundExceptionListItems.data.length > 0) {
    ids = [
      ...ids,
      ...foundExceptionListItems.data.map((exceptionListItem) => exceptionListItem.id),
    ];
    page += 1;
    foundExceptionListItems = await findExceptionListItem({
      filter: undefined,
      listId,
      namespaceType,
      page,
      perPage: PER_PAGE,
      pit: undefined,
      savedObjectsClient,
      searchAfter: undefined,
      sortField: 'tie_breaker_id',
      sortOrder: 'desc',
    });
  }
  return ids;
```

But now that is replaced with this newer way using PIT:
```ts
  // Stream the results from the Point In Time (PIT) finder into this array
  let ids: string[] = [];
  const executeFunctionOnStream = (response: FoundExceptionListItemSchema): void => {
    const responseIds = response.data.map((exceptionListItem) => exceptionListItem.id);
    ids = [...ids, ...responseIds];
  };

  await findExceptionListItemPointInTimeFinder({
    executeFunctionOnStream,
    filter: undefined,
    listId,
    maxSize: undefined, // NOTE: This is unbounded when it is "undefined"
    namespaceType,
    perPage: 1_000,
    savedObjectsClient,
    sortField: 'tie_breaker_id',
    sortOrder: 'desc',
  });
  return ids;
```

We also have areas of code that has perPage listed at 10k or a constant that represents 10k which this removes in most areas (but not all areas):
```ts
      const items = await client.findExceptionListsItem({
        listId: listIds,
        namespaceType: namespaceTypes,
        page: 1,
        pit: undefined,
        perPage: MAX_EXCEPTION_LIST_SIZE, // <--- Really bad to send in 10k per page at a time
        searchAfter: undefined,
        filter: [],
        sortOrder: undefined,
        sortField: undefined,
      });
```

That is now:
```ts
      // Stream the results from the Point In Time (PIT) finder into this array
      let items: ExceptionListItemSchema[] = [];
      const executeFunctionOnStream = (response: FoundExceptionListItemSchema): void => {
        items = [...items, ...response.data];
      };

      await client.findExceptionListsItemPointInTimeFinder({
        executeFunctionOnStream,
        listId: listIds,
        namespaceType: namespaceTypes,
        perPage: 1_000,
        filter: [],
        maxSize: undefined, // NOTE: This is unbounded when it is "undefined"
        sortOrder: undefined,
        sortField: undefined,
      });
```

Left over areas will be handled in separate PR's because they are in other people's code ownership areas.

### 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
2022-02-15 16:05:01 -07:00
Pierre Gayvallet
6627bd8b3a
Elasticsearch client: no longer default to using meta: true (#124488)
* Use `Client` interface instead of `KibanaClient`

* get rid of getKibanaEsClient and convertToKibanaClient

* get rid of last KibanaClient usages

* update usages and types in @kbn/securitysolution-es-utils

* fix some violations

* add sugar method around client mock

* update SO repository calls

* adapt more core usages

* export mock types

* batch 1

* batch 2

* batch 3

* batch 4

* batch 5

* batch 6

* batch 7

* batch 8

* batch 9

* security - batch 1

* security - batch 2

* security - batch 3

* last batch of initial violations

* fix resolve_time_pattern

* update generated doc

* fix /internal/index-pattern-management/preview_scripted_field endpoint

* fix monitoring's getLegacyClusterShim

* fix /api/snapshot_restore/privileges route

* fix UptimeESClient

* fix transforms/_nodes endpoint

* lint

* unit test fix - batch 1

* unit test fix - batch 2

* unit test fix - batch 3

* integration test fix - batch 1

* lint

* adapt ML client

* unit test fix - batch 4

* fix uptime test helper

* fix /api/transform/transforms/{transformId}/_update route

* fix ES client FTR test

* fix uptime unit test

* fix type errors on last unit tests

* fix RollupSearchStrategy call

* fix /internal/security/fields/{query} route

* fix GET /api/index_lifecycle_management/policies route

* fix mlClient.getDataFrameAnalytics

* fix APMEventClient

* fix security solution getBootstrapIndexExists

* fix data_enhanced's getSearchStatus

* remove unused @ts-expect-error

* fix unit tests due to latest code changes

* fix more calls in security_solution routes

* fix more calls in ml routes

* fix POST /api/index_management/component_templates route

* fix unit tests due to latest changes

* fix rule_registry's ResourceInstaller.createOrUpdateIndexTemplate

* fix more fleet client calls

* fix UA's GET cloud_backup_status route

* fix createLifecycleExecutorApiTest

* fix hasFleetServers

* fix unit tests due to latest changes

* changes due to last merge

* fix ml modelProvider.getModelsPipelines

* fix security_solution LifecycleQuery.search

* fix new CoreUsageDataService usage

* fix security solution's StatsQuery.search

* improve ml FTR assertions

* fix security_solution's EventsQuery.search

* fix EsClient type as we're keeping transport

* NITs

* clean RepositoryEsClient type

* update generated doc

* review comments

* adapt mlClient.anomalySearch signature

* remove unnecessary .then((body) => body)

* nit

* add unit tests for the client mocking functions

* fix new upgrade assistant /remote_clusters endpoint
2022-02-12 09:19:44 +01:00
Yara Tercero
dba7207787
[Security Solution][Lists] - Update exception item viewer overflow (#125145)
### Summary

Addresses #119012

- updates exception item viewer UI
2022-02-09 17:02:25 -07:00
Tiago Costa
a926a57e03
chore(NA): splits types from code on @kbn/logging (#124688)
* chore(NA): splits types from code on @kbn/test

* chore(NA): create new @kbn/test-jest-helpers

* chore(NA): move wrong files into @kbn/test

* chore(NA): remove @kbn/test/jest references

* chore(NA): splits types from code on @kbn/logging

* chore(NA): import type from new @kbn/logging-mocks pkg

* chore(NA): missing deps on bazel build files

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-02-07 13:46:50 +00:00
Paul Tavares
997988fac2
[Security Solution][Endpoint] Add Host Isolation Exceptions api validations get, find, delete, export, summary and import (#123954)
* validation for Pre GET one of host isolation exceptions.
* adjust checks for host isolation validation
* Add validation for import for all artifacts
* Validate host isolation exceptions exports
* Validate host isolation exceptions multi list find
* Validate host isolation exceptions single list find
* Validate host isolation exceptions Summary
* add FTR tests to validate authz
* Update all exception extension point handlers to use the ExceptionListClient passed in on context
* Refactored ExceptionListItemGenerator a bit and added methods to get Host Isolation exceptions
* Update handlers to immediately exit if the namespace_type is not `agnostic`
* Improved `log.info` messages in artifact and policy services
* Add `lists-summary` to Security solution `all` feature privilege (was missing)
2022-01-31 15:13:25 +01:00
Paul Tavares
80306936c1
[Lists] Add an instance of ExceptionListClient with server extension points turned off to context object provided to callbacks (#123885)
* Add an instance of ExceptionListClient with server extension points turned off to the `context` provided to callbacks
* Unit test cases to validate context
2022-01-27 15:21:42 -05:00
David Sánchez
d965ba791a
[Security Solution][Endpoint] Event filters ux adjustments for 8.1 (#123853)
* Don't show a default value '-' for emoty descriptions on artifacts list. Also removes empty spaces

* Update copy to say 'event filters' instead of 'exceptions'

* Decrease spacing between avatar and comments textbox

* Adds extra spacing between last exception builder field and the buttons group

* Reduces effect scope togle width to by dynamic depending on translations

* Makes effected policy button group persistent across different artifact forms

* Removes unused import

* Center button group for small devices
2022-01-27 15:30:49 +01:00
Ashokaditya
185570221f
[Security Solution][Endpoint] Update list api summary endpoint to use filter (#123476)
* update summary endpoint to use filters and use that for fleet event filters cards

fixes elastic/security-team/issues/2513

* update tests

fixes elastic/security-team/issues/2513

* update host isolation card to show total as the actual number of artifacts

fixes elastic/kibana/issues/121507

* fix types

missing merge updates

* use named constant for isolation exception list

review changes

* Update fleet_integration_event_filters_card.tsx

review changes

* fix the total on summary api

review suggestions

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-01-26 12:58:53 -07:00
Paul Tavares
22ee346a79
[Lists] Add server extension point for import into Exception Lists (#123655)
* add extension point for import by stream
* add extension point for import by array
* Add mocks and tests for import
* adjust tests for import to use `ExceptionListClient#importExceptionListAndItems()`
* Export the additional Extension point Types from server
2022-01-26 14:02:06 -05:00
Paul Tavares
39e6b74958
[Lists] Support for Server extension points for get (one), find, export, get summary and delete (#123635)
* Extension point for getting one exception item
* Extension point for single list `find*`
* Extension point for multi list `find*`
* extension point for export exceptions list
* extension point for get summary
* extension point for Delete exception item
2022-01-24 14:23:05 -07:00
Paul Tavares
a3181a5338
[Security Solution][Lists] Add API level validation for Trusted Application via Lists Plugin extension points (#122454)
## Lists Plugin changes:

- Modified ExceptionListClient to accept an optional KibanaRequest when instantiating a new instance of the class
- Changes the extension points callback argument structure to an object having context and data. Context provides to the callbacks the HTTP request so that additional validation can be performed (ex. Authz to certain features)
- ExtensionPointStorageClient#pipeRun() will now throw if an extension point callback also throws an error (instead of logging it and continuing on with callback execution)
- ErrorWithStatusCode was export'ed out of the server (as ListsErrorWithStatusCode) and available for use by dependent plugins

## Security Solution Plugin (endpoint) changes:

- Added new getEndpointAuthz(request) and getExceptionListsClient() methods to EndpointAppContextService
- Added new server lists integration modules. Registers extension points with the Lists plugin for create and update of exception items. Currently validates only Trusted Apps
- Added exception item artifact validators:
    - a BaseValidator with several generic and reusable methods that can be applied to any artifact
    - a TrustedAppValidator to specifically validate Trusted Applications
- Refactor:
    - moved EndpointFleetServices to its own folder and also renamed it to include the word Factory (will help in the future if we create server-side service clients for working with Endpoint Policies)
    - Created common Artifact utilities and const's for working with ExceptionListItemSchema items
2022-01-20 12:16:10 -05:00
Yara Tercero
fc64d172e7
[Security Solution][Exceptions] - Update exceptions tab privileges checks (#122902)
### Summary

Addresses #122227.
2022-01-18 12:49:57 -08:00
Paul Tavares
c5499186ea
[Lists] Lists plugin support for Server side extension points (#121324)
* Lists plugin framework for registering extension points
* Support for two extension points for Exceptions List
* `ExceptionListClient` changed to executed extension points
* Security Solution: Change security solution `getExceptionListClient()` to use the Lists plugin factory
2022-01-05 15:22:35 -07:00
Mikhail Shustov
38feafad72
Update ES client to canary.37 (#119791)
* upgrade es client to canary 37

* fix error in core

* mute error in test/

* mute incompatible errors

* unskip request_entity_too_large_exception test

* commit autofix

* unskip batch_size_bytes_exceeds_es_content_length test

* fix errors in Core code

* fix or mute errors in data plugin

* fix data_view_management

* fix error index_management

* fix x-pack/test errors

* fix watcher

* fix event_log

* fix data_enhanced

* fix uptime

* fix triggers_actions_ui

* fix transform

* fix reporting

* fix rule_registry

* fix timeline

* fix task_manager

* fix security_solution

* fix rule_registry

* fix fleet

* fix index_management

* fix lens

* fix maps

* fix ml

* fix observability

* bump to canary 8.1-2

* fix error in packages

* fix errors in core

* fix errors in data

* fix errors in discover

* fix some discover tests

* fix errors in telemetry

* fix alerting

* fix errors in apm

* fix errors in event_log

* fix errors in fleet

* fix errors in infra

* fix errors in lists

* mute errors in maps

* fix errors in ml

* fix errors in osquery

* fix errors in security_solution

* fix errors in stack_alerts

* fix errors in task_manager

* fix errors in timelines

* fix errors in transform

* fix errors in watcher

* fix errors in tests

* update docs

* adjust fleet code

* fix problem in fleet

* remove outdated _type from data plugin tests

* fix packages tests

* update type

* fix tests part 2

* Adds product header back to elasticsearch

* Updates API docs

* Fix Discover tests

* update alerting typings

* Fix type errors

* Import Sort type

* Update x-pack/plugins/security_solution/common/endpoint/data_loaders/index_fleet_server.ts

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>

* Remove double negation

* Fix snapshot conflict issues after merge from "main"

Co-authored-by: Christiane Heiligers <christiane.heiligers@elastic.co>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
2021-12-24 14:43:53 +01:00
Yara Tercero
4b47ac2728
[Security Solution][Lists][Platform] - Fixes import rules modal to work with latest added exceptions import functionality (#120837)
## Summary

Without the added overwrite support for exceptions separate from rules, unexpected user behavior experienced. This PR does the following:
- Updates the import rules modal text to account for exceptions
- Updates the import rules modal logic to account for the exceptions overwrite option
  -  Users can now select to overwrite rules, exceptions or both
- Updates the backend logic in the rules import route to batch checking if the exception lists referenced by the rules trying to be imported exist. If the list does not exist, it removes the reference before trying to import the rule. Previously, this check was being done one by one for each rule. 
  - Added effort to try to speed up the import after added exceptions logic from original PR slowed down functionality
2021-12-22 13:04:36 -07:00
Matthew Kime
d4fdd35543
[dataViews] no more IndexPatternBase, IndexPatternFieldBase (#121836)
* remove IndexPatternFieldBase and IndexPatternBase references
2021-12-22 08:46:21 -06:00
Esteban Beltran
b6753241ed
[Security Solution] host isolation exceptions listing under policy integration details tab (#120361) 2021-12-13 08:46:42 -07:00