mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fix overly permissive regular expression range (#150058)
Without escaping `-`, it's treated as a range instead of the literal character - i.e. it matches everything between `+` and `=` in the ASCII table which for instance include all numbers.
This commit is contained in:
parent
1ba94ec11c
commit
af3ae7b555
2 changed files with 2 additions and 2 deletions
|
@ -23,7 +23,7 @@ function escapeRegExp(str: string) {
|
|||
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters
|
||||
function escapeQueryString(str: string) {
|
||||
return str.replace(/[+-=&|><!(){}[\]^"~*?:\\/]/g, '\\$&'); // $& means the whole matched string
|
||||
return str.replace(/[+\-=&|><!(){}[\]^"~*?:\\/]/g, '\\$&'); // $& means the whole matched string
|
||||
}
|
||||
|
||||
export function isNode(node: KueryNode): node is KqlWildcardNode {
|
||||
|
|
|
@ -36,4 +36,4 @@ export const parseSearchString = (query: string) => {
|
|||
};
|
||||
|
||||
const escapeReservedCharacters = (clause: string) =>
|
||||
clause.replace(/([+-=!\(\)\{\}\[\]^"~*?:\\/!]|&&|\|\|)/g, '\\$1');
|
||||
clause.replace(/([+\-=!\(\)\{\}\[\]^"~*?:\\/!]|&&|\|\|)/g, '\\$1');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue