Skip to content

Commit

Permalink
Fix code scanning alert no. 494: Incomplete string escaping or encodi…
Browse files Browse the repository at this point in the history
…ng (#204528)

Fixes
[https://github.com/elastic/kibana/security/code-scanning/494](https://github.com/elastic/kibana/security/code-scanning/494)
Fixes #1311

Escape first backslash occurrences and all single quotes in the `filter`
string.
  • Loading branch information
fkanout authored Dec 17, 2024
1 parent 1b52848 commit cc34e97
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getLensOperationFromRuleMetric = (metric: GenericMetric): LensOpera
const { aggType, field, filter = '' } = metric;
let operation: string = aggType;
const operationArgs: string[] = [];
const escapedFilter = filter.replace(/'/g, "\\'");
const escapedFilter = filter.replace(/\\/g, '\\\\').replace(/'/g, "\\'");

if (aggType === Aggregators.RATE) {
return {
Expand Down

0 comments on commit cc34e97

Please sign in to comment.