Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pycti/entities/opencti_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def read(self, **kwargs):
)
return None

def handle_vocab(self, vocab, cache, field):
def read_or_create_unchecked_with_cache(self, vocab, cache, field):
if "vocab_" + vocab in cache:
vocab_data = cache["vocab_" + vocab]
else:
Expand Down
18 changes: 12 additions & 6 deletions pycti/utils/opencti_stix2.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,23 @@ def extract_embedded_relationships(
if isinstance(stix_object.get(f["key"]), list):
object_open_vocabularies[f["key"]] = []
for vocab in stix_object[f["key"]]:
object_open_vocabularies[f["key"]].append(
self.opencti.vocabulary.handle_vocab(
resolved_vocab = (
self.opencti.vocabulary.read_or_create_unchecked_with_cache(
vocab, self.mapping_cache_permanent, field=f
)["name"]
)
)
if resolved_vocab is not None:
object_open_vocabularies[f["key"]].append(
resolved_vocab["name"]
)
else:
object_open_vocabularies[f["key"]] = (
self.opencti.vocabulary.handle_vocab(
resolved_vocab = (
self.opencti.vocabulary.read_or_create_unchecked_with_cache(
stix_object[f["key"]], self.mapping_cache_permanent, field=f
)["name"]
)
)
if resolved_vocab is not None:
object_open_vocabularies[f["key"]] = resolved_vocab["name"]

# Object Labels
object_label_ids = []
Expand Down