stix2arango 1.1.4__tar.gz → 1.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of stix2arango might be problematic. Click here for more details.
- {stix2arango-1.1.4 → stix2arango-1.1.5}/PKG-INFO +1 -1
- {stix2arango-1.1.4 → stix2arango-1.1.5}/pyproject.toml +1 -1
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/stix2arango/bundle_loader.py +41 -21
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/utils.py +3 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/test_bundle_loader.py +6 -2
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/test_utils.py +16 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/.env.example +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/.env.markdown +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/.github/workflows/create-release.yml +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/.github/workflows/run-tests.yml +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/.gitignore +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/LICENSE +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/README.md +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/docs/README.md +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/docs/stix2arango.png +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/requirements.txt +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/__init__.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/__main__.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/config.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/services/__init__.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/services/arangodb_service.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/services/version_annotator.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/stix2arango/__init__.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/stix2arango/stix2arango.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango/templates/marking-definition.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/stix2arango.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/README.md +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/custom-sco-original.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/custom-sco-updated.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/custom-sdo-original.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/custom-sdo-updated.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/duplicate-objects-all-properties-same.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/duplicate-objects-properties-different.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-object-removed.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-object-updated.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-object.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-sdo-sco-sro-smo.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/nested-embedded-ref.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/non-standard-embedded-relationship.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sco-original.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sco-updated.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-another.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-condensed-original.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-condensed-update-1.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-condensed-update-2.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-yet-another.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/smo-embedded-ref-1.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/smo-embedded-ref-2.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/smo-original.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/smo-updated-2.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/smo-updated.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/source-object-does-not-exist.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sro-original.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sro-updated.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/target-object-does-not-exist.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/update_with_diff_modified_times_1.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/update_with_diff_modified_times_2.json +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/requirements.txt +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/__init__.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/base_test.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_00-basic-import-logic-with-embedded.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_01-basic-import-no-embedded.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_02-basic-import-no-stix2arango_note.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_03-import-with-no-update-detected.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_04-update-detected-because-of-stix2arango-note.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_05-update-detected-because-of-modified-time-change.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_06-update-detected-because-of-modified-time-change-not-in-order.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_07-test-default-imported-objects.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_08-duplicate-objects-in-bundle-all-identical.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_09-duplicate-objects-but-diff-times-in-bundle.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_10-updating-object-no-modified-time.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_11-custom-sdos.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_12-custom-scos.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_13-updating-smos.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_14-non-standard-embedded-relationship.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_15-testing-when-sro-target-not-in-collection.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_16-testing-when-sro-source-not-in-collection.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_17-testing-update-of-embedded-refs.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_18-testing-nested-embedded-ref.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_19_update_with_diff_created_times.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_20-embedded-sro-update-for-sdo.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_21-embedded-sro-update-for-sco.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_22-embedded-sro-update-for-smo.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_23-embedded-sro-removed.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_24-test-hidden-properties.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_25-ignore-embedded-rels-smo.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_26-ignore-embedded-rels-sro.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/test_arango_service.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/test_main.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/test_stix2arango.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/tests/tests.env +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/README.md +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_atlas.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_attack_enterprise.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_attack_ics.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_attack_mobile.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_capec.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_cwe.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_disarm.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_locations.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_sigma_rules.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_tlp.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_yara_rules.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cve_processor/README.md +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cve_processor/insert_archive_cve.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cve_processor/manager.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/stix2arango/add_ref_types.py +0 -0
- {stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/stix2arango/update_taxii_index_with_date_transform.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stix2arango
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.5
|
|
4
4
|
Summary: 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.
|
|
5
5
|
Project-URL: Homepage, https://github.com/muchdogesec/stix2arango
|
|
6
6
|
Project-URL: Issues, https://github.com/muchdogesec/stix2arango/issues
|
|
@@ -10,6 +10,9 @@ import ijson
|
|
|
10
10
|
import json
|
|
11
11
|
from collections import Counter
|
|
12
12
|
|
|
13
|
+
from stix2arango.utils import get_embedded_refs
|
|
14
|
+
|
|
15
|
+
|
|
13
16
|
class BundleLoader:
|
|
14
17
|
def __init__(self, file_path, chunk_size_min=20_000, db_path=""):
|
|
15
18
|
self.file_path = Path(file_path)
|
|
@@ -19,34 +22,37 @@ class BundleLoader:
|
|
|
19
22
|
|
|
20
23
|
self.db_path = db_path
|
|
21
24
|
if not self.db_path:
|
|
22
|
-
self.temp_path = tempfile.NamedTemporaryFile(
|
|
25
|
+
self.temp_path = tempfile.NamedTemporaryFile(
|
|
26
|
+
prefix="s2a_bundle_loader--", suffix=".sqlite"
|
|
27
|
+
)
|
|
23
28
|
self.db_path = self.temp_path.name
|
|
24
29
|
self._init_db()
|
|
25
30
|
|
|
26
31
|
def _init_db(self):
|
|
27
32
|
"""Initialize SQLite DB with objects table."""
|
|
28
33
|
self.conn = sqlite3.connect(self.db_path)
|
|
29
|
-
self.conn.execute(
|
|
34
|
+
self.conn.execute(
|
|
35
|
+
"""
|
|
30
36
|
CREATE TABLE IF NOT EXISTS objects (
|
|
31
37
|
id TEXT PRIMARY KEY,
|
|
32
38
|
type TEXT,
|
|
33
39
|
raw TEXT
|
|
34
40
|
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
self.conn.execute(
|
|
38
|
-
self.conn.execute(
|
|
41
|
+
"""
|
|
42
|
+
)
|
|
43
|
+
self.conn.execute("PRAGMA synchronous = OFF;")
|
|
44
|
+
self.conn.execute("PRAGMA journal_mode = MEMORY;")
|
|
45
|
+
self.conn.execute("PRAGMA temp_store = MEMORY;")
|
|
39
46
|
self.conn.commit()
|
|
40
47
|
|
|
41
|
-
|
|
42
48
|
def save_to_sqlite(self, objects):
|
|
43
49
|
"""Save one STIX object to the SQLite database."""
|
|
44
|
-
self.inserted = getattr(self,
|
|
50
|
+
self.inserted = getattr(self, "inserted", 0)
|
|
45
51
|
|
|
46
52
|
try:
|
|
47
53
|
self.conn.executemany(
|
|
48
54
|
"INSERT OR REPLACE INTO objects (id, type, raw) VALUES (?, ?, ?)",
|
|
49
|
-
[(obj[
|
|
55
|
+
[(obj["id"], obj["type"], json.dumps(obj)) for obj in objects],
|
|
50
56
|
)
|
|
51
57
|
except sqlite3.IntegrityError as e:
|
|
52
58
|
print(f"Failed to insert len({objects}) objects: {e}")
|
|
@@ -55,6 +61,15 @@ class BundleLoader:
|
|
|
55
61
|
self.inserted += len(objects)
|
|
56
62
|
# logging.info(f"inserted {self.inserted}")
|
|
57
63
|
|
|
64
|
+
@staticmethod
|
|
65
|
+
def get_refs(obj):
|
|
66
|
+
refs = []
|
|
67
|
+
for _type, targets in get_embedded_refs(obj):
|
|
68
|
+
if _type in ["created-by", "object-marking"]:
|
|
69
|
+
continue
|
|
70
|
+
refs.extend(targets)
|
|
71
|
+
return refs
|
|
72
|
+
|
|
58
73
|
def build_groups(self):
|
|
59
74
|
"""
|
|
60
75
|
Iterates the STIX bundle and uses union-find to group IDs such that for every
|
|
@@ -63,30 +78,36 @@ class BundleLoader:
|
|
|
63
78
|
"""
|
|
64
79
|
all_ids: dict[str, list[str]] = dict() # All object IDs in the file
|
|
65
80
|
logging.info(f"loading into {self.db_path}")
|
|
66
|
-
|
|
67
|
-
with open(self.file_path,
|
|
68
|
-
objects = ijson.items(f,
|
|
81
|
+
|
|
82
|
+
with open(self.file_path, "rb") as f:
|
|
83
|
+
objects = ijson.items(f, "objects.item", use_float=True)
|
|
69
84
|
to_insert = []
|
|
70
85
|
for obj in objects:
|
|
71
|
-
obj_id = obj.get(
|
|
86
|
+
obj_id = obj.get("id")
|
|
72
87
|
to_insert.append(obj)
|
|
73
88
|
all_ids.setdefault(obj_id, [])
|
|
74
|
-
if obj[
|
|
75
|
-
|
|
89
|
+
if obj["type"] == "relationship" and all(
|
|
90
|
+
x in obj for x in ["target_ref", "source_ref"]
|
|
91
|
+
):
|
|
92
|
+
sr, tr = [obj["source_ref"], obj["target_ref"]]
|
|
76
93
|
all_ids[obj_id].extend([sr, tr])
|
|
77
94
|
all_ids.setdefault(sr, []).extend([tr, obj_id])
|
|
78
95
|
all_ids.setdefault(tr, []).extend([sr, obj_id])
|
|
96
|
+
for ref in self.get_refs(obj):
|
|
97
|
+
all_ids[obj_id].append(ref)
|
|
98
|
+
all_ids.setdefault(ref, []).append(obj_id)
|
|
79
99
|
if len(to_insert) >= self.chunk_size_min:
|
|
80
100
|
self.save_to_sqlite(to_insert)
|
|
81
101
|
to_insert.clear()
|
|
82
102
|
if to_insert:
|
|
83
103
|
self.save_to_sqlite(to_insert)
|
|
84
|
-
|
|
104
|
+
|
|
85
105
|
logging.info(f"loaded {self.inserted} into {self.db_path}")
|
|
86
106
|
handled = set()
|
|
87
107
|
|
|
88
108
|
self.groups = []
|
|
89
109
|
group = set()
|
|
110
|
+
|
|
90
111
|
def from_ids(all_ids):
|
|
91
112
|
for obj_id in all_ids:
|
|
92
113
|
if obj_id in handled:
|
|
@@ -104,18 +125,17 @@ class BundleLoader:
|
|
|
104
125
|
if group:
|
|
105
126
|
self.groups.append(tuple(group))
|
|
106
127
|
return self.groups
|
|
107
|
-
|
|
128
|
+
|
|
108
129
|
def load_objects_by_ids(self, ids):
|
|
109
130
|
"""Retrieve a list of STIX objects by their IDs from the SQLite database."""
|
|
110
|
-
placeholders =
|
|
131
|
+
placeholders = ",".join(["?"] * len(ids))
|
|
111
132
|
query = f"SELECT raw FROM objects WHERE id IN ({placeholders})"
|
|
112
133
|
cursor = self.conn.execute(query, list(ids))
|
|
113
134
|
return [json.loads(row[0]) for row in cursor.fetchall()]
|
|
114
135
|
|
|
115
|
-
|
|
116
136
|
def get_objects(self, group):
|
|
117
137
|
return list(self.load_objects_by_ids(group))
|
|
118
|
-
|
|
138
|
+
|
|
119
139
|
@property
|
|
120
140
|
def chunks(self):
|
|
121
141
|
for group in self.groups or self.build_groups():
|
|
@@ -123,4 +143,4 @@ class BundleLoader:
|
|
|
123
143
|
|
|
124
144
|
def __del__(self):
|
|
125
145
|
with contextlib.suppress(Exception):
|
|
126
|
-
os.remove(self.db_path)
|
|
146
|
+
os.remove(self.db_path)
|
|
@@ -125,6 +125,9 @@ def get_embedded_refs(object: list | dict, xpath: list = [], attributes=None):
|
|
|
125
125
|
if match := EMBEDDED_RELATIONSHIP_RE.fullmatch(key):
|
|
126
126
|
relationship_type = "-".join(xpath + match.group(1).split("_"))
|
|
127
127
|
targets = value if isinstance(value, list) else [value]
|
|
128
|
+
targets = [_target for _target in targets if _target and isinstance(_target, str)]
|
|
129
|
+
if not targets:
|
|
130
|
+
continue
|
|
128
131
|
if attributes and key not in attributes:
|
|
129
132
|
continue
|
|
130
133
|
embedded_refs.append((relationship_type, targets))
|
|
@@ -12,8 +12,8 @@ STIX_BUNDLE = {
|
|
|
12
12
|
"type": "bundle",
|
|
13
13
|
"id": "bundle--example",
|
|
14
14
|
"objects": [
|
|
15
|
-
{"id": "indicator--1", "type": "indicator"},
|
|
16
|
-
{"id": "indicator--2", "type": "indicator"},
|
|
15
|
+
{"id": "indicator--1", "type": "indicator", "bad_ref": "some-ref--7", "created_by_ref": "creator--1"},
|
|
16
|
+
{"id": "indicator--2", "type": "indicator", "object_marking_refs": ["marking--1", "marking--2"]},
|
|
17
17
|
{"id": "relationship--1", "type": "relationship", "source_ref": "indicator--1", "target_ref": "indicator--2"},
|
|
18
18
|
{"id": "attack-pattern--3", "type": "attack-pattern"},
|
|
19
19
|
]
|
|
@@ -50,6 +50,10 @@ def test_build_groups_creates_correct_groups(temp_json_file):
|
|
|
50
50
|
assert "indicator--2" in flat
|
|
51
51
|
assert "relationship--1" in flat
|
|
52
52
|
assert "attack-pattern--3" in flat
|
|
53
|
+
assert "some-ref--7" in flat
|
|
54
|
+
assert "marking--1" not in flat
|
|
55
|
+
assert "marking--2" not in flat
|
|
56
|
+
assert "creator--1" not in flat
|
|
53
57
|
|
|
54
58
|
def test_load_objects_by_ids(temp_json_file):
|
|
55
59
|
loader = BundleLoader(file_path=temp_json_file)
|
|
@@ -52,6 +52,22 @@ def test_get_embedded_refs():
|
|
|
52
52
|
("abcde-abcd-efgh", ["ref8"]),
|
|
53
53
|
]
|
|
54
54
|
|
|
55
|
+
def test_get_embedded_refs_empty():
|
|
56
|
+
assert utils.get_embedded_refs(
|
|
57
|
+
{
|
|
58
|
+
"abc_ref": "ref1",
|
|
59
|
+
"empty_ref": "", #skipped entirely
|
|
60
|
+
"some_empty_refs": ["ref10", "", "ref9"], # empty ref skipped
|
|
61
|
+
"abcd_refs": ["ref1", "ref2"],
|
|
62
|
+
"abcde": [{"abcdef_ref": "ref7"}, {"abcd_efgh_ref": "ref8"}],
|
|
63
|
+
}
|
|
64
|
+
) == [
|
|
65
|
+
("abc", ["ref1"]),
|
|
66
|
+
("some-empty", ["ref10", "ref9"]),
|
|
67
|
+
("abcd", ["ref1", "ref2"]),
|
|
68
|
+
("abcde-abcdef", ["ref7"]),
|
|
69
|
+
("abcde-abcd-efgh", ["ref8"]),
|
|
70
|
+
]
|
|
55
71
|
|
|
56
72
|
def test_get_embedded_refs__attributes_whitelist():
|
|
57
73
|
assert utils.get_embedded_refs(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-object-removed.json
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-object-updated.json
RENAMED
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/embedded-ref-sdo-sco-sro-smo.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-another.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/sigma-rule-bundle-yet-another.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/source-object-does-not-exist.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/files/stix2arango/target-object-does-not-exist.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_01-basic-import-no-embedded.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_18-testing-nested-embedded-ref.py
RENAMED
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_20-embedded-sro-update-for-sdo.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_21-embedded-sro-update-for-sco.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_22-embedded-sro-update-for-smo.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_23-embedded-sro-removed.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_24-test-hidden-properties.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_25-ignore-embedded-rels-smo.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/tests/src/full_tests/test_26-ignore-embedded-rels-sro.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_atlas.py
RENAMED
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_attack_ics.py
RENAMED
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_capec.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_cwe.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_disarm.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_locations.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_sigma_rules.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_tlp.py
RENAMED
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cti_processor/insert_archive_yara_rules.py
RENAMED
|
File without changes
|
|
File without changes
|
{stix2arango-1.1.4 → stix2arango-1.1.5}/utilities/arango_cve_processor/insert_archive_cve.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|