From 96946d956d41b4c9c9b24683add88f457181ee75 Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Fri, 17 Jan 2020 17:13:43 +0100 Subject: [PATCH] fix: Avoid errors with custom object ids in the list of object refs in the Report object --- stix2/properties.py | 2 +- stix2/v20/sdo.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stix2/properties.py b/stix2/properties.py index 9c3af1d..340a4ba 100644 --- a/stix2/properties.py +++ b/stix2/properties.py @@ -477,7 +477,7 @@ class ReferenceProperty(Property): if self.valid_types: ref_valid_types = enumerate_types(self.valid_types, 'v' + self.spec_version.replace(".", "")) - if possible_prefix in ref_valid_types: + if possible_prefix in ref_valid_types or self.allow_custom: required_prefix = possible_prefix + '--' else: raise ValueError("The type-specifying prefix '%s' for this property is not valid" % (possible_prefix)) diff --git a/stix2/v20/sdo.py b/stix2/v20/sdo.py index 6769873..b190449 100644 --- a/stix2/v20/sdo.py +++ b/stix2/v20/sdo.py @@ -250,6 +250,7 @@ class Report(STIXDomainObject): ]) def __init__(self, *args, **kwargs): + self._properties['object_refs'].contained.allow_custom = kwargs.get('allow_custom', False) self._properties['object_refs'].contained.interoperability = kwargs.get('interoperability', False) super(Report, self).__init__(*args, **kwargs)