Closed dilyanpalauzov closed 7 years ago
Thanks for the question, @dilyanpalauzov.
In CybOX, Observable
, Object
and Event
objects have (optional) IDs. We designed the python-cybox API so that you can create an Address
"object", and add it directly to the STIXPackage, and the intermediate Observable
and Object
objects get created along the way. Both of these are defined to automatically create IDs (see here and here) if not provided, which (while not strictly required) is a best practice.
There's nothing equivalent for Event
, though there certainly could be; it would need to be done in python-cybox, though, not python-stix. In my experience, Events are much, much less common in CybOX than Objects, so to be honest we haven't really put much time into them.
As a workaround, you can do:
import mixbox.idgen
ev = cybox.core.Event()
ev.id_ = mixbox.idgen.create_id(prefix="Event")
p.add_observable(ev)
For the above file stix-validator.py --best-practices
produces:
[-] Performing xml schema validation on z.xml
[-] Performing best practice validation on z.xml
==============================================================================
[-] Results: z.xml
[+] XML Schema: True
[!] Best Practices: False
[!] Missing IDs
[-] line : 21
[-] message : None
[-] id : None
[-] idref : None
[-] tag : {http://cybox.mitre.org/cybox-2}Event
This code
produces
Why does the address have an id, but not the event?