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

Commit af27b66

Browse files
author
Samuel Hassine
committed
Fix update observable created by ref
1 parent a6a8fe4 commit af27b66

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pycti/opencti_stix2.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,10 @@ def import_object(self, stix_object, update=False):
428428

429429
# Update created by ref
430430
if created_by_ref_id is not None and stix_object['type'] != 'marking-definition':
431-
self.opencti.update_stix_domain_entity_created_by_ref(stix_object_result['id'], created_by_ref_id)
431+
if stix_object['type'] == 'indicator':
432+
self.opencti.update_stix_observable_created_by_ref(stix_object_result['id'], created_by_ref_id)
433+
else:
434+
self.opencti.update_stix_domain_entity_created_by_ref(stix_object_result['id'], created_by_ref_id)
432435
# Add marking definitions
433436
for marking_definition_id in marking_definitions_ids:
434437
self.opencti.add_marking_definition_if_not_exists(stix_object_result['id'], marking_definition_id)
@@ -448,9 +451,15 @@ def import_object(self, stix_object, update=False):
448451
return stix_object_result
449452

450453
def create_marking_definition(self, stix_object, update=False):
454+
definition_type = stix_object['definition_type']
455+
definition = stix_object['definition'][stix_object['definition_type']]
456+
if stix_object['definition_type'] == 'tlp':
457+
definition_type = 'TLP'
458+
definition = 'TLP:' + stix_object['definition'][stix_object['definition_type']].upper()
459+
451460
return self.opencti.create_marking_definition_if_not_exists(
452-
stix_object['definition_type'],
453-
stix_object['definition'][stix_object['definition_type']],
461+
definition_type,
462+
definition,
454463
stix_object['x_opencti_level'] if 'x_opencti_level' in stix_object else 0,
455464
stix_object['x_opencti_color'] if 'x_opencti_color' in stix_object else None,
456465
stix_object['x_opencti_id'] if 'x_opencti_id' in stix_object else None,

0 commit comments

Comments
 (0)