kibana/x-pack/plugins/security_solution
Kibana Machine 688008c1dd
[8.16] [Security Solution] Fix redux action being fired because of unused react-router value (#217055) (#218452)
# Backport

This will backport the following commits from `main` to `8.16`:
- [[Security Solution] Fix redux action being fired because of unused
react-router value
(#217055)](https://github.com/elastic/kibana/pull/217055)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Kevin
Qualters","email":"56408403+kqualters-elastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-16T14:13:44Z","message":"[Security
Solution] Fix redux action being fired because of unused react-router
value (#217055)\n\n## Summary\n\nThis pr fixes a bug with the
RouteCapture component, used at a high\nlevel in the security solution
component tree, to reflect url changes\ninto redux. The code previously
used the full result of\n'react-router-dom' 's useLocation hook as the
payload, which contains 4\nparameters, pathname, search, hash that we
make use of, and a 4th that\nwas added sometime later by the library
that is essentially a random id\ngenerated every time the hook is
called, called key. We have never used\nthis, and it was being
inadvertently copied into the redux state, and\nalso causing some other
actions or hooks based listeners to run I think\nas well.\n\nBelow is
the contrived example of going from the home page to an empty\nalerts
page, and you can see 4 actions in the after, and 5 in the\nbefore, with
1 updating only the key. May reduce more unneeded actions\nwith more
going on in the page, but exactly how many is not
known.\nBefore:\n\n![image](ebd75055-4e17-497b-bed2-a5fd58c5c92f)\n\n\n###
Checklist\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"c277812ffe3e74eb9bc0733a538bd78ea9b95f58","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting:Investigations","backport:all-open","v9.1.0"],"title":"[Security
Solution] Fix redux action being fired because of unused react-router
value","number":217055,"url":"https://github.com/elastic/kibana/pull/217055","mergeCommit":{"message":"[Security
Solution] Fix redux action being fired because of unused react-router
value (#217055)\n\n## Summary\n\nThis pr fixes a bug with the
RouteCapture component, used at a high\nlevel in the security solution
component tree, to reflect url changes\ninto redux. The code previously
used the full result of\n'react-router-dom' 's useLocation hook as the
payload, which contains 4\nparameters, pathname, search, hash that we
make use of, and a 4th that\nwas added sometime later by the library
that is essentially a random id\ngenerated every time the hook is
called, called key. We have never used\nthis, and it was being
inadvertently copied into the redux state, and\nalso causing some other
actions or hooks based listeners to run I think\nas well.\n\nBelow is
the contrived example of going from the home page to an empty\nalerts
page, and you can see 4 actions in the after, and 5 in the\nbefore, with
1 updating only the key. May reduce more unneeded actions\nwith more
going on in the page, but exactly how many is not
known.\nBefore:\n\n![image](ebd75055-4e17-497b-bed2-a5fd58c5c92f)\n\n\n###
Checklist\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"c277812ffe3e74eb9bc0733a538bd78ea9b95f58"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217055","number":217055,"mergeCommit":{"message":"[Security
Solution] Fix redux action being fired because of unused react-router
value (#217055)\n\n## Summary\n\nThis pr fixes a bug with the
RouteCapture component, used at a high\nlevel in the security solution
component tree, to reflect url changes\ninto redux. The code previously
used the full result of\n'react-router-dom' 's useLocation hook as the
payload, which contains 4\nparameters, pathname, search, hash that we
make use of, and a 4th that\nwas added sometime later by the library
that is essentially a random id\ngenerated every time the hook is
called, called key. We have never used\nthis, and it was being
inadvertently copied into the redux state, and\nalso causing some other
actions or hooks based listeners to run I think\nas well.\n\nBelow is
the contrived example of going from the home page to an empty\nalerts
page, and you can see 4 actions in the after, and 5 in the\nbefore, with
1 updating only the key. May reduce more unneeded actions\nwith more
going on in the page, but exactly how many is not
known.\nBefore:\n\n![image](ebd75055-4e17-497b-bed2-a5fd58c5c92f)\n\n\n###
Checklist\n\n- [ ] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"c277812ffe3e74eb9bc0733a538bd78ea9b95f58"}}]}]
BACKPORT-->

Co-authored-by: Kevin Qualters <56408403+kqualters-elastic@users.noreply.github.com>
2025-04-16 18:14:00 +02:00
..
.storybook
common [8.16] [Security Solution] Fix redux action being fired because of unused react-router value (#217055) (#218452) 2025-04-16 18:14:00 +02:00
docs [8.16] [Threat Hunting Investigations] Improve API docs for notes/timeline (#213584) (#214533) 2025-03-14 10:39:54 -05:00
public [8.16] [Security Solution] Fix redux action being fired because of unused react-router value (#217055) (#218452) 2025-04-16 18:14:00 +02:00
scripts [8.16] [DOCS] Adds conceptual content to API docs (#202305) (#204108) 2024-12-13 10:54:42 +01:00
server [8.16] [Security Solution] Add retrieve results to security solution search strategy (#207307) (#215275) 2025-03-20 16:42:51 -05:00
jest.config.dev.js
jest.integration.config.js
kibana.jsonc [8.x] Kb settings followup (#195733) (#196477) 2024-10-16 00:21:47 -05:00
package.json [8.16] chore(NA): upgrade to webpack 5 (#191106) (#211152) 2025-02-19 04:15:36 +00:00
README.md
tsconfig.json [8.16] [Security Assistant] Move security AI assistant button into global nav bar (#203060) (#205886) 2025-01-09 10:01:38 +01:00

Security Solution

Welcome to the Kibana Security Solution plugin! This README will go over getting started with development and testing.

Development

Tests

The endpoint specific tests leverage the ingest manager to install the endpoint package. Before the api integration and functional tests are run the ingest manager is initialized. This initialization process includes reaching out to a package registry service to install the endpoint package. The endpoint tests support three different ways to run the tests given the constraint on an available package registry.

  1. Using Docker
  2. Running your own local package registry
  3. Using the default external package registry

These scenarios will be outlined the sections below.

Endpoint API Integration Tests Location

The endpoint api integration tests are located here

Endpoint Functional Tests Location

The endpoint functional tests are located here

Using Docker

To run the tests using the recommended docker image version you must have docker installed. The testing infrastructure will stand up a docker container using the image defined here

Make sure you're in the Kibana root directory.

Endpoint API Integration Tests

In one terminal, run:

FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:server --config x-pack/test/security_solution_endpoint_api_int/config.ts

In another terminal, run:

FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner --config x-pack/test/security_solution_endpoint_api_int/config.ts

Endpoint Functional Tests

In one terminal, run:

FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:server --config x-pack/test/security_solution_endpoint/config.ts

In another terminal, run:

FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner --config x-pack/test/security_solution_endpoint/config.ts

Running your own package registry

If you are doing endpoint package development it will be useful to run your own package registry to serve the latest package you're building. To do this use the following commands:

Make sure you're in the Kibana root directory.

Endpoint API Integration Tests

In one terminal, run:

PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080> yarn test:ftr:server --config x-pack/test/security_solution_endpoint_api_int/config.ts

In another terminal, run:

PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080>  yarn test:ftr:runner --config x-pack/test/security_solution_endpoint_api_int/config.ts

Endpoint Functional Tests

In one terminal, run:

PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080> yarn test:ftr:server --config x-pack/test/security_solution_endpoint/config.ts

In another terminal, run:

PACKAGE_REGISTRY_URL_OVERRIDE=<url to your package registry like http://localhost:8080>  yarn test:ftr:runner --config x-pack/test/security_solution_endpoint/config.ts

Using the default public registry

If you don't have docker installed and don't want to run your own registry, you can run the tests using the ingest manager's default public package registry. The actual package registry used is here

Make sure you're in the Kibana root directory.

Endpoint API Integration Tests

In one terminal, run:

yarn test:ftr:server --config x-pack/test/security_solution_endpoint_api_int/config.ts

In another terminal, run:

yarn test:ftr:runner --config x-pack/test/security_solution_endpoint_api_int/config.ts

Endpoint Functional Tests

In one terminal, run:

yarn test:ftr:server --config x-pack/test/security_solution_endpoint/config.ts

In another terminal, run:

yarn test:ftr:runner --config x-pack/test/security_solution_endpoint/config.ts

Generate huge amount of indices with huge amount of fields

The result of this operation will be 10 separate bucket folders within mappings_folder. Each bucket folder will contain a mappings.json file describing 50 indices.

yarn mappings:generate --fieldsCount=10000 --indexCount=500 --indexPrefix='.ds-huge' --unmappedRate=.2 --buckets=10 --outputDirectory='mappings_folder'

Load generated mappings

yarn mappings:load --mappings-dir='mappings_folder' --es-url=http://username:password@localhost:9200 --kibana-url=http://username:password@localhost:5601/app