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

Commit ac5bb79

Browse files
[client] Implement SecurityPlatform Identity type (opencti/10452)
Co-authored-by: Souad Hadjiat <[email protected]>
1 parent ec0895d commit ac5bb79

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

pycti/entities/opencti_identity.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def __init__(self, opencti):
5757
x_opencti_firstname
5858
x_opencti_lastname
5959
}
60+
... on SecurityPlatform {
61+
security_platform_type
62+
}
6063
}
6164
objectMarking {
6265
id
@@ -113,6 +116,9 @@ def __init__(self, opencti):
113116
x_opencti_organization_type
114117
x_opencti_score
115118
}
119+
... on SecurityPlatform {
120+
security_platform_type
121+
}
116122
"""
117123
self.properties_with_files = """
118124
id
@@ -160,6 +166,9 @@ def __init__(self, opencti):
160166
x_opencti_firstname
161167
x_opencti_lastname
162168
}
169+
... on SecurityPlatform {
170+
security_platform_type
171+
}
163172
}
164173
objectMarking {
165174
id
@@ -229,6 +238,9 @@ def __init__(self, opencti):
229238
x_opencti_organization_type
230239
x_opencti_score
231240
}
241+
... on SecurityPlatform {
242+
security_platform_type
243+
}
232244
importFiles {
233245
edges {
234246
node {
@@ -414,6 +426,7 @@ def create(self, **kwargs):
414426
contact_information = kwargs.get("contact_information", None)
415427
roles = kwargs.get("roles", None)
416428
x_opencti_aliases = kwargs.get("x_opencti_aliases", None)
429+
security_platform_type = kwargs.get("security_platform_type", None)
417430
x_opencti_organization_type = kwargs.get("x_opencti_organization_type", None)
418431
x_opencti_reliability = kwargs.get("x_opencti_reliability", None)
419432
x_opencti_score = kwargs.get("x_opencti_score", None)
@@ -463,6 +476,24 @@ def create(self, **kwargs):
463476
input_variables["x_opencti_reliability"] = x_opencti_reliability
464477
input_variables["x_opencti_score"] = x_opencti_score
465478
result_data_field = "organizationAdd"
479+
elif type == IdentityTypes.SECURITYPLATFORM.value:
480+
query = """
481+
mutation SecurityPlatformAdd($input: SecurityPlatformAddInput!) {
482+
securityPlatformAdd(input: $input) {
483+
id
484+
standard_id
485+
entity_type
486+
parent_types
487+
}
488+
}
489+
"""
490+
input_variables["security_platform_type"] = security_platform_type
491+
# no need for these attributes for security platform
492+
del input_variables["contact_information"]
493+
del input_variables["lang"]
494+
del input_variables["roles"]
495+
del input_variables["x_opencti_aliases"]
496+
result_data_field = "securityPlatformAdd"
466497
elif type == IdentityTypes.INDIVIDUAL.value:
467498
query = """
468499
mutation IndividualAdd($input: IndividualAddInput!) {
@@ -542,6 +573,8 @@ def import_from_stix2(self, **kwargs):
542573
type = "Sector"
543574
elif stix_object["identity_class"] == "system":
544575
type = "System"
576+
elif stix_object["identity_class"] == "securityplatform":
577+
type = "SecurityPlatform"
545578

546579
# Search in extensions
547580
if "x_opencti_aliases" not in stix_object:
@@ -554,6 +587,12 @@ def import_from_stix2(self, **kwargs):
554587
"organization_type", stix_object
555588
)
556589
)
590+
if "security_platform_type" not in stix_object:
591+
stix_object["security_platform_type"] = (
592+
self.opencti.get_attribute_in_extension(
593+
"security_platform_type", stix_object
594+
)
595+
)
557596
if "x_opencti_reliability" not in stix_object:
558597
stix_object["x_opencti_reliability"] = (
559598
self.opencti.get_attribute_in_extension("reliability", stix_object)
@@ -635,6 +674,11 @@ def import_from_stix2(self, **kwargs):
635674
if "x_opencti_organization_type" in stix_object
636675
else None
637676
),
677+
security_platform_type=(
678+
stix_object["security_platform_type"]
679+
if "security_platform_type" in stix_object
680+
else None
681+
),
638682
x_opencti_reliability=(
639683
stix_object["x_opencti_reliability"]
640684
if "x_opencti_reliability" in stix_object

pycti/utils/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class IdentityTypes(Enum):
5858
ORGANIZATION = "Organization"
5959
INDIVIDUAL = "Individual"
6060
SYSTEM = "System"
61+
SECURITYPLATFORM = "SecurityPlatform"
6162

6263
@classmethod
6364
def has_value(cls, value):

0 commit comments

Comments
 (0)