Skip to content

Commit

Permalink
handle issues for db tables
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiazza committed Dec 4, 2024
1 parent 35a9487 commit 23efb4a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"work"
]


class ContactNumber(_STIXBase21):

_properties = OrderedDict([
Expand Down Expand Up @@ -50,7 +51,10 @@ class SocialMediaContact(_STIXBase21):


@stix2.v21.CustomExtension(
IDENTITY_CONTACT_INFORMATION_EXTENSION_DEFINITION_ID, [
applies_to="sdo",
type=IDENTITY_CONTACT_INFORMATION_EXTENSION_DEFINITION_ID,
properties=
[
('contact_numbers', ListProperty(ContactNumber)),
('email_addresses', ListProperty(EmailContact)),
('first_name', StringProperty()),
Expand Down
2 changes: 1 addition & 1 deletion incident-ef7/src/incident/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
('event_types', ListProperty(OpenVocabProperty(vocab.EVENT_TYPE))),
('goal', StringProperty()),
('name', StringProperty()),
('next_event_ref', ListProperty(ReferenceProperty(valid_types='event'))),
('next_event_refs', ListProperty(ReferenceProperty(valid_types='event'))),
('sighting_refs', ListProperty(ReferenceProperty(valid_types='sighting'))),
('start_time', TimestampProperty()),
('start_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY))
Expand Down
9 changes: 8 additions & 1 deletion incident-ef7/src/incident/impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
properties=OrderedDict([
# required properties
('availability_impact', IntegerProperty(min=0, max=100, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
])
)
class AvailabilityImpactExt:
Expand All @@ -30,6 +31,7 @@ class AvailabilityImpactExt:
properties=OrderedDict([
# required properties
('loss_type', EnumProperty(vocab.CONFIDENTIALITY_LOSS, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
# optional properties
('information_type', OpenVocabProperty(vocab.INFORMATION_TYPE)),
('record_count', IntegerProperty(min=0)),
Expand All @@ -53,6 +55,7 @@ def _check_object_constraints(self):
properties=OrderedDict([
# required properties
('impact_type', OpenVocabProperty(vocab.EXTERNAL_IMPACT, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
])
)
class ExternalImpactExt:
Expand All @@ -65,6 +68,7 @@ class ExternalImpactExt:
properties=OrderedDict([
# required properties
('alteration', EnumProperty(vocab.INTEGRITY_ALTERATION, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
# optional properties
('information_type', OpenVocabProperty(vocab.INFORMATION_TYPE)),
('record_count', IntegerProperty(min=0)),
Expand All @@ -87,6 +91,7 @@ def _check_object_constraints(self):
properties=OrderedDict([
# required properties
('variety', OpenVocabProperty(vocab.MONETARY_IMPACT, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
# optional properties
('conversion_rate', FloatProperty()),
('conversion_time', TimestampProperty()),
Expand Down Expand Up @@ -150,6 +155,7 @@ def _check_object_constraints(self):
properties=OrderedDict([
# required properties
('impact_type', EnumProperty(vocab.PHYSICAL_IMPACT, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
# optional properties
('asset_type', OpenVocabProperty(vocab.ASSET_TYPE))
])
Expand All @@ -168,7 +174,8 @@ def _check_object_constraints(self):
type="traceability-ext",
properties=OrderedDict([
# required properties
('traceability_impact', EnumProperty(vocab.TRACEABILITY_IMPACT, required=True))
('traceability_impact', EnumProperty(vocab.TRACEABILITY_IMPACT, required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
])
)
class TraceabilityImpactExt:
Expand Down
2 changes: 1 addition & 1 deletion incident-ef7/src/incident/incident.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ReferenceProperty, StringProperty)
from stix2.v21.base import _STIXBase21

import vocab
import incident.vocab as vocab
from .common import EntityCountProperty


Expand Down
10 changes: 5 additions & 5 deletions incident-ef7/src/incident/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

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

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

# Event Extension Data
TASK_EXTENSION_DEFINITION_ID = 'extension-definition--2074a052-8be4-4932-849e-f5e7798e0030'
Expand All @@ -29,7 +29,7 @@
('error', StringProperty()),
('impacted_entity_counts', EntityCountProperty(valid_types=[IntegerProperty, FloatProperty], spec_version='2.1')),
('name', StringProperty()),
('next_task_ref', ListProperty(ReferenceProperty(valid_types='task'))),
('next_task_refs', ListProperty(ReferenceProperty(valid_types='task'))),
('priority', IntegerProperty(min=0, max=100)),
('start_time', TimestampProperty()),
('start_time_fidelity', EnumProperty(vocab.TIMESTAMP_FIDELITY))
Expand Down
1 change: 1 addition & 0 deletions observed-string-8b1/src/observed_string/observed_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# required fields
('purpose', OpenVocabProperty(STRING_PURPOSE, required=True)),
('value', StringProperty(required=True)),
('extension_type', StringProperty(fixed=None)), # needed to indicate it's a sub object extension
], ['purpose', 'value'], OBSERVED_STRING_EXTENSION_ID,
)
class ObservedString:
Expand Down

0 comments on commit 23efb4a

Please sign in to comment.