From 874d12dc8242e438e7dadaa1fa16d8a88d4f5018 Mon Sep 17 00:00:00 2001 From: Marta Bondyra <4283304+mbondyra@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:08:23 +0200 Subject: [PATCH] [Graph] Escape backslash characters in the graph encode functions (#196239) ## Summary Escape backslash characters in the graph encode functions. (cherry picked from commit 57c4b40270ff584ab8bc1859e1097ceb14171be0) --- 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 55ac25debe047..131dc9db0bd30 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 'rison-node'; 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') {