Skip to content

Commit

Permalink
add latest incident properties
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiazza committed Dec 4, 2024
1 parent 2e2ffe6 commit 35a9487
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions incident-ef7/src/incident/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import stix2
from stix2.exceptions import ObjectConfigurationError
from stix2.properties import (numProperty, ListProperty,
from stix2.properties import (EmbeddedObjectProperty, EnumProperty, ListProperty,
OpenVocabProperty, ReferenceProperty,
StringProperty, TimestampProperty)

Expand All @@ -19,7 +19,7 @@
# required properties
('status', EnumProperty(vocab.EVENT_STATUS, required=True)),
# optional properties
('changed_objects', ListProperty(StateChange)),
('changed_objects', ListProperty(EmbeddedObjectProperty(type=StateChange))),
('description', StringProperty()),
('end_time', TimestampProperty()),
('end_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY)),
Expand Down
7 changes: 7 additions & 0 deletions incident-ef7/src/incident/impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


@stix2.CustomExtension(
applies_to="sdo",
type="availability-ext",
properties=OrderedDict([
# required properties
Expand All @@ -24,6 +25,7 @@ class AvailabilityImpactExt:


@stix2.CustomExtension(
applies_to="sdo",
type="confidentiality-ext",
properties=OrderedDict([
# required properties
Expand All @@ -46,6 +48,7 @@ def _check_object_constraints(self):


@stix2.CustomExtension(
applies_to="sdo",
type="external-ext",
properties=OrderedDict([
# required properties
Expand All @@ -57,6 +60,7 @@ class ExternalImpactExt:


@stix2.CustomExtension(
applies_to="sdo",
type="integrity-ext",
properties=OrderedDict([
# required properties
Expand All @@ -78,6 +82,7 @@ def _check_object_constraints(self):


@stix2.CustomExtension(
applies_to="sdo",
type="monetary-ext",
properties=OrderedDict([
# required properties
Expand Down Expand Up @@ -140,6 +145,7 @@ def _check_object_constraints(self):


@stix2.CustomExtension(
applies_to="sdo",
type="physical-ext",
properties=OrderedDict([
# required properties
Expand All @@ -158,6 +164,7 @@ def _check_object_constraints(self):


@stix2.CustomExtension(
applies_to="sdo",
type="traceability-ext",
properties=OrderedDict([
# required properties
Expand Down
6 changes: 4 additions & 2 deletions incident-ef7/src/incident/incident.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,7 +24,9 @@ class IncidentScore(_STIXBase21):


@stix2.v21.CustomExtension(
INCIDENT_EXTENSION_DEFINITION_ID, [
applies_to="sdo",
type=INCIDENT_EXTENSION_DEFINITION_ID,
properties=[
# required properties
('determination', EnumProperty(vocab.INCIDENT_DETERMINATION, required=True)),
('investigation_status', OpenVocabProperty(vocab.INCIDENT_INVESTIGATION, required=True)),
Expand Down
8 changes: 4 additions & 4 deletions incident-ef7/src/incident/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
ReferenceProperty, StringProperty,
TimestampProperty)

import util
import vocab
from .common import EntityCountProperty, StateChange
import util as util
import vocab as vocab
from common import EntityCountProperty, StateChange

# Event Extension Data
TASK_EXTENSION_DEFINITION_ID = 'extension-definition--2074a052-8be4-4932-849e-f5e7798e0030'
Expand All @@ -27,7 +27,7 @@
('end_time', TimestampProperty()),
('end_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY)),
('error', StringProperty()),
('impacted_entity_types', EntityCountProperty(spec_version='2.1')),
('impacted_entity_counts', EntityCountProperty(valid_types=[IntegerProperty, FloatProperty], spec_version='2.1')),
('name', StringProperty()),
('next_task_ref', ListProperty(ReferenceProperty(valid_types='task'))),
('priority', IntegerProperty(min=0, max=100)),
Expand Down

0 comments on commit 35a9487

Please sign in to comment.