diff --git a/stix2/base.py b/stix2/base.py index dbe6461..a13cb98 100644 --- a/stix2/base.py +++ b/stix2/base.py @@ -23,6 +23,7 @@ from .utils import revoke as _revoke __all__ = ['STIXJSONEncoder', '_STIXBase'] DEFAULT_ERROR = "{type} must have {property}='{expected}'." +SCO_DET_ID_NAMESPACE = uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7") class STIXJSONEncoder(json.JSONEncoder): @@ -368,7 +369,6 @@ class _Observable(_STIXBase): def _generate_id(self, kwargs): required_prefix = self._type + "--" - namespace = uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7") properties_to_use = self._id_contributing_properties if properties_to_use: @@ -396,9 +396,9 @@ class _Observable(_STIXBase): # try/except here to enable python 2 compatibility try: - return required_prefix + six.text_type(uuid.uuid5(namespace, data)) + return required_prefix + six.text_type(uuid.uuid5(SCO_DET_ID_NAMESPACE, data)) except UnicodeDecodeError: - return required_prefix + six.text_type(uuid.uuid5(namespace, six.binary_type(data))) + return required_prefix + six.text_type(uuid.uuid5(SCO_DET_ID_NAMESPACE, six.binary_type(data))) # We return None if there are no values specified for any of the id-contributing-properties return None diff --git a/stix2/v21/observables.py b/stix2/v21/observables.py index 9fffeed..0d27bb4 100644 --- a/stix2/v21/observables.py +++ b/stix2/v21/observables.py @@ -50,7 +50,7 @@ class Artifact(_Observable): def _check_object_constraints(self): super(Artifact, self)._check_object_constraints() - self._check_mutually_exclusive_properties(['payload_bin', 'url'], at_least_one=False) + self._check_mutually_exclusive_properties(['payload_bin', 'url']) self._check_properties_dependency(['hashes'], ['url'])