opencti
opencti copied to clipboard
[technical] wrong extension typing in StixCyberObject
Related to PR #6402
We found out that SCO might not have an extension STIX_EXT_OCTI_SCO once converted to stix. This caused issue in playbook, solved with proper checks.
Root issue is not addressed : we need to properly type StixCyberObject so that this extension can be undefined.
Obviously this lead to a bunch of errors to handle, mostly in stix-converter.ts.
We've reviewed the work to do and it's not a trivial task taht could be done on the same PR.
We need to rework how the utility functions buildStixCyberObservable and cleanObject work together.
With proper typing, we will implement proper checking everywhere (at leats in TS files) it's used and we'll probably save us some bugs in the future !
@SouadHadjiat & @labo-flg I remove the needs triage here even though I cannot reproduce, since I know the original bug. I'm not able to reproduce due to my limited competences in development but trust you there.
To be clear: this is purely a technical issue (typescript typing) that would make the code less error-prone when it comes to handling the stix extensions data. Not high priority IMO.