-
Notifications
You must be signed in to change notification settings - Fork 79
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
Graph creation - update USES relationships for content items that contains alert in the name #4787
base: master
Are you sure you want to change the base?
Conversation
Changelog(s) in markdown:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very Nice!
Please see my comments.
In addition, I wonder if chat gpt can improve the query to look better...
.changelog/4787.yml
Outdated
@@ -0,0 +1,4 @@ | |||
changes: | |||
- description: Fixed an issue in graph creation where the content items in XSIAM replaced the word 'alert' with 'incident' on upload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed an issue where, when creating relationships between nodes, if the target is not in the repository due to a naming convention (e.g., "incident" to "alert"), the incorrect relationship is deleted and a correct one is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -109,6 +109,41 @@ def build_uses_relationships_query( | |||
RETURN count(r) AS relationships_merged""" | |||
|
|||
|
|||
def update_alert_to_incident_relationships(): | |||
return f""" | |||
// Updated USES relationships between nodes when the source contains "alert" in the id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Update USES relationships when the source node contains "alert" in its ID.
// This query addresses a scenario where relationships are created in our repository
// to items that do not yet exist with the expected names. Since we know the item names
// will be adjusted during upload (e.g., "incident" might be declared as "alert" in the marketplace),
// we initially use the "expected" name (e.g., "alert"). This discrepancy causes a false "not_in_repository" flag.
// The query ensures that the target node is updated to the correct item in the repository,
// replacing "alert" with "incident" to align with the correct naming convention,
// resolving the false flag and maintaining accurate relationships.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
|
||
|
||
// delete the old target node and old relationship | ||
DELETE r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't deleting the target enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it failed and ask to delete the relationship before
what I wrote in the code its after chat gpt improvements |
Changelog(s) in markdown:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
Related Issues
fixes:
https://jira-dc.paloaltonetworks.com/browse/CIAC-7711
https://jira-dc.paloaltonetworks.com/browse/CIAC-11954
Description
Added a new query to run in the end of
create_relationships
to update USES relationships that meet the following conditions:alert
in theobject_id
.not_in_repository=true
.We updated the target node that meet the following conditions:
incident
insteadalert
(for example searchAlerts in XSIAM -> searchIncidents in xsoar).The
update_alert_to_incident_relationships
method replaced the target in the relationship when all of these conditions are met.