Bugfix/adding version fix#280
Conversation
meetghodasara-crest
commented
Dec 2, 2024
- Modified code to store actual serialized object without adding or removing any fields
- Adding versions in some of the objects where object type does not support versioning
eric-eclecticiq
left a comment
There was a problem hiding this comment.
It would require to add tests.
| self.db.session.commit() | ||
| job_details = [] | ||
| for obj in objects: | ||
| modified_date = obj.get("modified") or obj.get("created") or datetime.datetime.now(datetime.timezone.utc).strftime(DATETIMEFORMAT) |
There was a problem hiding this comment.
If a STIX object is not versioned (and therefore does not have a modified timestamp) then this version parameter MUST use the created timestamp. If an object does not have a created or modified timestamp or any other version information that can be used, then the server should use a value for the version that is consistent to the server.
So using created_at makes sense however I disagree with seting datetime.now at this point. This is hardly going to match the DB on version. It should probably go the else branch immediately to look for any version. Then, if not found, the version may be assigned to datetime.now.
| { | ||
| "id": obj.id, | ||
| "type": obj.type, | ||
| "spec_version": obj.type, |
|
A different implementation has been added with #280 . |
|
Thank you for your contribution in OpenTAXII. |