From beb0854d9648edb55d03ccff41a0f78c3c46df99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Lima?= Date: Tue, 15 Oct 2024 12:45:18 +0000 Subject: [PATCH] fix: skip unallowed common properties provided by object factory --- stix2/environment.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stix2/environment.py b/stix2/environment.py index eab2ba9e..037e68d1 100644 --- a/stix2/environment.py +++ b/stix2/environment.py @@ -83,6 +83,13 @@ def create(self, cls, **kwargs): # Use self.defaults as the base, but update with any explicit args # provided by the user. properties = copy.deepcopy(self._defaults) + + # SCOs do not have these common properties provided by the factory + if "observables" in cls.__module__: + properties.pop("created", None) + properties.pop("created_by_ref", None) + properties.pop("external_references", None) + if kwargs: if self._list_append: # Append provided items to list properties instead of replacing them