[Security Solution] Use AST utils from @kbn/esql-ast for ES|QL rule type query parsing (#9282)#189780
Conversation
…ype query parsing (elastic#9282)
|
/ci |
x-pack/plugins/security_solution/public/detection_engine/rule_creation/logic/esql_validator.ts
Show resolved
Hide resolved
|
/ci |
|
/ci |
x-pack/plugins/security_solution/public/detection_engine/rule_creation/logic/esql_validator.ts
Outdated
Show resolved
Hide resolved
packages/kbn-securitysolution-utils/src/esql/compute_if_esql_query_aggregating.ts
Outdated
Show resolved
Hide resolved
|
/ci |
|
/ci |
|
Pinging @elastic/security-solution (Team: SecuritySolution) |
|
Pinging @elastic/security-detection-engine (Team:Detection Engine) |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6681[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/trial_license_complete_tier/configs/ess.config.ts: 100/100 tests passed. |
| } | ||
|
|
||
| // Check whether the `metadata` operator has `_id` argument | ||
| const idColumnItem = (metadataOption as ESQLCommandOption).args.find( |
There was a problem hiding this comment.
why casting is needed here?
Given that one of the types there does not have args property, it could lead to error of accessing property. Something we had already in the past.
There was a problem hiding this comment.
Seems like Array.find cannot infer the type in this case. I re-arranged the code.
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6682[❌] Security Solution Detection Engine - Cypress: 52/100 tests passed. |
vitaliidm
left a comment
There was a problem hiding this comment.
LGTM
thanks for you work
These changes elastic#188898 caused new tests to fail
# Conflicts: # x-pack/plugins/security_solution/tsconfig.json
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
History
To update your PR or re-run it, just comment with: cc @e40pud |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6712[❌] Security Solution Detection Engine - Cypress: 60/100 tests passed. |
Summary
Addresses https://github.com/elastic/security-team/issues/9282
With these changes we utilise AST based utils to do ES|QL query validation. This allows us to recognise and display syntax errors. Syntax errors have higher priority than the rest of the validation errors.
Validation errors priorities from top to bottom:
_idcolumn requested for non-aggregating queries via metadata operatorThese priorities define the sequence in which we display errors to the user. If there are several errors detected, that the one with higher priority will be shown.
Screen.Recording.2024-08-02.at.11.02.16.mov
Checklist
Delete any items that are not applicable to this PR.