Skip to content

ES|QL query builder robustness fixes #3017

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

Merged

Conversation

miguelgrinberg
Copy link
Contributor

Several fixes intended to make the new ES|QL query builder more robust:

  • Add a documentation section on using parameters to prevent code injection attacks
  • Expose the E() function through the elasticsearch.esql module
  • Better formatting and escaping of identifiers, index names and ES|QL expressions in rendered queries
  • Updated syntax of the COMPLETION command
  • Moved ES|QL integration tests under test_integration as should be expected
  • Added some more tests with the use of parameters

Copy link

github-actions bot commented Jul 31, 2025

🔍 Preview links for changed docs

@miguelgrinberg miguelgrinberg force-pushed the docs-esql-injection-section branch 2 times, most recently from b02ebb2 to 03841d8 Compare July 31, 2025 14:16
@miguelgrinberg miguelgrinberg force-pushed the docs-esql-injection-section branch from 03841d8 to 51affce Compare July 31, 2025 14:17
@miguelgrinberg miguelgrinberg merged commit e3e85ed into elastic:main Aug 1, 2025
18 checks passed
@miguelgrinberg miguelgrinberg deleted the docs-esql-injection-section branch August 1, 2025 16:11
Copy link

github-actions bot commented Aug 1, 2025

The backport to 8.19 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.19 8.19
# Navigate to the new working tree
cd .worktrees/backport-8.19
# Create a new branch
git switch --create backport-3017-to-8.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e3e85ed38c303b792cd44f892c961c3c45804c55
# Push it to GitHub
git push --set-upstream origin backport-3017-to-8.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.19

Then, create a pull request where the base branch is 8.19 and the compare/head branch is backport-3017-to-8.19.

github-actions bot pushed a commit that referenced this pull request Aug 1, 2025
* Add note on how to prevent ES|QL injection attacks

* Various additional query builder fixes

* linter fixes

(cherry picked from commit e3e85ed)
github-actions bot pushed a commit that referenced this pull request Aug 1, 2025
* Add note on how to prevent ES|QL injection attacks

* Various additional query builder fixes

* linter fixes

(cherry picked from commit e3e85ed)
miguelgrinberg added a commit that referenced this pull request Aug 1, 2025
* Add note on how to prevent ES|QL injection attacks

* Various additional query builder fixes

* linter fixes

(cherry picked from commit e3e85ed)

Co-authored-by: Miguel Grinberg <[email protected]>
miguelgrinberg added a commit that referenced this pull request Aug 1, 2025
* Add note on how to prevent ES|QL injection attacks

* Various additional query builder fixes

* linter fixes

(cherry picked from commit e3e85ed)

Co-authored-by: Miguel Grinberg <[email protected]>
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-py that referenced this pull request Aug 1, 2025
* Add note on how to prevent ES|QL injection attacks

* Various additional query builder fixes

* linter fixes
miguelgrinberg added a commit that referenced this pull request Aug 1, 2025
* Add note on how to prevent ES|QL injection attacks

* Various additional query builder fixes

* linter fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant