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

[Rule Migration] Adding CIM to ECS mapping and ESQL validation #202331

Merged
merged 10 commits into from
Dec 3, 2024

Conversation

P1llus
Copy link
Member

@P1llus P1llus commented Nov 29, 2024

Summary

This PR adds the initial context to map CIM fields to ECS and two new nodes validation and a node to handle esql validation issues, fixing itself.

This is how the graph looks compared to its old one:
image

Validation always runs last, and if validation returns any errors it will run the appropriate node depending on what validation failed. Once it is resolved it will validate again and then END when its successful.

Currently 5 error iterations is max, which is just an arbitrary number. The default Langgraph configuration is 25 nodes executed in total for a specific graph before it errors with a recursion limit (main and sub graphs are not combined in that count).

A few things are included in this PR:

  • Moved ESQL KB caller to util(any better place?), as it is now used in multiple nodes.
  • New Validation node, where any sort of validation takes place, usually the last step before ending the graph (on success).
  • New ESQL Error node, to resolve any ESQL validation errors and trigger a re-validation.
  • Fix a small bug in the main graph on the conditional edges, added a map for the allowed return values.

@P1llus P1llus added release_note:skip Skip the PR/issue when compiling release notes v9.0.0 Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) v8.18.0 labels Nov 29, 2024
@P1llus P1llus marked this pull request as ready for review December 2, 2024 13:54
@P1llus P1llus requested review from a team as code owners December 2, 2024 13:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@P1llus P1llus changed the title [Rule Migration] Adding CIM to ECS mapping [Rule Migration] Adding CIM to ECS mapping and ESQL validation Dec 2, 2024
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

Copy link
Contributor

@e40pud e40pud left a comment

Choose a reason for hiding this comment

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

LGTM! As agreed in slack, we will go ahead with these changes and once ES|QL query validation code is shared, we will adjust it in our code as well.

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

LGTM

@P1llus P1llus merged commit c1d976b into elastic:main Dec 3, 2024
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12138108520

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 3, 2024
…ic#202331)

## Summary

This PR adds the initial context to map CIM fields to ECS and two new
nodes validation and a node to handle esql validation issues, fixing
itself.

This is how the graph looks compared to its old one:
<img width="646" alt="image"
src="https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982">

Validation always runs last, and if validation returns any errors it
will run the appropriate node depending on what validation failed. Once
it is resolved it will validate again and then END when its successful.

Currently 5 error iterations is max, which is just an arbitrary number.
The default Langgraph configuration is 25 nodes executed in total for a
specific graph before it errors with a recursion limit (main and sub
graphs are not combined in that count).

A few things are included in this PR:

- Moved ESQL KB caller to util(any better place?), as it is now used in
multiple nodes.
- New Validation node, where any sort of validation takes place, usually
the last step before ending the graph (on success).
- New ESQL Error node, to resolve any ESQL validation errors and trigger
a re-validation.
- Fix a small bug in the main graph on the conditional edges, added a
map for the allowed return values.

(cherry picked from commit c1d976b)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

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 Dec 3, 2024
…202331) (#202668)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Rule Migration] Adding CIM to ECS mapping and ESQL validation
(#202331)](#202331)

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

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

<!--BACKPORT [{"author":{"name":"Marius
Iversen","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-03T10:51:19Z","message":"[Rule
Migration] Adding CIM to ECS mapping and ESQL validation (#202331)\n\n##
Summary\r\n\r\nThis PR adds the initial context to map CIM fields to ECS
and two new\r\nnodes validation and a node to handle esql validation
issues, fixing\r\nitself.\r\n\r\nThis is how the graph looks compared to
its old one:\r\n<img width=\"646\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982\">\r\n\r\n\r\nValidation
always runs last, and if validation returns any errors it\r\nwill run
the appropriate node depending on what validation failed. Once\r\nit is
resolved it will validate again and then END when its
successful.\r\n\r\nCurrently 5 error iterations is max, which is just an
arbitrary number.\r\nThe default Langgraph configuration is 25 nodes
executed in total for a\r\nspecific graph before it errors with a
recursion limit (main and sub\r\ngraphs are not combined in that
count).\r\n\r\nA few things are included in this PR:\r\n\r\n- Moved ESQL
KB caller to util(any better place?), as it is now used in\r\nmultiple
nodes.\r\n- New Validation node, where any sort of validation takes
place, usually\r\nthe last step before ending the graph (on
success).\r\n- New ESQL Error node, to resolve any ESQL validation
errors and trigger\r\na re-validation.\r\n- Fix a small bug in the main
graph on the conditional edges, added a\r\nmap for the allowed return
values.","sha":"c1d976b470bf08d472165f7751a444d6968c48d2","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","v8.18.0"],"title":"[Rule
Migration] Adding CIM to ECS mapping and ESQL
validation","number":202331,"url":"https://github.com/elastic/kibana/pull/202331","mergeCommit":{"message":"[Rule
Migration] Adding CIM to ECS mapping and ESQL validation (#202331)\n\n##
Summary\r\n\r\nThis PR adds the initial context to map CIM fields to ECS
and two new\r\nnodes validation and a node to handle esql validation
issues, fixing\r\nitself.\r\n\r\nThis is how the graph looks compared to
its old one:\r\n<img width=\"646\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982\">\r\n\r\n\r\nValidation
always runs last, and if validation returns any errors it\r\nwill run
the appropriate node depending on what validation failed. Once\r\nit is
resolved it will validate again and then END when its
successful.\r\n\r\nCurrently 5 error iterations is max, which is just an
arbitrary number.\r\nThe default Langgraph configuration is 25 nodes
executed in total for a\r\nspecific graph before it errors with a
recursion limit (main and sub\r\ngraphs are not combined in that
count).\r\n\r\nA few things are included in this PR:\r\n\r\n- Moved ESQL
KB caller to util(any better place?), as it is now used in\r\nmultiple
nodes.\r\n- New Validation node, where any sort of validation takes
place, usually\r\nthe last step before ending the graph (on
success).\r\n- New ESQL Error node, to resolve any ESQL validation
errors and trigger\r\na re-validation.\r\n- Fix a small bug in the main
graph on the conditional edges, added a\r\nmap for the allowed return
values.","sha":"c1d976b470bf08d472165f7751a444d6968c48d2"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202331","number":202331,"mergeCommit":{"message":"[Rule
Migration] Adding CIM to ECS mapping and ESQL validation (#202331)\n\n##
Summary\r\n\r\nThis PR adds the initial context to map CIM fields to ECS
and two new\r\nnodes validation and a node to handle esql validation
issues, fixing\r\nitself.\r\n\r\nThis is how the graph looks compared to
its old one:\r\n<img width=\"646\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982\">\r\n\r\n\r\nValidation
always runs last, and if validation returns any errors it\r\nwill run
the appropriate node depending on what validation failed. Once\r\nit is
resolved it will validate again and then END when its
successful.\r\n\r\nCurrently 5 error iterations is max, which is just an
arbitrary number.\r\nThe default Langgraph configuration is 25 nodes
executed in total for a\r\nspecific graph before it errors with a
recursion limit (main and sub\r\ngraphs are not combined in that
count).\r\n\r\nA few things are included in this PR:\r\n\r\n- Moved ESQL
KB caller to util(any better place?), as it is now used in\r\nmultiple
nodes.\r\n- New Validation node, where any sort of validation takes
place, usually\r\nthe last step before ending the graph (on
success).\r\n- New ESQL Error node, to resolve any ESQL validation
errors and trigger\r\na re-validation.\r\n- Fix a small bug in the main
graph on the conditional edges, added a\r\nmap for the allowed return
values.","sha":"c1d976b470bf08d472165f7751a444d6968c48d2"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marius Iversen <[email protected]>
hop-dev pushed a commit to hop-dev/kibana that referenced this pull request Dec 5, 2024
…ic#202331)

## Summary

This PR adds the initial context to map CIM fields to ECS and two new
nodes validation and a node to handle esql validation issues, fixing
itself.

This is how the graph looks compared to its old one:
<img width="646" alt="image"
src="https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982">


Validation always runs last, and if validation returns any errors it
will run the appropriate node depending on what validation failed. Once
it is resolved it will validate again and then END when its successful.

Currently 5 error iterations is max, which is just an arbitrary number.
The default Langgraph configuration is 25 nodes executed in total for a
specific graph before it errors with a recursion limit (main and sub
graphs are not combined in that count).

A few things are included in this PR:

- Moved ESQL KB caller to util(any better place?), as it is now used in
multiple nodes.
- New Validation node, where any sort of validation takes place, usually
the last step before ending the graph (on success).
- New ESQL Error node, to resolve any ESQL validation errors and trigger
a re-validation.
- Fix a small bug in the main graph on the conditional edges, added a
map for the allowed return values.
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 9, 2024
…ic#202331)

## Summary

This PR adds the initial context to map CIM fields to ECS and two new
nodes validation and a node to handle esql validation issues, fixing
itself.

This is how the graph looks compared to its old one:
<img width="646" alt="image"
src="https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982">


Validation always runs last, and if validation returns any errors it
will run the appropriate node depending on what validation failed. Once
it is resolved it will validate again and then END when its successful.

Currently 5 error iterations is max, which is just an arbitrary number.
The default Langgraph configuration is 25 nodes executed in total for a
specific graph before it errors with a recursion limit (main and sub
graphs are not combined in that count).

A few things are included in this PR:

- Moved ESQL KB caller to util(any better place?), as it is now used in
multiple nodes.
- New Validation node, where any sort of validation takes place, usually
the last step before ending the graph (on success).
- New ESQL Error node, to resolve any ESQL validation errors and trigger
a re-validation.
- Fix a small bug in the main graph on the conditional edges, added a
map for the allowed return values.
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…ic#202331)

## Summary

This PR adds the initial context to map CIM fields to ECS and two new
nodes validation and a node to handle esql validation issues, fixing
itself.

This is how the graph looks compared to its old one:
<img width="646" alt="image"
src="https://github.com/user-attachments/assets/253e449c-ac6f-4913-8da4-eb36f4e7b982">


Validation always runs last, and if validation returns any errors it
will run the appropriate node depending on what validation failed. Once
it is resolved it will validate again and then END when its successful.

Currently 5 error iterations is max, which is just an arbitrary number.
The default Langgraph configuration is 25 nodes executed in total for a
specific graph before it errors with a recursion limit (main and sub
graphs are not combined in that count).

A few things are included in this PR:

- Moved ESQL KB caller to util(any better place?), as it is now used in
multiple nodes.
- New Validation node, where any sort of validation takes place, usually
the last step before ending the graph (on success).
- New ESQL Error node, to resolve any ESQL validation errors and trigger
a re-validation.
- Fix a small bug in the main graph on the conditional edges, added a
map for the allowed return values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants