Skip to content

[9.2] [Security Solution][Entity Analytics][Risk Scoring] Handle special characters in ESQL query for risk scoring (#247060)#247247

Merged
abhishekbhatia1710 merged 8 commits intoelastic:9.2from
abhishekbhatia1710:backport/9.2/pr-247060
Dec 30, 2025
Merged

[9.2] [Security Solution][Entity Analytics][Risk Scoring] Handle special characters in ESQL query for risk scoring (#247060)#247247
abhishekbhatia1710 merged 8 commits intoelastic:9.2from
abhishekbhatia1710:backport/9.2/pr-247060

Conversation

@abhishekbhatia1710
Copy link
Contributor

Backport

This will backport the following commits from main to 9.2:

Questions ?

Please refer to the Backport tool documentation

…aracters in ESQL query for risk scoring (elastic#247060)

## Summary

Fixes `json.parse()` failures when ES|QL risk score calculation query's
output contain special characters (quotes, backslashes, newlines, etc.)
by encoding field values with Base64 in queries.

Fixes: elastic/sdh-security-team#1529

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

(cherry picked from commit 998226c)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/risk_score/__snapshots__/calculate_esql_risk_scores.test.ts.snap
#	x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/risk_score/calculate_esql_risk_scores.ts
@abhishekbhatia1710 abhishekbhatia1710 self-assigned this Dec 23, 2025
@jaredburgettelastic
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@jaredburgettelastic jaredburgettelastic left a comment

Choose a reason for hiding this comment

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

Confirmed that code is functionally the same as https://github.com/elastic/kibana/pull/247060/files

@jaredburgettelastic
Copy link
Contributor

@elasticmachine merge upstream

@jaredburgettelastic
Copy link
Contributor

@elasticmachine merge upstream

@abhishekbhatia1710 abhishekbhatia1710 merged commit 7be587d into elastic:9.2 Dec 30, 2025
13 checks passed
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @abhishekbhatia1710

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants