versioning¶
STIX2 core versioning methods.
-
new_version
(data, allow_custom=None, **kwargs)¶ Create a new version of a STIX object, by modifying properties and updating the
modified
property.Parameters: - data – The object to create a new version of. Maybe a stix2 object or dict.
- allow_custom – Whether to allow custom properties on the new object. If True, allow them (regardless of whether the original had custom properties); if False disallow them; if None, auto-detect from the object: if it has custom properties, allow them in the new version, otherwise don’t allow them.
- kwargs – The properties to change. Setting to None requests property removal.
Returns: The new object.
-
remove_custom_stix
(stix_obj)¶ Remove any custom STIX objects or properties.
Warning
This function is a best effort utility, in that it will remove custom objects and properties based on the type names; i.e. if “x-” prefixes object types, and “x_” prefixes property types. According to the STIX2 spec, those naming conventions are a SHOULDs not MUSTs, meaning that valid custom STIX content may ignore those conventions and in effect render this utility function invalid when used on that STIX content.
Parameters: stix_obj (dict OR python-stix obj) – a single python-stix object or dict of a STIX object Returns: A new version of the object with any custom content removed
-
revoke
(data)¶ Revoke a STIX object.
Returns: A new version of the object with revoked
set toTrue
.