cti-python-stix2
cti-python-stix2 copied to clipboard
Granular marking constraint checking is incorrect
The STIX 2.1 spec section 7.2.3 says that one cannot include both lang and marking_ref in a granular marking:
Because each granular marking instance applies to either a language or a marking, one and only one of these properties MUST be present on each instance of a granular marking.
The library does not check this:
import stix2
granular_marking = stix2.GranularMarking(
lang="en",
marking_ref=stix2.TLP_GREEN,
selectors=["foo"]
)
granular_marking.fp_serialize(sys.stdout, indent=4)
results in:
{
"lang": "en",
"marking_ref": "marking-definition--34098fce-860f-48ae-8e50-ebd3cc5e41da",
"selectors": [
"foo"
]
}
which is invalid.