@@ -420,7 +420,10 @@ def extract_embedded_relationships(
420420 stix_object ["kill_chain_phases" ] = self .opencti .get_attribute_in_extension (
421421 "kill_chain_phases" , stix_object
422422 )
423- if "kill_chain_phases" in stix_object :
423+ if (
424+ "kill_chain_phases" in stix_object
425+ and stix_object ["kill_chain_phases" ] is not None
426+ ):
424427 for kill_chain_phase in stix_object ["kill_chain_phases" ]:
425428 if (
426429 kill_chain_phase ["kill_chain_name" ] + kill_chain_phase ["phase_name" ]
@@ -463,7 +466,10 @@ def extract_embedded_relationships(
463466 "type" : kill_chain_phase ["entity_type" ],
464467 }
465468 kill_chain_phases_ids .append (kill_chain_phase ["id" ])
466- elif "x_opencti_kill_chain_phases" in stix_object :
469+ elif (
470+ "x_opencti_kill_chain_phases" in stix_object
471+ and stix_object ["x_opencti_kill_chain_phases" ] is not None
472+ ):
467473 for kill_chain_phase in stix_object ["x_opencti_kill_chain_phases" ]:
468474 if (
469475 kill_chain_phase ["kill_chain_name" ] + kill_chain_phase ["phase_name" ]
@@ -525,7 +531,10 @@ def extract_embedded_relationships(
525531 "external_references" , stix_object
526532 )
527533 )
528- if "external_references" in stix_object :
534+ if (
535+ "external_references" in stix_object
536+ and stix_object ["external_references" ] is not None
537+ ):
529538 for external_reference in stix_object ["external_references" ]:
530539 try :
531540 url = (
@@ -706,7 +715,10 @@ def extract_embedded_relationships(
706715 self .opencti .app_logger .warning (
707716 "Cannot generate external reference"
708717 )
709- elif "x_opencti_external_references" in stix_object :
718+ elif (
719+ "x_opencti_external_references" in stix_object
720+ and stix_object ["x_opencti_external_references" ] is not None
721+ ):
710722 for external_reference in stix_object ["x_opencti_external_references" ]:
711723 url = external_reference ["url" ] if "url" in external_reference else None
712724 source_name = (
@@ -775,7 +787,10 @@ def extract_embedded_relationships(
775787 granted_refs_ids = self .opencti .get_attribute_in_extension (
776788 "granted_refs" , stix_object
777789 )
778- elif "x_opencti_granted_refs" in stix_object :
790+ elif (
791+ "x_opencti_granted_refs" in stix_object
792+ and stix_object ["x_opencti_granted_refs" ] is not None
793+ ):
779794 granted_refs_ids = stix_object ["x_opencti_granted_refs" ]
780795 # Sample refs
781796 sample_refs_ids = (
0 commit comments