Skip to content

Commit

Permalink
[client] Do not resolve from / to in sighting ingestion, so legacy...
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelHassine committed Sep 7, 2024
1 parent ea3f1d3 commit bee6de5
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions pycti/utils/opencti_stix2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,38 +1314,6 @@ def import_sighting(
}

# Create the sighting

### Get the FROM
if from_id in self.mapping_cache:
final_from_id = self.mapping_cache[from_id]["id"]
else:
stix_object_result = (
self.opencti.opencti_stix_object_or_stix_relationship.read(id=from_id)
)
if stix_object_result is not None:
final_from_id = stix_object_result["id"]
else:
self.opencti.app_logger.error(
"From ref of the sighting not found, doing nothing..."
)
return None

### Get the TO
final_to_id = None
if to_id:
if to_id in self.mapping_cache:
final_to_id = self.mapping_cache[to_id]["id"]
else:
stix_object_result = (
self.opencti.opencti_stix_object_or_stix_relationship.read(id=to_id)
)
if stix_object_result is not None:
final_to_id = stix_object_result["id"]
else:
self.opencti.app_logger.error(
"To ref of the sighting not found, doing nothing..."
)
return None
if (
"x_opencti_negative" not in stix_sighting
and self.opencti.get_attribute_in_extension("negative", stix_sighting)
Expand All @@ -1359,8 +1327,8 @@ def import_sighting(
self.opencti.get_attribute_in_extension("workflow_id", stix_sighting)
)
stix_sighting_result = self.opencti.stix_sighting_relationship.create(
fromId=final_from_id,
toId=final_to_id,
fromId=from_id,
toId=to_id,
stix_id=stix_sighting["id"] if "id" in stix_sighting else None,
description=(
self.convert_markdown(stix_sighting["description"])
Expand Down

0 comments on commit bee6de5

Please sign in to comment.