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

Commit 7ca2dd2

Browse files
committed
[client] Implement missing granted_refs at creation
1 parent a973066 commit 7ca2dd2

27 files changed

+100
-77
lines changed

pycti/entities/opencti_attack_pattern.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ def import_from_stix2(self, **kwargs):
427427
stix_object[
428428
"x_opencti_stix_ids"
429429
] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
430-
if "granted_refs" not in stix_object:
431-
stix_object["granted_refs"] = self.opencti.get_attribute_in_extension(
432-
"granted_refs", stix_object
433-
)
430+
if "x_opencti_granted_refs" not in stix_object:
431+
stix_object[
432+
"x_opencti_granted_refs"
433+
] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
434434

435435
return self.create(
436436
stix_id=stix_object["id"],
@@ -478,8 +478,8 @@ def import_from_stix2(self, **kwargs):
478478
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
479479
if "x_opencti_stix_ids" in stix_object
480480
else None,
481-
objectOrganization=stix_object["granted_refs"]
482-
if "granted_refs" in stix_object
481+
objectOrganization=stix_object["x_opencti_granted_refs"]
482+
if "x_opencti_granted_refs" in stix_object
483483
else None,
484484
update=update,
485485
)

pycti/entities/opencti_campaign.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ def import_from_stix2(self, **kwargs):
350350
stix_object[
351351
"x_opencti_stix_ids"
352352
] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
353-
if "granted_refs" not in stix_object:
354-
stix_object["granted_refs"] = self.opencti.get_attribute_in_extension(
355-
"granted_refs", stix_object
356-
)
353+
if "x_opencti_granted_refs" not in stix_object:
354+
stix_object[
355+
"x_opencti_granted_refs"
356+
] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
357357

358358
return self.create(
359359
stix_id=stix_object["id"],
@@ -395,8 +395,8 @@ def import_from_stix2(self, **kwargs):
395395
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
396396
if "x_opencti_stix_ids" in stix_object
397397
else None,
398-
objectOrganization=stix_object["granted_refs"]
399-
if "granted_refs" in stix_object
398+
objectOrganization=stix_object["x_opencti_granted_refs"]
399+
if "x_opencti_granted_refs" in stix_object
400400
else None,
401401
update=update,
402402
)

pycti/entities/opencti_case_incident.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ def import_from_stix2(self, **kwargs):
634634
stix_object[
635635
"x_opencti_stix_ids"
636636
] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
637-
if "granted_refs" not in stix_object:
638-
stix_object["granted_refs"] = self.opencti.get_attribute_in_extension(
639-
"granted_refs", stix_object
640-
)
637+
if "x_opencti_granted_refs" not in stix_object:
638+
stix_object[
639+
"x_opencti_granted_refs"
640+
] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
641641
if "x_opencti_workflow_id" not in stix_object:
642642
stix_object[
643643
"x_opencti_workflow_id"
@@ -681,8 +681,8 @@ def import_from_stix2(self, **kwargs):
681681
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
682682
if "x_opencti_stix_ids" in stix_object
683683
else None,
684-
objectOrganization=stix_object["granted_refs"]
685-
if "granted_refs" in stix_object
684+
objectOrganization=stix_object["x_opencti_granted_refs"]
685+
if "x_opencti_granted_refs" in stix_object
686686
else None,
687687
x_opencti_workflow_id=stix_object["x_opencti_workflow_id"]
688688
if "x_opencti_workflow_id" in stix_object

pycti/entities/opencti_case_rfi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,10 @@ def import_from_stix2(self, **kwargs):
626626
stix_object[
627627
"x_opencti_stix_ids"
628628
] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
629-
if "granted_refs" not in stix_object:
630-
stix_object["granted_refs"] = self.opencti.get_attribute_in_extension(
631-
"granted_refs", stix_object
632-
)
629+
if "x_opencti_granted_refs" not in stix_object:
630+
stix_object[
631+
"x_opencti_granted_refs"
632+
] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
633633

634634
return self.create(
635635
stix_id=stix_object["id"],
@@ -662,8 +662,8 @@ def import_from_stix2(self, **kwargs):
662662
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
663663
if "x_opencti_stix_ids" in stix_object
664664
else None,
665-
objectOrganization=stix_object["granted_refs"]
666-
if "granted_refs" in stix_object
665+
objectOrganization=stix_object["x_opencti_granted_refs"]
666+
if "x_opencti_granted_refs" in stix_object
667667
else None,
668668
update=update,
669669
information_types=stix_object["information_types"]

pycti/entities/opencti_case_rft.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,10 @@ def import_from_stix2(self, **kwargs):
622622
stix_object[
623623
"x_opencti_stix_ids"
624624
] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
625-
if "granted_refs" not in stix_object:
626-
stix_object["granted_refs"] = self.opencti.get_attribute_in_extension(
627-
"granted_refs", stix_object
628-
)
625+
if "x_opencti_granted_refs" not in stix_object:
626+
stix_object[
627+
"x_opencti_granted_refs"
628+
] = self.opencti.get_attribute_in_extension("granted_refs", stix_object)
629629

630630
return self.create(
631631
stix_id=stix_object["id"],
@@ -661,8 +661,8 @@ def import_from_stix2(self, **kwargs):
661661
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
662662
if "x_opencti_stix_ids" in stix_object
663663
else None,
664-
objectOrganization=stix_object["granted_refs"]
665-
if "granted_refs" in stix_object
664+
objectOrganization=stix_object["x_opencti_granted_refs"]
665+
if "x_opencti_granted_refs" in stix_object
666666
else None,
667667
update=update,
668668
)

pycti/entities/opencti_channel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ def import_from_stix2(self, **kwargs):
383383
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
384384
if "x_opencti_stix_ids" in stix_object
385385
else None,
386-
objectOrganization=stix_object["granted_refs"]
387-
if "granted_refs" in stix_object
386+
objectOrganization=stix_object["x_opencti_granted_refs"]
387+
if "x_opencti_granted_refs" in stix_object
388388
else None,
389389
update=update,
390390
)

pycti/entities/opencti_course_of_action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ def import_from_stix2(self, **kwargs):
415415
else None,
416416
x_opencti_aliases=self.opencti.stix2.pick_aliases(stix_object),
417417
x_mitre_id=x_mitre_id,
418-
objectOrganization=stix_object["granted_refs"]
419-
if "granted_refs" in stix_object
418+
objectOrganization=stix_object["x_opencti_granted_refs"]
419+
if "x_opencti_granted_refs" in stix_object
420420
else None,
421421
update=update,
422422
)

pycti/entities/opencti_data_component.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ def import_from_stix2(self, **kwargs):
421421
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
422422
if "x_opencti_stix_ids" in stix_object
423423
else None,
424-
objectOrganization=stix_object["granted_refs"]
425-
if "granted_refs" in stix_object
424+
objectOrganization=stix_object["x_opencti_granted_refs"]
425+
if "x_opencti_granted_refs" in stix_object
426426
else None,
427427
update=update,
428428
)

pycti/entities/opencti_data_source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ def import_from_stix2(self, **kwargs):
413413
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
414414
if "x_opencti_stix_ids" in stix_object
415415
else None,
416-
objectOrganization=stix_object["granted_refs"]
417-
if "granted_refs" in stix_object
416+
objectOrganization=stix_object["x_opencti_granted_refs"]
417+
if "x_opencti_granted_refs" in stix_object
418418
else None,
419419
update=update,
420420
)

pycti/entities/opencti_feedback.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ def import_from_stix2(self, **kwargs):
685685
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
686686
if "x_opencti_stix_ids" in stix_object
687687
else None,
688-
objectOrganization=stix_object["granted_refs"]
689-
if "granted_refs" in stix_object
688+
objectOrganization=stix_object["x_opencti_granted_refs"]
689+
if "x_opencti_granted_refs" in stix_object
690690
else None,
691691
update=update,
692692
)

0 commit comments

Comments
 (0)