mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solution] Fix code scanning alert (#198142)
Fixes [https://github.com/elastic/kibana/security/code-scanning/365](https://github.com/elastic/kibana/security/code-scanning/365) ## Summary To fix the problem, we need to ensure that both double quotes and backslashes are properly escaped in the `escapeValue` function. This can be achieved by using a regular expression that replaces both characters globally. Specifically, we should replace backslashes with double backslashes (`\\`) and double quotes with escaped double quotes (`\"`). - Update the `escapeValue` function to use a regular expression that handles both double quotes and backslashes. - Ensure that the regular expression has the global flag (`g`) to replace all occurrences of the characters. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
fdd5e0be75
commit
b9a5d6a46d
1 changed files with 1 additions and 1 deletions
|
@ -33,7 +33,7 @@ const COPY_TO_CLIPBOARD_SUCCESS = i18n.translate(
|
|||
}
|
||||
);
|
||||
|
||||
const escapeValue = (value: string) => value.replace(/"/g, '\\"');
|
||||
const escapeValue = (value: string) => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
||||
|
||||
export const createCopyToClipboardActionFactory = createCellActionFactory(
|
||||
({ notifications }: { notifications: NotificationsStart }) => ({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue