Commit graph

281 commits

Author SHA1 Message Date
Kibana Machine
0be4e96091
[8.12] [Exceptions][Value Lists] Add file type and size constraints to value list uploads (#8507) (#176074) (#176375)
# Backport

This will backport the following commits from `main` to `8.12`:
- [[Exceptions][Value Lists] Add file type and size constraints to value
list uploads (#8507)
(#176074)](https://github.com/elastic/kibana/pull/176074)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"ievgen.sorokopud@elastic.co"},"sourceCommit":{"committedDate":"2024-02-07T09:22:19Z","message":"[Exceptions][Value
Lists] Add file type and size constraints to value list uploads (#8507)
(#176074)\n\n## Summary\r\n\r\nAddresses
https://github.com/elastic/security-team/issues/8507\r\n\r\nWith these
changes we address the issue where users can upload any file\r\nto be
imported as a value list.\r\n\r\nThe restrictions are:\r\n* Users should
be limited to uploading .txt or .csv. All other file\r\ntypes should
return a 415.\r\n* Users should be limited to uploading files of 9K
bytes size. Files\r\nlarger than that should return a 413.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ESS
97\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5019)\r\n-
[Serverless
97\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5020)","sha":"c38410affe0bccd61884b58a41b7bda48c78d86f","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
SecuritySolution","Team:Detection Engine","8.13
candidate","v8.13.0","v8.12.2","v7.17.19"],"title":"[Exceptions][Value
Lists] Add file type and size constraints to value list uploads
(#8507)","number":176074,"url":"https://github.com/elastic/kibana/pull/176074","mergeCommit":{"message":"[Exceptions][Value
Lists] Add file type and size constraints to value list uploads (#8507)
(#176074)\n\n## Summary\r\n\r\nAddresses
https://github.com/elastic/security-team/issues/8507\r\n\r\nWith these
changes we address the issue where users can upload any file\r\nto be
imported as a value list.\r\n\r\nThe restrictions are:\r\n* Users should
be limited to uploading .txt or .csv. All other file\r\ntypes should
return a 415.\r\n* Users should be limited to uploading files of 9K
bytes size. Files\r\nlarger than that should return a 413.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ESS
97\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5019)\r\n-
[Serverless
97\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5020)","sha":"c38410affe0bccd61884b58a41b7bda48c78d86f"}},"sourceBranch":"main","suggestedTargetBranches":["8.12","7.17"],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/176074","number":176074,"mergeCommit":{"message":"[Exceptions][Value
Lists] Add file type and size constraints to value list uploads (#8507)
(#176074)\n\n## Summary\r\n\r\nAddresses
https://github.com/elastic/security-team/issues/8507\r\n\r\nWith these
changes we address the issue where users can upload any file\r\nto be
imported as a value list.\r\n\r\nThe restrictions are:\r\n* Users should
be limited to uploading .txt or .csv. All other file\r\ntypes should
return a 415.\r\n* Users should be limited to uploading files of 9K
bytes size. Files\r\nlarger than that should return a 413.\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ESS
97\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5019)\r\n-
[Serverless
97\r\ntimes](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5020)","sha":"c38410affe0bccd61884b58a41b7bda48c78d86f"}},{"branch":"8.12","label":"v8.12.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"7.17","label":"v7.17.19","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ievgen Sorokopud <ievgen.sorokopud@elastic.co>
2024-02-07 03:48:18 -07:00
Gergő Ábrahám
44d7c0ae95
[EDR Workflows] Add matches capabilities to Endpoint Exception creation (#166002)
## Summary

This PR adds `matches` (`wildcard include`) and `does not match`
(`wildcard exclude`) to fields which support them when creating an
Endpoint exception.

For backwards compatibility with Endpoints < 8.2.0, Manifest Manager
adds the following entry to Endpoint Exceptions containing _only_
wildcards:
```json
{
  "field": "event.module",
  "operator": "included",
  "type": "exact_cased",
  "value": "endpoint"
}
```

> [!Note]
> Warnings for wrongly formatted wildcards don't seem to work correctly
at the moment. #170495 will bring some changes in the related functions,
so this PR is waiting on that to be merged.


<img width="1465" alt="image"
src="db04fe0b-4cb3-4cba-a6d7-622a2239f059">

## Sample manifests
### Linux
⚠️ On Linux, the type is always `wildcard_cased`, see the following
comment for details:
https://github.com/elastic/kibana/pull/120349#issuecomment-989963682
```json
{
  "entries": [
    {
      "type": "simple",
      "entries": [
        {
          "field": "file.path",
          "operator": "included",
          "type": "wildcard_cased",
          "value": "*/test/*"
        },
        {
          "field": "event.module",
          "operator": "included",
          "type": "exact_cased",
          "value": "endpoint"
        }
      ]
    }
  ]
}
```

### Windows
```json
{
  "entries": [
    {
      "type": "simple",
      "entries": [
        {
          "field": "file.path",
          "operator": "included",
          "type": "wildcard_caseless",
          "value": "*/test/*"
        },
        {
          "field": "event.module",
          "operator": "included",
          "type": "exact_cased",
          "value": "endpoint"
        }
      ]
    }
  ]
}
```

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2023-12-05 01:59:45 -07:00
Wafaa Nasr
a4ed14bec8
[Security Solution][API testing] Move and restructures Lists APIS (#171992)
## Summary

Following the initial work in this
https://github.com/elastic/kibana/pull/166755
- Addresses part of https://github.com/elastic/kibana/issues/151902 for
List APIs tests
- Added a new folder under the `security_solution_api_integration`
called `lists_and_exception_lists` to hold the lists and exception lists
tests, and split the `List` APIs into two groups since the execution
time in Serverless was close to 30 mins
- Modified the
[x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.mock.ts](https://github.com/elastic/kibana/pull/171992/files#diff-4e3545fdeb8c8d9467cfa1c4aa88194e189193a92fa6f1cf5f859b1ef1beb45c),
[x-pack/plugins/lists/common/schemas/response/exception_list_schema.mock.ts](https://github.com/elastic/kibana/pull/171992/files#diff-c3cc18faf07aab86e307185d41599c3596a3f8b360d3e4829591afa148283238)
,
[x-pack/plugins/lists/common/schemas/response/list_item_schema.mock.ts](https://github.com/elastic/kibana/pull/171992/files#diff-608579ca5e65da74f41319a58d81ab12cc3d79d389b087806c7b74949fbc6cc3),
[x-pack/plugins/lists/common/schemas/response/list_schema.mock.ts](https://github.com/elastic/kibana/pull/171992/files#diff-efc64eb35937a8da28fc982c527253c0923650ae4163d4bbc203d3ebc2949835)
to accept `elastic user` input because it changes in ESS and Serverless
- Deleted the `x-pack/test/lists_api_integration` folder
- Moved the utility files associated with Basic tests to the new
directory `security_solution_api_integration`. Files not actively used
in the previous folder were moved, while duplicate files remained in
their original positions.
- Updated the below files imports from the old `lists_api_integration`
folder to the new `lists_and_exception_lists`

    ```
      lists_api_integration/  
        - exceptions/operators_data_types/date_numeric_types/date.ts
        - exceptions/operators_data_types/date_numeric_types/double.ts
        - exceptions/operators_data_types/date_numeric_types/float.ts 
        - exceptions/operators_data_types/date_numeric_types/integer.ts
        - exceptions/operators_data_types/ips/ip.ts
        - exceptions/operators_data_types/ips/ip_array.ts
        - exceptions/operators_data_types/keyword/keyword.ts
        - exceptions/operators_data_types/keyword/keyword_array.ts
        - exceptions/operators_data_types/long/long.ts
        - exceptions/operators_data_types/text/text.ts
        - exceptions/operators_data_types/text/text_array.ts
        - exceptions/workflows/create_endpoint_exceptions.ts
        - exceptions/workflows/create_rule_exceptions.ts
        - exceptions/workflows/find_rule_exception_references.ts
        - exceptions/workflows/role_based_add_edit_comments.ts
        - exceptions/workflows/role_based_rule_exceptions_workflows.ts
        - exceptions/workflows/rule_exception_synchronizations.ts
        - rule_execution_logic/execution_logic/esql.ts
        - rule_execution_logic/execution_logic/machine_learning.ts
        - rule_execution_logic/execution_logic/new_terms.ts
        - rule_execution_logic/execution_logic/query.ts
        - telemetry/task_based/all_types.ts
        - telemetry/task_based/detection_rules.ts
        - telemetry/task_based/security_lists.ts
     ```
     ```
These files should be moved too soon to the new `lists_api_integration`
        detection_engine_api_integration/security_and_spaces/group10
            - import_export_rules.ts 
            - import_rules.ts
            - perform_bulk_actions   
     ```

- Updated the below files imports to the
`ftr_provider_context_with_spaces.d.ts`
` - risk_engine/risk_scoring_task/task_execution_nondefault_spaces.ts`

- The QA phase concluded with all tests passing successfully. 🟢  

- Updated the CodeOwner file for the newly moved tests

- Add a new util file to `deleteAllExceptions` under the old
`detection_engine_api` folder since the Rule management related-tests
are still need to be moved over to the new folder

- Old/new group details, decisions, and execution time are mentioned in
this
[document](https://docs.google.com/document/d/1CRFfDWMzw3ob03euWIvT4-IoiLXjoiPWI8mTBqP4Zks/edit)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-28 16:40:09 +01:00
Candace Park
69b2cd2b38
[Security Solution][Admin][Policy][Event Filters] Update event filters creation to include more match options (#170495)
## Summary

- [x] Adds a `matches` and `does not match` operator option to all
eligible event filter creation entry fields that support matches
- [x] Updates the existing warning to only appear if that is the
`file.path.text` entry field is selected
- [x] Generalize the warning for wildcard usage if operator is matches
and a wildcard is used in the value
- [x] Updates wildcard warning tooltip to include "Creating event
filters with both `matches` and `does not match` operators may
significantly decrease performance."
- [x] Unit tests

# Screenshots

![efmatch](9efad4f7-e49f-4542-9052-08e578ea4f6b)

Warning about wildcards affecting Endpoint performance
<img width="1219" alt="image"
src="5bceec10-6387-44d5-bc7f-76de1816ce46">


# Event Filter & Artifact 
**LINUX**

![image](4bba92ff-965a-47d9-b2e8-0a94b322acd8)
<details open>
<summary> linux artifact entry </summary>
<p>

```
{
  "entries": [
    {
      "type": "simple",
      "entries": [
        {
          "field": "event.category",
          "operator": "included",
          "type": "wildcard_cased",
          "value": "network"
        },
        {
          "field": "process.name",
          "operator": "included",
          "type": "exact_cased",
          "value": "network"
        }
      ]
    }
  ]
}
```
</p>
</details open>

**WINDOWS**

![image](e44020c7-0701-482a-bb74-6a1150b5552c)
<details open>
<summary> windows artifact entry </summary>
<p>

```
{
  "entries": [
    {
      "type": "simple",
      "entries": [
        {
          "field": "event.kind",
          "operator": "included",
          "type": "wildcard_cased",
          "value": "event"
        },
        {
          "field": "process.name",
          "operator": "included",
          "type": "exact_caseless",
          "value": "event"
        },
        {
          "field": "event.category",
          "operator": "included",
          "type": "wildcard_cased",
          "value": "authentication"
        },
        {
          "field": "process.name",
          "operator": "included",
          "type": "exact_caseless",
          "value": "authentication"
        }
      ]
    }
  ]
}
```
</p>
</details open>

**MAC**

![image](9c1782f8-2386-4cf0-8236-fa613bb6f9ee)

<details open>
<summary> mac artifact entry</summary>
<p>

```
{
  "entries": [
    {
      "type": "simple",
      "entries": [
        {
          "field": "event.id",
          "operator": "included",
          "type": "wildcard_cased",
          "value": "071e1cfc-8333-4c6c-965a-00678c7b1d61"
        },
        {
          "field": "process.name",
          "operator": "included",
          "type": "exact_caseless",
          "value": "071e1cfc-8333-4c6c-965a-00678c7b1d61"
        },
        {
          "field": "file.path",
          "operator": "included",
          "type": "wildcard_cased",
          "value": "C:\\My Documents\\business\\January\\processName"
        },
        {
          "field": "process.name",
          "operator": "included",
          "type": "exact_caseless",
          "value": "C:\\My Documents\\business\\January\\processName"
        }
      ]
    }
  ]
}
```
</p>
</details open>
2023-11-27 00:39:44 -07:00
Alejandro Fernández Haro
fd09c26d15
async-import plugins in the server side (#170856)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-15 00:55:56 -07:00
Mark Hopkin
71f1dc7bd5
[Entity Analytics] Remove nested message.message property from risk engine API error responses (#170645)
## Summary

**TLDR:** change risk engine API error response bodies from `{ message :
{ message : 'blah', full_error : 'something'}}` to `{ message : 'blah',
full_error : 'something'}`

I noticed a UI bug when the risk engine "init" call returns an error,
this was because the UI was expecting `error.message` to be a string but
it was an object with another nested message property.

This lead me to investigate why this was the case, turns out our error
wrapper was always putting things under a `message` key which in our
case we do not want.

### UI crash before

```
Uncaught Error: Objects are not valid as a React child (found: object with keys {message}). If you meant to render a collection of children, use an array instead.
```
<img width="806" alt="Screenshot 2023-11-06 at 14 02 17"
src="25066a14-dabf-46a0-9741-a81f886f64fb">


### Correct error display after
<img width="1171" alt="Screenshot 2023-11-06 at 13 51 04"
src="af8db564-a119-4fc8-9821-bafcfe19b421">


### 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
2023-11-08 15:38:21 +00:00
Marta Bondyra
3a784106df
[testing] replace testing-library/dom package with testing-library/react (#170594)
## Summary

Removes `testing-library/dom` from dependencies. As all the utilities
from`dom` are available already in `testing-library/react`, there's no
need to have both `dom` and `react` libraries available in our
package.json.

Following the [@testing-library/react
documentation:](https://testing-library.com/docs/react-testing-library/intro)

> [React Testing
Library](https://github.com/testing-library/react-testing-library)
builds on top of DOM Testing Library by adding APIs for working with
React components.

Let's just import everything from `testing-library/react`, this way we
won't need to worry about inconsistencies between `testing-library/dom`
we have in our `package.json` and the one that is
`testing-library/react` dependency.
2023-11-08 15:53:48 +01:00
David Sánchez
6a0fa94cbb
[Security Solution][Endpoint] Adapt exception list api calls to versioned router (#165658)
## Summary

- Adds version to http calls for endpoint exceptions at Lists API.
- Fixes unit test.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-09-07 17:35:15 +02:00
Marshall Main
21879be883
[Security Solution] Migrate lists plugin API to versioned router (#165160)
Closes https://github.com/elastic/security-team/issues/7176
2023-08-31 07:48:01 -07:00
Vitalii Dmyterko
116c4b809e
[Security Solution][Detection engine] refactors lists legacy templates/ILM API calls in Serverless env. (#164844)
## Summary

- moved deletion of legacy index template inside to
`migrateListIndexToDataStream` and `migrateListToDataStream`. That would
allow us not to rely on `410` error to tell if we are in Serverless
environment and `_template` API is blocked. Migrate to DS function is
called only in Stateful environment, as lists indices do not exist in
Serverless
- deletion of legacy index template during migration has also other
benefit: it will be called eventually for every instance of Kibana, and
be more efficient then just calling it during index creation
2023-08-30 10:25:37 +01:00
Tiago Costa
2d652e1313
chore(NA): upgrade typescript into v4.7.4 (#162738)
This PR bumps the Typescript version used on Kibana into v4.7.4.

During the upgrade I got the impression the majority of the failures
were too specific to the codebase so instead of making assumptions I
choose to marked a lot of them with `@ts-expect-error` and let each team
decide how to handle it.

Next you can find a list of files with those comments and the teams to
who they belong to. I would appreciate the collaboration from each team
on fixing those. I'm not opposed on fixing those in subsequent PRs after
this one have been merged, just wanted to elaborate that list for a good
follow up:

@elastic/kibana-core 
- [x]
[packages/core/http/core-http-router-server-internal/src/request.ts](https://github.com/elastic/kibana/pull/162738/files#diff-c1f4a8c013c6ff9c5170803322414cb002f70331b23e45c55f075258c678410a)

@elastic/kibana-data-discovery  
- [x]
[src/plugins/discover/public/components/doc_table/components/table_row.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-9106b254a57e73fc6f0b2e01f9aff1abbd26f1a0999e6fa998f1b45d3013038f)

@elastic/kibana-visualizations   
- [x]
[src/plugins/expressions/common/execution/execution.ts](https://github.com/elastic/kibana/pull/162738/files#diff-47bf3af7472c08ede90f86575ee7db4b8a2c949b1fb61400410ed16a8d819667)
- [x]
[src/plugins/expressions/common/expression_functions/expression_function_parameter.ts](https://github.com/elastic/kibana/pull/162738/files#diff-3bcaa3c50f2297ff990c7ac83a1c2d36a79e6706a09082c3c48a911713afe950)
- [x]
[src/plugins/vis_types/heatmap/public/editor/components/labels_panel.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-345db24d53f4158414480b890fa43d1f8a454b67313de79602fda081279cbc4f)
- [x]
[src/plugins/vis_types/xy/public/editor/components/options/metrics_axes/label_options.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-1c346b41cf025ff4f4e07b6d6dcdd1451cbaa758f9a9e8c72a9801d3fbbdfda2)

@elastic/kibana-presentation 
- [x]
[x-pack/plugins/canvas/public/components/workpad_page/workpad_interactive_page/event_handlers.ts](https://github.com/elastic/kibana/pull/162738/files#diff-56858ed9be77830ab218eab1960337240926609c5a1593b3960b35660ef81359)

@elastic/response-ops  
- [x]
[x-pack/plugins/cases/public/components/create/form.test.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-c5c415f1f56ca986f4bb59e65490b5e0fc77a86092240c0c1a26c141dba07818)
- [x]
[x-pack/plugins/cases/public/components/markdown_editor/editable_markdown_renderer.test.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-ab038916f6fed59e18b0a72ce8e823e88d115afdb2704010d0fa8656b66702df)
- [x]
[x-pack/plugins/rule_registry/server/alert_data_client/browser_fields/index.ts](https://github.com/elastic/kibana/pull/162738/files#diff-3f91aa93f7e6514c0479a37a76d6e9a53646d4eaf5dcd0db64437eadf1eee6b6)
- [x]
[x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-fbf1d6d0104c11c3f3690d29edf06000b5a63a858bb22b7d04d1f96a45133b07)
- [x]
[x-pack/plugins/triggers_actions_ui/common/experimental_features.ts](https://github.com/elastic/kibana/pull/162738/files#diff-8e2ca70700895b17125532779945a1d0ab9076b4d4db304c065b47f82b6628a5)
- [x]
[x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-8e2ca70700895b17125532779945a1d0ab9076b4d4db304c065b47f82b6628a5)

@elastic/fleet 
- [x]
[x-pack/plugins/fleet/common/experimental_features.ts](https://github.com/elastic/kibana/pull/162738/files#diff-a852b157b5ff1d6dbf321ea8a25f0020d8f88cd458378cc9de8ef25ce28c9414)
- [x]
[x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.test.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-9eea0be0f9341dd6369720ce7b11bff69dda51230337ebbae921f6abde187bd2)
- [x]
[x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/list_page/index.test.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-844d5f9707b739d25f2b73bd34c45c21e2e5d573b3238c13130a0d1c1db092dc)
- [x]
[x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.test.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-f88d92abbc549ddc95d693bf3a3bc9752613cf74f1e859a01ca61d572e031b11)
- [x]
[x-pack/plugins/fleet/server/mocks/index.ts](https://github.com/elastic/kibana/pull/162738/files#diff-d3f3e436b158ac2d877b7be9d57642855f89b0149cc28735811443da45bb079f)

@elastic/security-detection-engine
- [x]
[x-pack/plugins/lists/server/services/extension_points/extension_point_storage_client.ts](https://github.com/elastic/kibana/pull/162738/files#diff-dbbf5a8541e06fd977c66e44d9ef59f738d953bdfda679ac838e098742c92f50)
- [x]
[x-pack/plugins/lists/server/services/extension_points/types.ts](https://github.com/elastic/kibana/pull/162738/files#diff-31186826bea8fdb286a25878fa06eeacad8f7a6c384d617fed905d4625821eef)

@elastic/security-defend-workflows @gergoabraham 
- [x]
[x-pack/plugins/security_solution/public/detection_engine/rule_response_actions/osquery/osquery_response_action.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-049eeedef2a403ade7c636418e17fc9a3ffc7030eec2f3e013f459721c076470)

@elastic/infra-monitoring-ui 
- [x]
[x-pack/plugins/monitoring/public/application/pages/apm/overview.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-4ab4fa150247d8f522741ae5ea1ea71c102c72f5439410ea869ec1c9dc9878ad)
- [x]
[x-pack/plugins/monitoring/public/application/pages/enterprise_search/overview.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-285a67d9ec93651206608d308e5d1d20ccc98ccccb9bcbf3ee31fe35c1844b42)

@elastic/kibana-security 
- [x]
[x-pack/plugins/security/server/authentication/authenticator.ts](https://github.com/elastic/kibana/pull/162738/files#diff-bd369002fdfd0986f1ce3bf16263fb8b765e01a86832ccf5b4e521811d502038)
- [x]
[x-pack/plugins/security/server/session_management/session_index.ts](https://github.com/elastic/kibana/pull/162738/files#diff-10b76eb52a0e17564ad864def8270bb84a4eb87eb35851309bc36601086cbcd7)

@elastic/security-threat-hunting-explore @gergoabraham 
- [x]
[x-pack/plugins/security_solution/public/common/mock/endpoint/app_context_render.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-7f130bdc9a954330d188aa25324910cf2f72baf76d1329bd36584f5bb153856b)

@elastic/security-solution @gergoabraham 
- [x]
[x-pack/plugins/security_solution/public/management/components/page_overlay/page_overlay.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-e68a2799df17238257a86ce965369c525be901f6f882e518bde9e8c9bd7cd2c8)
- [x]
[x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx](https://github.com/elastic/kibana/pull/162738/files#diff-edc756f655792f7dcaca0c707f35c6c022981be1873712f460ccb1d611e42568)
- [x]
[x-pack/plugins/security_solution/tsconfig.json](https://github.com/elastic/kibana/pull/162738/files#diff-844dde79a96b9e6c2bfdf21f8c80feb8b687577e21326da6bd15c6b95d8ec918)

@elastic/uptime 
- [x]
[x-pack/plugins/uptime/server/legacy_uptime/lib/alerts/duration_anomaly.test.ts](https://github.com/elastic/kibana/pull/162738/files#diff-6c7b63ce65aa17a2fe3219e1747ae051be88fb02edbe2f198ad6fd418a2bcc57)

@elastic/security-detections-response-alerts @gergoabraham 
- [x]
[x-pack/test/detection_engine_api_integration/security_and_spaces/group8/exception_operators_data_types/keyword_array.ts](https://github.com/elastic/kibana/pull/162738/files#diff-472ba2c7fe43448c8a4d04406703f755f71f6e60146bb2f090b4ca0f19ad0a0f)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Dokolin <dokmic@gmail.com>
Co-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>
Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
Co-authored-by: Devon Thomson <devon.thomson@elastic.co>
2023-08-24 17:27:13 +01:00
Vitalii Dmyterko
7ee14bc1ae
[Security Solution][Detection Engine] fixes 410 error on index legacy template call (#164682)
## Summary

`_template` API is [blocked on
Serverless](https://docs.google.com/spreadsheets/d/16173D0-FP1UcSHKmZmhB7TbF_TyKtXrdiNWMjq5ASdM/edit#gid=0),
causing 410 error when creating list index.

This `_template` API is used to check existing legacy index templates
for `lists` and `items` indices

So, in this PR, we won't be throwing error if any of `_template` APIs
called in Serverless environement and return `410` code error(Gone)
2023-08-24 13:01:43 +01:00
Vitalii Dmyterko
505d8265c8
[Security Solution][Detection Engine] move lists to data stream (#162508)
## Summary

- addresses https://github.com/elastic/security-team/issues/7198
- moves list/items indices to data stream
  - adds `@timestamp` mapping to indices mappings
- migrate to data stream if indices already exist(for customers < 8.11)
or create data stream(for customers 8.11+ or serverless)
- adds
[DLM](https://www.elastic.co/guide/en/elasticsearch/reference/8.9/data-streams-put-lifecycle.html)
to index templates
- replaces update/delete queries with update_by_query/delete_by_query
which supported in data streams
  - fixes existing issues with update/patch APIs for lists/items
    - update/patch for lists didn't save `version` parameter in ES
- update and patch APIs for lists/items were identical, i.e. for both
routes was called the same `update` method w/o any changes

<details>

<summary>Technical detail on moving API to
(update/delete)_by_query</summary>


`update_by_query`, `delete_by_query` do not support refresh=wait_for,
[only false/true
values](https://www.elastic.co/guide/en/elasticsearch/reference/8.9/docs-update-by-query.html#_refreshing_shards_2).
Which might break some of the use cases on UI(when list is removed, we
refetch all lists. Deleted list will be returned for some time. [Default
refresh time is
1s](https://www.elastic.co/guide/en/elasticsearch/reference/8.9/docs-refresh.html)).
So, we retry refetching deleted/updated document before finishing
request, to return reindexed document

`update_by_query` does not support OCC [as update
API](https://www.elastic.co/guide/en/elasticsearch/reference/8.9/optimistic-concurrency-control.html).
Which is supported in both
[list](https://www.elastic.co/guide/en/security/current/lists-api-update-container.html)/[list
item
](https://www.elastic.co/guide/en/security/current/lists-api-update-item.html)updates
through _version parameter.
_version is base64 encoded "_seq_no", "_primary_term" props used for OCC

So, to keep it without breaking changes: implemented check for version
conflict within update method
</details>

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-23 19:42:57 +01:00
Kevin Logan
1a3aefe6ec
[Security Solution][EDR Workflows] Remove the filter on Endpoint Exceptions and Event Filters creation to allow more user flexibility (#162193)
## Summary

This PR removes the predefined sets of Exceptions for Endpoint
Exceptions and Event Filters. This comes after user feedback that we are
too restrictive in which fields we allow users to write Exceptions or
Event Filters for. This will give users much more freedom in creating
Exceptions and Event Filters.

The `filterIndexPatterns()` function is entirely removed as Endpoint
Exceptions and Event Filters were the only features using it. Following
that, the props for many downstream components was updated to remove
reference to this filtering function.

Further, in working the the Endpoint and Protections teams, there are no
concerns with removing these filters from an Endpoint perspective and
the added flexibility for users is welcome.

User now has access to all the fields that we pull back from the index
mappings.

<img width="1728" alt="image"
src="8ccb6b33-e7e7-42d6-a9a9-68e65c3be57d">

<img width="1728" alt="image"
src="35f26431-07b2-4995-932c-6c5023ced7fd">

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-03 12:53:17 -04:00
Wafaa Nasr
a2275dd346
[Security Solution] [Detection Engine] Fix exception comment flakiness (#162807)
## Summary

- Addresses https://github.com/elastic/kibana/issues/162565 
- Converting the `Comments` related Cypress test to a FTR test according
to these
[observations](https://github.com/elastic/kibana/issues/162565#issuecomment-1653410937)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-01 14:58:40 +01:00
Marshall Main
5da645acee
[Security Solution] Move lists plugin API schemas to /common/api (#162489)
Closes https://github.com/elastic/security-team/issues/7102

Establishes the `/common/api` folder structure for the lists plugin.
This PR simply imports and re-exports the schemas from the schema
package since the schemas are all already separated from the `server`
code. Future PRs will replace these re-exports with schemas generated
from OpenAPI specs.
2023-07-27 15:22:00 -07:00
Alex Szabo
8cf68dc6ba
[Ops] Bump Node.js to version 18 (#160289)
## Summary

Bumps node.js to 18.17.0 (replacement for PR #144012 which was later
reverted)

As a result, these categorical additions were needed: 
- `node` evocations will need the `--openssl-legacy-provider` flag,
wherever it would use certain crypto functionalities
- tests required updating of the expected HTTPS Agent call arguments,
`noDelay` seems to be a default
 - `window.[NAME]` fields cannot be written directly
 - some stricter typechecks

This is using our in-house built node.js 18 versions through the URLs
the proxy-cache. (built with
https://github.com/elastic/kibana-custom-nodejs-builds/pull/4)

These urls are served from a bucket, where the RHEL7/Centos7 compatible
node distributables are. (see:
https://github.com/elastic/kibana-ci-proxy-cache/pull/7)

Further todos: 
 - [x] check docs wording and consistency
 - [ ] update the dependency report
 - [x] explain custom builds in documentation
 - [x] node_sass prebuilts

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Thomas Watson <w@tson.dk>
2023-07-27 14:12:48 +02:00
Wafaa Nasr
fdd709b025
[Security Solution] [Exceptions] Fix Exception Auto-populate from Alert actions (#159908)
## Summary

- Addresses  https://github.com/elastic/kibana/issues/159784

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-28 12:14:19 +01:00
Ievgen Sorokopud
31b34771c5
[Security Solution] Improve rules exception flyout opening for the indices with huge amount of fields (#159216)
## Summary

Original ticket:
[#158751](https://github.com/elastic/kibana/issues/158751)

These changes improve the rule's exceptions flyout opening experience.
We had a few complaints that it is very slow to open it and sometimes it
throws an exception about the limited response size.

To fix this, we decided to load extended field's data (conflicts and
unmapped info) only when user selects some field instead of fetching
this data for all fields on flyout opening.

## NOTES:

After these changes we gonna do next steps related to fields loading
when user creates/edits rule exceptions:
1. We will call `_fields_for_wildcard` **WITHOUT**
`include_unmapped=true` parameter to fetch all fields specs on exception
flyout loading
2. We will call `_fields_for_wildcard` **WITH** `include_unmapped=true`
for only one field when user selects it from the dropdown menu

With these changes we will improve slow exception flyout opening when
user has lots of fields which are unmapped in different indices. If for
some reason user has a lot of (thousands) conflicting fields around
indices then the loading is still might be slow as the
`_fields_for_wildcard` call will return conflicts information even
without `include_unmapped=true` parameter.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-15 05:57:15 -07:00
Georgii Gorbachev
5776e97d9c
[Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729)
## Summary

This PR replaces any mentions of
https://github.com/orgs/elastic/teams/security-solution-platform team
with https://github.com/orgs/elastic/teams/security-detection-engine
according to the recent restructure.
2023-06-14 10:39:50 -07:00
Yara Tercero
f895c5c205
[Detection Engine][Exceptions] - Fix exception item update route (#159223)
## Summary

Addresses issue 159230
2023-06-09 12:31:03 -07:00
Wafaa Nasr
005108684b
[Security Solution][Exceptions]- Increase exceptions test coverage (#152757)
## Summary

- Addresses https://github.com/elastic/security-team/issues/5947
- Adding tests to cover the yellow rows in [test
sheet](https://docs.google.com/spreadsheets/d/1Eb_317s7nkQ4axVA270Ja99PRS-NWrYZAEc-1aVuyXg/edit#gid=0)
- Organise the tests to correspond to the following
[structure](https://docs.google.com/spreadsheets/d/14DdtghpxgfEmWoc7kot4XgEva_4GDEC_uTej65MUjV8/edit?pli=1#gid=0)
- Removed the
`x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/add_exception.cy.ts`
as it was duplicated from
`x-pack/plugins/security_solution/cypress/e2e/exceptions/exceptions_management_flow/exceptions_table.cy.ts`
- Skipped the `flyout_validation` tests until resolving this
[ticket](https://github.com/elastic/kibana/issues/154994)
- Regarding `Exception-List`, `Exception-List-Item` and `Rule with
exceptions` migrations test cases are handled by most of our old `FTR`
tests as most of them deal with `Exception List Schema` which doesn't
include the new props, like the `expire_time` that was introduced in
`8.7`, so adding new tests using the new schema can be treated as
testing the new versions against the existing scenarios whereas the
existing tests for the migrations (downgrade) tests
[4a75a51](4a75a51a3e)
- Tests under `x-pack/plugins/security_solution/cypress/upgrade_e2e` are
just POCs can't be used

# New tests folder structure based on workflow

<img width="432" alt="image"
src="https://user-images.githubusercontent.com/12671903/234849016-f6f227d1-fcaf-43cb-abe3-d3fc7f9cee00.png">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-07 15:15:30 +01:00
Pierre Gayvallet
8453fe820a
Cleanup spread operators in reduce calls (#157471)
## Summary

The spread operator is costly and put pressure on GC. It should be
avoided when possible, especially in loops.

This PR adapts a lot of `reduce` calls in the codebase to remove the
usages of the diabolic spread operator, when possible.

Note: the PR is not fully exhaustive. I focused on the server-side, as
we're more directly impacted than on browser-side code regarding
performances.

## Removing `...` usages in `kittens.reduce()`

For `reduce` loops, the spread operator can usually easily be replaced:

#### - setting a value on the accum object and returning it

#### BAD
```ts
  return this.toArray().reduce(
      (acc, renderer) => ({
        ...acc,
        [renderer.name]: renderer,
      }),
      {} as Record<string, ExpressionRenderer>
    );
```

#### GOOD
```ts
  return this.toArray().reduce((acc, renderer) => {
      acc[renderer.name] = renderer;
      return acc;
    }, {} as Record<string, ExpressionRenderer>);
```


#### - assigning values to the accum object and returning it 

#### BAD
```ts
  const allAggs: Record<string, any> = fieldAggRequests.reduce(
      (aggs: Record<string, any>, fieldAggRequest: unknown | null) => {
        return fieldAggRequest ? { ...aggs, ...(fieldAggRequest as Record<string, any>) } : aggs;
      },
      {}
    );
```

#### GOOD
```ts
  const allAggs = fieldAggRequests.reduce<Record<string, any>>(
      (aggs: Record<string, any>, fieldAggRequest: unknown | null) => {
        if (fieldAggRequest) {
          Object.assign(aggs, fieldAggRequest);
        }
        return aggs;
      },
      {}
    );
```

#### - pushing items to the accum list and returning it 

#### BAD
```ts
  const charsFound = charToArray.reduce(
    (acc, char) => (value.includes(char) ? [...acc, char] : acc),
    [] as string[]
  );
```

#### GOOD
```ts
  const charsFound = charToArray.reduce((acc, char) => {
    if (value.includes(char)) {
      acc.push(char);
    }
    return acc;
  }, [] as string[]);
```

## Questions

#### Are you sure all the changes in this are strictly better for
runtime performances?

Yes, yes I am.

#### How much better?

Likely not much.

#### Are you planning on analyzing the perf gain?

Nope.

#### So why did you do it?

I got tired of seeing badly used spread operators in my team's owned
code, and I had some extra time during on-week, so I spent a few hours
adapting the usages in all our runtime/production codebase.

#### Was it fun?

Take your best guess.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-05-22 04:50:24 -07:00
Gerard Soldevila
21351df953
Split the .kibana saved objects index into multiple indices (#154888)
## Description 

Fix https://github.com/elastic/kibana/issues/104081

This PR move some of the SO types from the `.kibana` index into the
following ones:
- `.kibana_alerting_cases`
- `.kibana_analytics`
- `.kibana_security_solution`
- `.kibana_ingest`

This split/reallocation will occur during the `8.8.0` Kibana upgrade
(*meaning: from any version older than `8.8.0` to any version greater or
equal to `8.8.0`*)

**This PR main changes are:**
- implement the changes required in the SO migration algorithm to
support this reallocation
- update the FTR tools (looking at you esArchiver) to support these new
indices
- update hardcoded references to `.kibana` and usage of the
`core.savedObjects.getKibanaIndex()` to use new APIs to target the
correct index/indices
- update FTR datasets, tests and utility accordingly 

## To reviewers

**Overall estimated risk of regressions: low**

But, still, please take the time to review changes in your code. The
parts of the production code that were the most impacted are the
telemetry collectors, as most of them were performing direct requests
against the `.kibana` index, so we had to adapt them. Most other
contributor-owned changes are in FTR tests and datasets.

If you think a type is misplaced (either we missed some types that
should be moved to a specific index, or some types were moved and
shouldn't have been) please tell us, and we'll fix the reallocation
either in this PR or in a follow-up.

## .Kibana split

The following new indices are introduced by this PR, with the following
SO types being moved to it. (any SO type not listed here will be staying
in its current index)

Note: The complete **_type => index_** breakdown is available in [this
spreadsheet](https://docs.google.com/spreadsheets/d/1b_MG_E_aBksZ4Vkd9cVayij1oBpdhvH4XC8NVlChiio/edit#gid=145920788).

#### `.kibana_alerting_cases`
- action
- action_task_params
- alert
- api_key_pending_invalidation
- cases
- cases-comments
- cases-configure
- cases-connector-mappings
- cases-telemetry
- cases-user-actions
- connector_token
- rules-settings
- maintenance-window

#### `.kibana_security_solution`
- csp-rule-template
- endpoint:user-artifact
- endpoint:user-artifact-manifest
- exception-list
- exception-list-agnostic
- osquery-manager-usage-metric
- osquery-pack
- osquery-pack-asset
- osquery-saved-query
- security-rule
- security-solution-signals-migration
- siem-detection-engine-rule-actions
- siem-ui-timeline
- siem-ui-timeline-note
- siem-ui-timeline-pinned-event

#### `.kibana_analytics`

- canvas-element
- canvas-workpad-template
- canvas-workpad
- dashboard
- graph-workspace
- index-pattern
- kql-telemetry
- lens
- lens-ui-telemetry
- map
- search
- search-session
- search-telemetry
- visualization

#### `.kibana_ingest`

- epm-packages
- epm-packages-assets
- fleet-fleet-server-host
- fleet-message-signing-keys
- fleet-preconfiguration-deletion-record
- fleet-proxy
- ingest_manager_settings
- ingest-agent-policies
- ingest-download-sources
- ingest-outputs
- ingest-package-policies

## Tasks / PRs

### Sub-PRs

**Implementation**
- 🟣 https://github.com/elastic/kibana/pull/154846
- 🟣 https://github.com/elastic/kibana/pull/154892
- 🟣 https://github.com/elastic/kibana/pull/154882
- 🟣 https://github.com/elastic/kibana/pull/154884
- 🟣 https://github.com/elastic/kibana/pull/155155

**Individual index split**
- 🟣 https://github.com/elastic/kibana/pull/154897
- 🟣 https://github.com/elastic/kibana/pull/155129
- 🟣 https://github.com/elastic/kibana/pull/155140
- 🟣 https://github.com/elastic/kibana/pull/155130

### Improvements / follow-ups 

- 👷🏼 Extract logic into
[runV2Migration](https://github.com/elastic/kibana/pull/154151#discussion_r1158470566)
@gsoldevila
- Make `getCurrentIndexTypesMap` resillient to intermittent failures
https://github.com/elastic/kibana/pull/154151#discussion_r1169289717
- 🚧 Build a more structured
[MigratorSynchronizer](https://github.com/elastic/kibana/pull/154151#discussion_r1158469918)
- 🟣 https://github.com/elastic/kibana/pull/155035
- 🟣 https://github.com/elastic/kibana/pull/155116
- 🟣 https://github.com/elastic/kibana/pull/155366
## Reallocation tweaks

Tweaks to the reallocation can be done after the initial merge, as long
as it's done before the public release of 8.8

- `url` should get back to `.kibana` (see
[comment](https://github.com/elastic/kibana/pull/154888#discussion_r1172317133))

## Release Note

For performance purposes, Kibana is now using more system indices to
store its internal data.

The following system indices will be created when upgrading to `8.8.0`:

- `.kibana_alerting_cases`
- `.kibana_analytics`
- `.kibana_security_solution`
- `.kibana_ingest`

---------

Co-authored-by: pgayvallet <pierre.gayvallet@elastic.co>
Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
2023-04-25 09:43:42 +02:00
Yara Tercero
11155329cc
[Security Solution][Exceptions] - Add exception list duplication options with and without expired items (#154991)
## Summary

Adds the following:

- Add the option to duplicate from the shared exception list management
actions dropdowns
  - User can select to include exception items with expired TTL
  - User can select to not include exception items with expired TTL 
  - Cypress tests added for both options
2023-04-21 16:01:43 -07:00
Yara Tercero
9a095602f8
[Security Solution][Exceptions] - Fix exception operator logic when mapping conflict (#155071)
## Summary

Addresses https://github.com/elastic/kibana/issues/154962 .
2023-04-17 17:05:55 -04:00
Jason Stoltzfus
c339ca8394
Upgraded EUI to v76.0.0 (#152506)
👋 Hi all - the biggest breaking change of this PR is around two icon
type changes/renames.

1. ⚠️ **The  `alert` icon is now named `warning`**
- <img width="103" alt=""
src="https://user-images.githubusercontent.com/549407/223561599-8913e88c-676f-47cd-aaed-81b64783bd81.png"
align="middle">
- This change should have been automatically converted on your behalf by
the EUI team, **but if for some reason** we missed making this
conversion in this PR and your icon(s) are now broken, please ping us or
let us know in this PR (or fix yourself after this PR merges).
- In some cases, teams were using this icon for error messages,
alongside the `danger` color. In those cases, we opinionatedly changed
those icon usages to the new `error` icon instead of using the old
alert/warning icon.

2. 🛑 **The `crossInACircleFilled` icon has been removed, and a new
`error` icon added**
- <img width="84" alt=""
src="https://user-images.githubusercontent.com/549407/223561892-4406bdf6-1a55-49ac-85ad-3a11eb7c090d.png"
align="middle">
- The conversion for this breaking change was not straightforward. This
was the path we used to determine what to change `crossInACircleFilled`
usages to:
- If the icon was associated with errors or error messages, we changed
it to the new `error` icon.
- If a "delete" action was associated with this icon, we changed it to
the `trash` icon instead.
- If a "clear" action was associated with this icon, we changed it to
just the `cross` icon, or in some cases `minusInCircleFilled` (if used
alongside `plusInCircleFilled`).
- Again, if we made a mistake during this conversion or missed your
plugin, please feel free to ping us.

## Summary

`eui@75.1.2`  `eui@76.0.2`

## [`76.0.2`](https://github.com/elastic/eui/tree/v76.0.2)

**Bug fixes**

- Added a legacy `alert` alias for the `warning` `EuiIcon` type
([#6640](https://github.com/elastic/eui/pull/6640))

## [`76.0.1`](https://github.com/elastic/eui/tree/v76.0.1)

**Bug fixes**

- Fixed broken icons on all `isInvalid` form controls
([#6629](https://github.com/elastic/eui/pull/6629))

## [`76.0.0`](https://github.com/elastic/eui/tree/v76.0.0)

- Added `pivot` glyph to `EuiIcon`
([#6605](https://github.com/elastic/eui/pull/6605))
- Added the `displayHeaderCellProps` API to `EuiDataGrid`'s columns,
which allows passing custom props directly to column header cells
([#6609](https://github.com/elastic/eui/pull/6609))
- Added the new `headerCellProps`/`footerCellProps` APIs to
`EuiDataGrid`'s control columns, which allows passing custom props
directly to control column header or footer cells
([#6609](https://github.com/elastic/eui/pull/6609))
- Added a new `footerCellRender` API to `EuiDataGrid`'s control columns,
which allows completely customizing control column rendering (previously
rendered an empty cell)
([#6609](https://github.com/elastic/eui/pull/6609))
- Updated the styling of nested ordered lists in `EuiText` to align with
GitHub's list style, which is a popular format used in Markdown or MDX
formatting ([#6615](https://github.com/elastic/eui/pull/6615))
- Added a margin-bottom property exclusively to the direct child `ul`
and `ol` elements of the `EuiText` component
([#6615](https://github.com/elastic/eui/pull/6615))
- Fix issue with badges appearing within an `EuiBadgeGroup`, where the
CSS rule to override the `margin-inline-start` was not being applied
correctly due to the order of appearance in the CSS rules
([#6618](https://github.com/elastic/eui/pull/6618))

**Bug fixes**

- Fixed `EuiDataGrid` footer control columns rendering with cell
expansion popovers when they should not have been
([#6609](https://github.com/elastic/eui/pull/6609))
- Fixed an `EuiSkipLink` bug where main content loading in
progressively/dynamically after the skip link rendered was not being
correctly focused ([#6613](https://github.com/elastic/eui/pull/6613))

**Breaking changes**

- Renamed `EuiIcon`'s `alert` to `warning`
([#6608](https://github.com/elastic/eui/pull/6608))
- Removed `EuiIcon`'s `crossInACircleFilled` in favor of `error`
([#6608](https://github.com/elastic/eui/pull/6608))

---------

Co-authored-by: Davey Holler <daveyholler@hey.com>
Co-authored-by: Constance Chen <constance.chen@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jon <jon@elastic.co>
2023-03-14 14:27:40 -05:00
Yara Tercero
586f9a1461
[Security Solution][Exceptions] - Fix bug allowing user to type in custom field option for endpoint exception (#152619)
## Summary

Addresses https://github.com/elastic/kibana/issues/149814
2023-03-08 01:32:16 -07:00
Ievgen Sorokopud
7f9139f070
[Security Solution] Exceptions: Cypress tests to cover mapping conflicts functionality (#151366)
## Summary

This PR adds cypress tests to cover new rule exceptions functionality
introduced in [this PR](https://github.com/elastic/kibana/pull/149149).

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-03-07 22:21:51 +01:00
Ievgen Sorokopud
ce9631850d
[Security Solution][Alerts] Update mapping conflicts warning message (#152726)
## Summary

These changes update warning message that we show to user to indicate
index mapping conflicts while selecting a field to build a Rule
Exception.

New tooltip message:

<img width="829" alt="Screenshot 2023-03-06 at 16 18 51"
src="https://user-images.githubusercontent.com/2700761/223154197-ee4ed680-5cc1-4b48-82d8-e225aa24519b.png">

[Main ticket](https://github.com/elastic/kibana/issues/146845)
Addition to [this PR](https://github.com/elastic/kibana/pull/149149)


cc @nastasha-solomon
2023-03-06 19:23:26 +01:00
Davis Plumlee
203fa3a955
[Security Solution] Exceptions TTL Follow-up (#151952) 2023-03-03 18:56:39 -05:00
Yara Tercero
7a03aeaed9
[Security Solution][Exceptions] - Fix bug displaying filepath warning for non endpoint exception items (#151570)
## Summary

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

Fix bug displaying filepath warning for non endpoint exception items
2023-02-22 10:56:59 -08:00
Khristinin Nikita
d93eaa0109
Fix validation for entry fields in exception form (#151654)
## Change validation logic for entry exception field.

Close:
[https://github.com/elastic/kibana/issues/143051](https://github.com/elastic/kibana/issues/143051)

Previously we didn't keep a validation state per field which caused a
reset of validation if we still had invalid fields. Or we can have an
invalid state for the form, but we removed the invalid field. You can
see the videos on the ticket above.

## Solution:
Keep validation state per field, like:
```js 
{
   [entry.id]: true,
}
```
This state can keep old fields, which already were removed, this is why
we use the selector to get the actual amount of errors.



https://user-images.githubusercontent.com/7609147/220337447-95c1558c-aa85-43d1-87e8-76370aeaf141.mov

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-21 16:59:54 +01:00
Spencer
1b85815402
[packages] migrate all plugins to packages (#148130)
Fixes https://github.com/elastic/kibana/issues/149344

This PR migrates all plugins to packages automatically. It does this
using `node scripts/lint_packages` to automatically migrate
`kibana.json` files to `kibana.jsonc` files. By doing this automatically
we can simplify many build and testing procedures to only support
packages, and not both "packages" and "synthetic packages" (basically
pointers to plugins).

The majority of changes are in operations related code, so we'll be
having operations review this before marking it ready for review. The
vast majority of the code owners are simply pinged because we deleted
all `kibana.json` files and replaced them with `kibana.jsonc` files, so
we plan on leaving the PR ready-for-review for about 24 hours before
merging (after feature freeze), assuming we don't have any blockers
(especially from @elastic/kibana-core since there are a few core
specific changes, though the majority were handled in #149370).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-08 21:06:50 -06:00
Davis Plumlee
92a1689e95
[Security Solution][Exceptions] Rule exceptions TTL - Expiration (#145180) 2023-02-07 16:20:39 -05:00
Ievgen Sorokopud
84efdaa330
[Security Solution][Alerts] Provide more information about rule exception behavior before creation (#149149)
## Summary

These changes surface mapping issues when exceptions are created. We
gonna warn the user about type conflicts and unmapped indices.

Tooltip warning inside the field selection dropdown menu:

<img width="2020" alt="Screenshot 2023-01-18 at 19 01 44"
src="https://user-images.githubusercontent.com/2700761/213261684-61d21068-12bc-408f-8d20-1a196e0719a7.png">

Warning text underneath the dropdown menu when user picks the field
which has mapping issues:


https://user-images.githubusercontent.com/2700761/215467838-5d39ff75-3a2e-44ef-ba89-57cd3975310c.mov

Main ticket #146845

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-02-06 15:08:47 +01:00
Rudolf Meijering
cfee703139
Bump elasticsearch-js to 8.6.0-canary.3 (#148521)
## Summary

Bump elasticsearch-js to 8.6.0-canary.3 to unblock
https://github.com/elastic/kibana/issues/145653

The updated version of elasticsearch-js comes with some type changes
that causes typescript type checking to fail. I've fixed the type errors
that were obvious/easy but left todo's for some types which were harder
for me to figure out. If any of these todo's are in your team's code,
please contribute directly to the branch to fix them.


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Thom Heymann <thom.heymann@elastic.co>
Co-authored-by: weltenwort <stuermer@weltenwort.de>
2023-01-24 05:49:30 -07:00
Tiago Costa
e38350f7f9
chore(NA): upgrades uuid to v9.0.0 (#149135)
This PR upgrades uuid into its latest version `9.0.0`.
The previous default used version `v4` was kept where it was previously
used and places using `v1` or `v5` are still using it.

In this latest version they removed the deep import feature and as we
are not using tree shaking it increased our bundles by a significant
size. As such, I've moved this dependency into the `ui-shared-deps-npm`
bundle.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-19 19:48:07 +00:00
Spencer
afb09ccf8a
Transpile packages on demand, validate all TS projects (#146212)
## Dearest Reviewers 👋 

I've been working on this branch with @mistic and @tylersmalley and
we're really confident in these changes. Additionally, this changes code
in nearly every package in the repo so we don't plan to wait for reviews
to get in before merging this. If you'd like to have a concern
addressed, please feel free to leave a review, but assuming that nobody
raises a blocker in the next 24 hours we plan to merge this EOD pacific
tomorrow, 12/22.

We'll be paying close attention to any issues this causes after merging
and work on getting those fixed ASAP. 🚀

---

The operations team is not confident that we'll have the time to achieve
what we originally set out to accomplish by moving to Bazel with the
time and resources we have available. We have also bought ourselves some
headroom with improvements to babel-register, optimizer caching, and
typescript project structure.

In order to make sure we deliver packages as quickly as possible (many
teams really want them), with a usable and familiar developer
experience, this PR removes Bazel for building packages in favor of
using the same JIT transpilation we use for plugins.

Additionally, packages now use `kbn_references` (again, just copying the
dx from plugins to packages).

Because of the complex relationships between packages/plugins and in
order to prepare ourselves for automatic dependency detection tools we
plan to use in the future, this PR also introduces a "TS Project Linter"
which will validate that every tsconfig.json file meets a few
requirements:

1. the chain of base config files extended by each config includes
`tsconfig.base.json` and not `tsconfig.json`
1. the `include` config is used, and not `files`
2. the `exclude` config includes `target/**/*`
3. the `outDir` compiler option is specified as `target/types`
1. none of these compiler options are specified: `declaration`,
`declarationMap`, `emitDeclarationOnly`, `skipLibCheck`, `target`,
`paths`

4. all references to other packages/plugins use their pkg id, ie:
	
	```js
    // valid
    {
      "kbn_references": ["@kbn/core"]
    }
    // not valid
    {
      "kbn_references": [{ "path": "../../../src/core/tsconfig.json" }]
    }
    ```

5. only packages/plugins which are imported somewhere in the ts code are
listed in `kbn_references`

This linter is not only validating all of the tsconfig.json files, but
it also will fix these config files to deal with just about any
violation that can be produced. Just run `node scripts/ts_project_linter
--fix` locally to apply these fixes, or let CI take care of
automatically fixing things and pushing the changes to your PR.

> **Example:** [`64e93e5`
(#146212)](64e93e5806)
When I merged main into my PR it included a change which removed the
`@kbn/core-injected-metadata-browser` package. After resolving the
conflicts I missed a few tsconfig files which included references to the
now removed package. The TS Project Linter identified that these
references were removed from the code and pushed a change to the PR to
remove them from the tsconfig.json files.

## No bazel? Does that mean no packages??
Nope! We're still doing packages but we're pretty sure now that we won't
be using Bazel to accomplish the 'distributed caching' and 'change-based
tasks' portions of the packages project.

This PR actually makes packages much easier to work with and will be
followed up with the bundling benefits described by the original
packages RFC. Then we'll work on documentation and advocacy for using
packages for any and all new code.

We're pretty confident that implementing distributed caching and
change-based tasks will be necessary in the future, but because of
recent improvements in the repo we think we can live without them for
**at least** a year.

## Wait, there are still BUILD.bazel files in the repo
Yes, there are still three webpack bundles which are built by Bazel: the
`@kbn/ui-shared-deps-npm` DLL, `@kbn/ui-shared-deps-src` externals, and
the `@kbn/monaco` workers. These three webpack bundles are still created
during bootstrap and remotely cached using bazel. The next phase of this
project is to figure out how to get the package bundling features
described in the RFC with the current optimizer, and we expect these
bundles to go away then. Until then any package that is used in those
three bundles still needs to have a BUILD.bazel file so that they can be
referenced by the remaining webpack builds.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 19:00:29 -06:00
Alejandro Fernández Haro
5efededc06
Upgrade @elastic/elasticsearch@8.5.0-canary.1 (#145416)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-11-23 18:01:51 -07:00
Paul Tavares
a1314b4831
[Security Solution][Endpoint] Update endpoint artifacts APIs (via Lists Plugin) to support RBAC (#145927)
## Summary

- Adds new constant to `@kbn/securitysolution-list-constants` that holds
all of the Endpoint artifact list definitions and also exports a new
const with the IDs of all of the Artifact list IDs.
- Updates the List create list internal API schema (in
`@kbn-securitysolution-io-ts-list-types`) to use new list of endpoint
artifact list IDs
- Update was also made in `const` defined under Security Solution plugin
- Updates the security solution kibana sub-feature privileges to include
the needed entries for enabling the Lists plugin (which is used for
artifact CRUD)
- Relax the auths to the `/internal/api/exception_lists/_create` to only
require `read`, since this API is needed to ensure lists are created
prior to being able to query their data
2022-11-23 09:13:13 -05:00
Tiago Costa
016e3e03a4
chore(NA): enables isolatedModules on base tsconfig file (#144841)
This PR enables `isolatedModules` on our `tsconfig.base.json`. Enabling
this means that our codebase is safe for tools that use TypeScript APIs
like `transpileModule` or alternative compilers like Babel. The
requirements introduced by enabling `isolatedModules` were already in
place for every piece of code transpiled with babel so we feel like its
time to make it the default across the board inside our repository.

The DX shouldn't be impacted negatively by these change as we introduced
a lint rule verification for the critical part around `isolatedModules`
which is around `const enums`. The PR also has a couple of `TODOs` to be
removed once we upgrade into typescript v4.8 where we would be able to
say everything that is typescript inside our repo should be consider a
module by default.

More information about `isolatedModules` can be found at
https://www.typescriptlang.org/tsconfig#isolatedModules

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-11-18 19:39:11 +00:00
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