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

Commit bee6de5

Browse files
committed
[client] Do not resolve from / to in sighting ingestion, so legacy...
1 parent ea3f1d3 commit bee6de5

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,38 +1314,6 @@ def import_sighting(
13141314
}
13151315

13161316
# Create the sighting
1317-
1318-
### Get the FROM
1319-
if from_id in self.mapping_cache:
1320-
final_from_id = self.mapping_cache[from_id]["id"]
1321-
else:
1322-
stix_object_result = (
1323-
self.opencti.opencti_stix_object_or_stix_relationship.read(id=from_id)
1324-
)
1325-
if stix_object_result is not None:
1326-
final_from_id = stix_object_result["id"]
1327-
else:
1328-
self.opencti.app_logger.error(
1329-
"From ref of the sighting not found, doing nothing..."
1330-
)
1331-
return None
1332-
1333-
### Get the TO
1334-
final_to_id = None
1335-
if to_id:
1336-
if to_id in self.mapping_cache:
1337-
final_to_id = self.mapping_cache[to_id]["id"]
1338-
else:
1339-
stix_object_result = (
1340-
self.opencti.opencti_stix_object_or_stix_relationship.read(id=to_id)
1341-
)
1342-
if stix_object_result is not None:
1343-
final_to_id = stix_object_result["id"]
1344-
else:
1345-
self.opencti.app_logger.error(
1346-
"To ref of the sighting not found, doing nothing..."
1347-
)
1348-
return None
13491317
if (
13501318
"x_opencti_negative" not in stix_sighting
13511319
and self.opencti.get_attribute_in_extension("negative", stix_sighting)
@@ -1359,8 +1327,8 @@ def import_sighting(
13591327
self.opencti.get_attribute_in_extension("workflow_id", stix_sighting)
13601328
)
13611329
stix_sighting_result = self.opencti.stix_sighting_relationship.create(
1362-
fromId=final_from_id,
1363-
toId=final_to_id,
1330+
fromId=from_id,
1331+
toId=to_id,
13641332
stix_id=stix_sighting["id"] if "id" in stix_sighting else None,
13651333
description=(
13661334
self.convert_markdown(stix_sighting["description"])

0 commit comments

Comments
 (0)