muchdogesec / stix2arango

stix2arango is a command line tool that takes a group of STIX 2.1 objects in a bundle and inserts them into ArangoDB. It can also handle updates to existing objects in ArangoDB imported in a bundle.
GNU Affero General Public License v3.0
1 stars 0 forks source link

Do not make embedded relationship keys hardcoded #5

Closed himynamesdave closed 3 weeks ago

himynamesdave commented 4 weeks ago

https://github.com/muchdogesec/stix2arango/blob/main/stix2arango/config.py#L41

Currently only certain keys are used to create embedded relationship.

We should not hardcode this as we cannot account for custom embedded relationship properties.

Any key ending with ref (single id) / _refs (_refs key has list of ids) should be used

Except for the following special ref properties....

 Relationships

The following default _ref attributes that are not be considered are the following (as they are found in relationship objects, and thus an SRO already exists to represent the relationship);

 Embedded relationships in Relationships created for embedded relationships

To avoid recursion any SRO object marked with _is_ref==true (that is has been generated by stix2arango for an embedded relationship) does not have any embedded relationships created from it. Doing so would cause an infinite recursion of _is_ref==true object generation.