Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with KQL wildcard queries not properly escaping backslashes #174464

Merged
merged 5 commits into from
Jan 9, 2024

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Jan 8, 2024

Summary

Fixes #169709.

Prior to this PR, KQL queries against keyword fields would not properly handle escaped special characters (such as backslash). This PR fixes the behavior to properly re-escape special characters before sending them along to the wildcard query.

Checklist

Release note

KQL queries against wildcards now properly handle escaped special characters without requiring double-escaping.

@lukasolson lukasolson added release_note:fix Feature:KQL KQL Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.12.1 v8.13.0 labels Jan 8, 2024
@lukasolson lukasolson self-assigned this Jan 8, 2024
@lukasolson lukasolson requested a review from a team as a code owner January 8, 2024 15:56
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes look good and work well!

@kertal kertal added the v8.11.4 label Jan 9, 2024
@kertal
Copy link
Member

kertal commented Jan 9, 2024

@elasticmachine merge upstream

@kertal
Copy link
Member

kertal commented Jan 9, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 2.3MB 2.3MB +3.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @lukasolson

@lukasolson lukasolson removed the v8.11.4 label Jan 9, 2024
@lukasolson lukasolson merged commit 46fbfd3 into elastic:main Jan 9, 2024
20 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 9, 2024
…elastic#174464)

## Summary

Fixes elastic#169709.

Prior to this PR, KQL queries against keyword fields would not properly
handle escaped special characters (such as backslash). This PR fixes the
behavior to properly re-escape special characters before sending them
along to the wildcard query.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Release note

KQL queries against wildcards now properly handle escaped special
characters without requiring double-escaping.

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 46fbfd3)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.12

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jan 9, 2024
…slashes (#174464) (#174533)

# Backport

This will backport the following commits from `main` to `8.12`:
- [Fix issue with KQL wildcard queries not properly escaping backslashes
(#174464)](#174464)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Lukas
Olson","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-01-09T16:24:12Z","message":"Fix
issue with KQL wildcard queries not properly escaping backslashes
(#174464)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/169709.\r\n\r\nPrior to this
PR, KQL queries against keyword fields would not properly\r\nhandle
escaped special characters (such as backslash). This PR fixes
the\r\nbehavior to properly re-escape special characters before sending
them\r\nalong to the wildcard query.\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### Release
note\r\n\r\nKQL queries against wildcards now properly handle escaped
special\r\ncharacters without requiring
double-escaping.\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"46fbfd3b13c80d49e51b6b1541fecebb7c628e02","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:KQL","Team:DataDiscovery","v8.12.1","v8.13.0"],"title":"Fix
issue with KQL wildcard queries not properly escaping
backslashes","number":174464,"url":"https://github.com/elastic/kibana/pull/174464","mergeCommit":{"message":"Fix
issue with KQL wildcard queries not properly escaping backslashes
(#174464)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/169709.\r\n\r\nPrior to this
PR, KQL queries against keyword fields would not properly\r\nhandle
escaped special characters (such as backslash). This PR fixes
the\r\nbehavior to properly re-escape special characters before sending
them\r\nalong to the wildcard query.\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### Release
note\r\n\r\nKQL queries against wildcards now properly handle escaped
special\r\ncharacters without requiring
double-escaping.\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"46fbfd3b13c80d49e51b6b1541fecebb7c628e02"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/174464","number":174464,"mergeCommit":{"message":"Fix
issue with KQL wildcard queries not properly escaping backslashes
(#174464)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/169709.\r\n\r\nPrior to this
PR, KQL queries against keyword fields would not properly\r\nhandle
escaped special characters (such as backslash). This PR fixes
the\r\nbehavior to properly re-escape special characters before sending
them\r\nalong to the wildcard query.\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### Release
note\r\n\r\nKQL queries against wildcards now properly handle escaped
special\r\ncharacters without requiring
double-escaping.\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"46fbfd3b13c80d49e51b6b1541fecebb7c628e02"}}]}]
BACKPORT-->

Co-authored-by: Lukas Olson <[email protected]>
nreese pushed a commit to nreese/kibana that referenced this pull request Jan 10, 2024
…elastic#174464)

## Summary

Fixes elastic#169709.

Prior to this PR, KQL queries against keyword fields would not properly
handle escaped special characters (such as backslash). This PR fixes the
behavior to properly re-escape special characters before sending them
along to the wildcard query.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Release note

KQL queries against wildcards now properly handle escaped special
characters without requiring double-escaping.

Co-authored-by: Kibana Machine <[email protected]>
delanni pushed a commit to delanni/kibana that referenced this pull request Jan 11, 2024
…elastic#174464)

## Summary

Fixes elastic#169709.

Prior to this PR, KQL queries against keyword fields would not properly
handle escaped special characters (such as backslash). This PR fixes the
behavior to properly re-escape special characters before sending them
along to the wildcard query.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Release note

KQL queries against wildcards now properly handle escaped special
characters without requiring double-escaping.

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:KQL KQL release_note:fix Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.12.0 v8.12.1 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KQL keyword wildcard queries require backslashes to be double-escaped
6 participants