From f459eba59d83fb648235f053a187dda2b40de0f8 Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Thu, 31 Oct 2024 02:52:44 -0500 Subject: [PATCH] [7.17] Fix code scanning alert no. 456: Incomplete string escaping or encoding (#193909) (#198243) # Backport This will backport the following commits from `main` to `7.17`: - Fix code scanning alert no. 456: Incomplete string escaping or encoding (#193909) (7458ff11) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../metrics_explorer/components/helpers/create_tsvb_link.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts index 84d87ee4ad1b7..4c3551db3cbcd 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts +++ b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts @@ -125,7 +125,7 @@ export const createFilterFromOptions = ( if (!value) { return null; } - return `${field}: "${value.replace('"', '\\"')}"`; + return `${field}: "${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; }) .join(' and ') : `${options.groupBy} : "${id}"`;