Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit b567d0b

Browse files
[client] handle new patch operation in bundle import (opencti #6728)
1 parent a78975b commit b567d0b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,6 +2407,19 @@ def export_selected(
24072407

24082408
return bundle
24092409

2410+
def apply_patch(self, item):
2411+
input = item["opencti_field_patch"]
2412+
if item["type"] == "relationship":
2413+
self.opencti.stix_core_relationship.update_field(id=item["id"], input=input)
2414+
elif item["type"] == "sighting":
2415+
self.opencti.stix_sighting_relationship.update_field(
2416+
id=item["id"], input=input
2417+
)
2418+
elif StixCyberObservableTypes.has_value(item["type"]):
2419+
self.opencti.stix_cyber_observable.update_field(id=item["id"], input=input)
2420+
else:
2421+
self.opencti.stix_domain_object.update_field(id=item["id"], input=input)
2422+
24102423
def import_item(
24112424
self,
24122425
item,
@@ -2426,6 +2439,8 @@ def import_item(
24262439
target_id = item["merge_target_id"]
24272440
source_ids = item["merge_source_ids"]
24282441
self.opencti.stix.merge(id=target_id, object_ids=source_ids)
2442+
elif item["opencti_operation"] == "patch":
2443+
self.apply_patch(item=item)
24292444
else:
24302445
raise ValueError("Not supported opencti_operation")
24312446
elif item["type"] == "relationship":

0 commit comments

Comments
 (0)