From 5575428dd3aef69366cddb4ccf07a2a26d30ce48 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 18 Oct 2024 20:24:03 +1100 Subject: [PATCH] [8.16] [Graph] Escape backslash characters in the graph encode functions (#196239) (#196683) # Backport This will backport the following commits from `main` to `8.16`: - [[Graph] Escape backslash characters in the graph encode functions (#196239)](https://github.com/elastic/kibana/pull/196239) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> --- x-pack/plugins/graph/public/helpers/kql_encoder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/graph/public/helpers/kql_encoder.ts b/x-pack/plugins/graph/public/helpers/kql_encoder.ts index 25ac6b9c4280d..e1eeb0f2dc35b 100644 --- a/x-pack/plugins/graph/public/helpers/kql_encoder.ts +++ b/x-pack/plugins/graph/public/helpers/kql_encoder.ts @@ -10,7 +10,7 @@ import rison from '@kbn/rison'; import { Workspace } from '../types'; function escapeQuotes(str: string) { - return str.replace(/"/g, '\\"'); + return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); } export function asKQL(workspace: Workspace, joinBy: 'and' | 'or') {