Add documentation about _id_contributing_properties for custom SCOs. Will add in code example once PR 354 is merged in

master
Desai, Kartikey H 2020-02-27 16:00:59 -05:00 committed by Chris Lenk
parent 47b28d1194
commit 02171996fa
1 changed files with 17 additions and 7 deletions

View File

@ -1486,17 +1486,17 @@
"source": [
"## Deterministic IDs for Cyber Observables\n",
"### Deterministic IDs\n",
"STIX 2.1 Cyber Observables (SCOs) have an ID property since SCOs are now top-level objects. However, SCOs have deterministic IDs, meaning that the ID of a SCO is based on the values of its properties. Thus, if multiple cyber observables of the same type have the same values for their ID contributing properties (explained below), then these SCOs will have the same ID; the SCOs' ID is deterministic because the ID will not change if the values of the ID contributing properties do not change. \n",
"STIX 2.1 Cyber Observables (SCOs) have an ID property since SCOs are now top-level objects. However, SCOs have deterministic IDs, meaning that the ID of a SCO is based on the values of its properties. Thus, if multiple cyber observables of the same type have the same values for their ID-contributing properties (explained below), then these SCOs will have the same ID; the SCOs' ID is deterministic because the ID will not change if the values of the ID contributing properties do not change. \n",
"\n",
"A UUIDv5 is generated for the deterministic IDs, using the namespace `\"00abedb4-aa42-466c-9c01-fed23315a9b7\"`.\n",
"\n",
"In the case where a SCO does not have any defined ID contributing properties, or in the case where all of the values for the ID contributing properties are not specified, then the SCO will be assigned a randomly-generated UUIDv4.\n",
"In the case where a SCO does not have any defined ID contributing properties, or in the case where all of the values for the ID-contributing properties are not specified, then the SCO will be assigned a randomly-generated UUIDv4.\n",
"\n",
"### ID Contributing Properties\n",
"So, what are ID contributing properties? \n",
"### ID-Contributing Properties\n",
"So, what are ID-contributing properties? \n",
"Every SCO has multiple defined properties, but the values of only some of those properties will contribute to the determination of the SCO's ID. \n",
"\n",
"A SCO's ID contributing properties may contain a combination of required properties and optional properties. And it is possible for all of the ID contributing properties to be optional, which means the corresponding SCO could be created without values for any of those properties, which would lead the SCO to have a randomly-generated UUIDv4 ID.\n",
"A SCO's ID-contributing properties may contain a combination of required properties and optional properties. And it is possible for all of the ID-contributing properties to be optional, which means the corresponding SCO could be created without values for any of those properties, which would lead the SCO to have a randomly-generated UUIDv4 ID.\n",
"\n",
"\n",
"We will demonstrate deterministic IDs by creating four `EmailAddress` SCOs. The `EmailAddress` SCO has one ID contributing property: `value`."
@ -1856,9 +1856,19 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice that the ID for the first three `EmailAddress` objects is the same while the ID for the fourth is different. This is because the first three objects all have the same value for the ID contributing property. And this is despite having a different value for the `display_name` property, since it is not an ID contributing property for the `EmailAddress` SCO.\n",
"Notice that the ID for the first three `EmailAddress` objects is the same while the ID for the fourth is different. This is because the first three objects all have the same value for the ID-contributing property. And this is despite having a different value for the `display_name` property, since it is not an ID-contributing property for the `EmailAddress` SCO.\n",
"\n",
"Also note that the fourth object has a different ID despite having the same `display_name` as the first two objects; the value for the fourth object's ID contributing property is different."
"Also note that the fourth object has a different ID despite having the same `display_name` as the first two objects; the value for the fourth object's ID-contributing property is different."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ID-Contributing Properties for Custom Cyber Observables\n",
"While all custom STIX 2.1 Cyber Observables (SCOs) have randomly-generated UUIDv4 IDs by default, you can optionally define which, if any, of your custom SCO's properties should be ID-contributing properties. Similar to standard SCOs, your custom SCO's ID-contributing properties can be any combination of the SCO's required and optional properties.\n",
"\n",
"You define the ID-contributing properties right when creating your custom SCO. See the example below: (taken from `stix2/test/v21/test_custom.py` `test_custom_observable_object_det_id_1()` )"
]
},
{