Skip to content

Commit

Permalink
Improves pattern matching for data telemetry (#197876)
Browse files Browse the repository at this point in the history
## Summary

Addresses concerns with Regex matching.

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
TinaHeiligers and elasticmachine authored Oct 28, 2024
1 parent af2bff4 commit 943b273
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ function findMatchingDescriptors({
// avoid system indices caught by very fuzzy index patterns (i.e.: *log* would catch `.kibana-log-...`)
return false;
}
return new RegExp(`^${pattern.replace(/\./g, '\\.').replace(/\*/g, '.*')}$`).test(name);
const escapedPattern = pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
return new RegExp(`^${escapedPattern.replace(/\\\*/g, '.*')}$`).test(name);
});
}

Expand Down

0 comments on commit 943b273

Please sign in to comment.