diff --git a/incident-ef7/src/incident/event.py b/incident-ef7/src/incident/event.py index 4fa8a92..eb88afe 100644 --- a/incident-ef7/src/incident/event.py +++ b/incident-ef7/src/incident/event.py @@ -1,11 +1,10 @@ from collections import OrderedDict import stix2 -from stix2.exceptions import ObjectConfigurationError -from stix2.properties import (BooleanProperty, EnumProperty, ListProperty, - OpenVocabProperty, ReferenceProperty, - StringProperty, TimestampProperty) -from stix2.v21.base import _STIXBase21 +from stix2.properties import (BooleanProperty, EnumProperty, EmbeddedObjectProperty, + IntegerProperty, ListProperty, OpenVocabProperty, + ReferenceProperty, StringProperty, + TimestampProperty) import incident.vocab as vocab from incident.common import StateChange @@ -29,7 +28,7 @@ class EventEntry(_STIXBase21): # required properties ('event_ref', ReferenceProperty(valid_types='event', required=True)), # optional properties - ('next_steps', ListProperty(EventSequenceEntry)), + ('next_steps', ListProperty(EmbeddedObjectProperty(EventSequenceEntry))), ('sequence_start', BooleanProperty(default=lambda: True)) ]) @@ -40,7 +39,7 @@ class EventEntry(_STIXBase21): # required properties ('status', EnumProperty(vocab.EVENT_STATUS, required=True)), # optional properties - ('changed_objects', ListProperty(StateChange)), + ('changed_objects', ListProperty(EmbeddedObjectProperty(StateChange))), ('description', StringProperty()), ('end_time', TimestampProperty()), ('end_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY)), @@ -50,7 +49,7 @@ class EventEntry(_STIXBase21): ('sighting_refs', ListProperty(ReferenceProperty(valid_types='sighting'))), ('start_time', TimestampProperty()), ('start_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY)), - ('subevents', ListProperty(EventEntry)), + ('subevents', ListProperty(EmbeddedObjectProperty(EventEntry))), ], EVENT_EXTENSION_DEFINITION_ID ) diff --git a/incident-ef7/src/incident/incident.py b/incident-ef7/src/incident/incident.py index 91f2d44..e02a8ca 100644 --- a/incident-ef7/src/incident/incident.py +++ b/incident-ef7/src/incident/incident.py @@ -1,7 +1,7 @@ from collections import OrderedDict import stix2 -from stix2.properties import (EnumProperty, FloatProperty, IntegerProperty, +from stix2.properties import (EmbeddedObjectProperty, EnumProperty, FloatProperty, IntegerProperty, ListProperty, OpenVocabProperty, ReferenceProperty, StringProperty) from stix2.v21.base import _STIXBase21 @@ -32,13 +32,13 @@ class IncidentScore(_STIXBase21): # optional properties ('criticality', IntegerProperty(min=0, max=100)), ('detection_methods', ListProperty(OpenVocabProperty(vocab.DETECTION_METHODS))), - ('events', ListProperty(EventEntry)), + ('events', ListProperty(EmbeddedObjectProperty(EventEntry))), ('impact_refs', ListProperty(ReferenceProperty(valid_types='impact'))), ('impacted_entity_counts', EntityCountProperty(spec_version='2.1')), ('incident_types', ListProperty(OpenVocabProperty(vocab.EVENT_TYPE))), ('recoverability', EnumProperty(vocab.RECOVERABILITY)), - ('scores', ListProperty(IncidentScore)), - ('tasks', ListProperty(TaskEntry)), + ('scores', ListProperty(EmbeddedObjectProperty(IncidentScore))), + ('tasks', ListProperty(EmbeddedObjectProperty(TaskEntry))), ], ) class IncidentExtension: diff --git a/incident-ef7/src/incident/task.py b/incident-ef7/src/incident/task.py index 1e1c268..921526e 100644 --- a/incident-ef7/src/incident/task.py +++ b/incident-ef7/src/incident/task.py @@ -2,8 +2,8 @@ import stix2 from stix2.exceptions import ObjectConfigurationError -from stix2.properties import (BooleanProperty, EnumProperty, IntegerProperty, - ListProperty, OpenVocabProperty, +from stix2.properties import (BooleanProperty, EnumProperty, EmbeddedObjectProperty, + IntegerProperty, ListProperty, OpenVocabProperty, ReferenceProperty, StringProperty, TimestampProperty) from stix2.v21 import _STIXBase21 @@ -30,7 +30,7 @@ class TaskEntry(_STIXBase21): # required properties ('task_ref', ReferenceProperty(valid_types='task', required=True)), # optional properties - ('next_steps', ListProperty(TaskSequenceEntry)), + ('next_steps', ListProperty(EmbeddedObjectProperty(TaskSequenceEntry))), ('sequence_start', BooleanProperty(default=lambda: True)) ]) @@ -41,7 +41,7 @@ class TaskEntry(_STIXBase21): # required properties ('outcome', EnumProperty(vocab.TASK_OUTCOME, required=True)), # optional properties - ('changed_objects', ListProperty(StateChange)), + ('changed_objects', ListProperty(EmbeddedObjectProperty(StateChange))), ('task_types', ListProperty(OpenVocabProperty(vocab.TASK_TYPE))), ('description', StringProperty()), ('end_time', TimestampProperty()), @@ -52,7 +52,7 @@ class TaskEntry(_STIXBase21): ('priority', IntegerProperty(min=0, max=100)), ('start_time', TimestampProperty()), ('start_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY)), - ('subtasks', ListProperty(TaskEntry)) + ('subtasks', ListProperty(EmbeddedObjectProperty(TaskEntry))) ], TASK_EXTENSION_DEFINITION_ID )