stix2arango 1.1.5__tar.gz → 1.1.6__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.

Files changed (109) hide show
  1. {stix2arango-1.1.5 → stix2arango-1.1.6}/PKG-INFO +1 -1
  2. {stix2arango-1.1.5 → stix2arango-1.1.6}/pyproject.toml +1 -1
  3. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/stix2arango/bundle_loader.py +0 -3
  4. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/test_bundle_loader.py +44 -18
  5. {stix2arango-1.1.5 → stix2arango-1.1.6}/.env.example +0 -0
  6. {stix2arango-1.1.5 → stix2arango-1.1.6}/.env.markdown +0 -0
  7. {stix2arango-1.1.5 → stix2arango-1.1.6}/.github/workflows/create-release.yml +0 -0
  8. {stix2arango-1.1.5 → stix2arango-1.1.6}/.github/workflows/run-tests.yml +0 -0
  9. {stix2arango-1.1.5 → stix2arango-1.1.6}/.gitignore +0 -0
  10. {stix2arango-1.1.5 → stix2arango-1.1.6}/LICENSE +0 -0
  11. {stix2arango-1.1.5 → stix2arango-1.1.6}/README.md +0 -0
  12. {stix2arango-1.1.5 → stix2arango-1.1.6}/docs/README.md +0 -0
  13. {stix2arango-1.1.5 → stix2arango-1.1.6}/docs/stix2arango.png +0 -0
  14. {stix2arango-1.1.5 → stix2arango-1.1.6}/requirements.txt +0 -0
  15. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/__init__.py +0 -0
  16. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/__main__.py +0 -0
  17. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/config.py +0 -0
  18. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/services/__init__.py +0 -0
  19. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/services/arangodb_service.py +0 -0
  20. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/services/version_annotator.py +0 -0
  21. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/stix2arango/__init__.py +0 -0
  22. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/stix2arango/stix2arango.py +0 -0
  23. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/templates/marking-definition.json +0 -0
  24. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango/utils.py +0 -0
  25. {stix2arango-1.1.5 → stix2arango-1.1.6}/stix2arango.py +0 -0
  26. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/README.md +0 -0
  27. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/custom-sco-original.json +0 -0
  28. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/custom-sco-updated.json +0 -0
  29. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/custom-sdo-original.json +0 -0
  30. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/custom-sdo-updated.json +0 -0
  31. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/duplicate-objects-all-properties-same.json +0 -0
  32. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/duplicate-objects-properties-different.json +0 -0
  33. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/embedded-ref-object-removed.json +0 -0
  34. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/embedded-ref-object-updated.json +0 -0
  35. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/embedded-ref-object.json +0 -0
  36. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/embedded-ref-sdo-sco-sro-smo.json +0 -0
  37. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/nested-embedded-ref.json +0 -0
  38. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/non-standard-embedded-relationship.json +0 -0
  39. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sco-original.json +0 -0
  40. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sco-updated.json +0 -0
  41. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sigma-rule-bundle-another.json +0 -0
  42. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sigma-rule-bundle-condensed-original.json +0 -0
  43. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sigma-rule-bundle-condensed-update-1.json +0 -0
  44. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sigma-rule-bundle-condensed-update-2.json +0 -0
  45. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sigma-rule-bundle-yet-another.json +0 -0
  46. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sigma-rule-bundle.json +0 -0
  47. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/smo-embedded-ref-1.json +0 -0
  48. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/smo-embedded-ref-2.json +0 -0
  49. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/smo-original.json +0 -0
  50. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/smo-updated-2.json +0 -0
  51. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/smo-updated.json +0 -0
  52. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/source-object-does-not-exist.json +0 -0
  53. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sro-original.json +0 -0
  54. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/sro-updated.json +0 -0
  55. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/target-object-does-not-exist.json +0 -0
  56. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/update_with_diff_modified_times_1.json +0 -0
  57. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/files/stix2arango/update_with_diff_modified_times_2.json +0 -0
  58. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/requirements.txt +0 -0
  59. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/__init__.py +0 -0
  60. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/base_test.py +0 -0
  61. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_00-basic-import-logic-with-embedded.py +0 -0
  62. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_01-basic-import-no-embedded.py +0 -0
  63. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_02-basic-import-no-stix2arango_note.py +0 -0
  64. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_03-import-with-no-update-detected.py +0 -0
  65. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_04-update-detected-because-of-stix2arango-note.py +0 -0
  66. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_05-update-detected-because-of-modified-time-change.py +0 -0
  67. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_06-update-detected-because-of-modified-time-change-not-in-order.py +0 -0
  68. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_07-test-default-imported-objects.py +0 -0
  69. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_08-duplicate-objects-in-bundle-all-identical.py +0 -0
  70. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_09-duplicate-objects-but-diff-times-in-bundle.py +0 -0
  71. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_10-updating-object-no-modified-time.py +0 -0
  72. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_11-custom-sdos.py +0 -0
  73. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_12-custom-scos.py +0 -0
  74. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_13-updating-smos.py +0 -0
  75. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_14-non-standard-embedded-relationship.py +0 -0
  76. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_15-testing-when-sro-target-not-in-collection.py +0 -0
  77. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_16-testing-when-sro-source-not-in-collection.py +0 -0
  78. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_17-testing-update-of-embedded-refs.py +0 -0
  79. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_18-testing-nested-embedded-ref.py +0 -0
  80. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_19_update_with_diff_created_times.py +0 -0
  81. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_20-embedded-sro-update-for-sdo.py +0 -0
  82. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_21-embedded-sro-update-for-sco.py +0 -0
  83. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_22-embedded-sro-update-for-smo.py +0 -0
  84. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_23-embedded-sro-removed.py +0 -0
  85. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_24-test-hidden-properties.py +0 -0
  86. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_25-ignore-embedded-rels-smo.py +0 -0
  87. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/full_tests/test_26-ignore-embedded-rels-sro.py +0 -0
  88. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/test_arango_service.py +0 -0
  89. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/test_main.py +0 -0
  90. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/test_stix2arango.py +0 -0
  91. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/src/test_utils.py +0 -0
  92. {stix2arango-1.1.5 → stix2arango-1.1.6}/tests/tests.env +0 -0
  93. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/README.md +0 -0
  94. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_atlas.py +0 -0
  95. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_attack_enterprise.py +0 -0
  96. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_attack_ics.py +0 -0
  97. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_attack_mobile.py +0 -0
  98. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_capec.py +0 -0
  99. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_cwe.py +0 -0
  100. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_disarm.py +0 -0
  101. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_locations.py +0 -0
  102. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_sigma_rules.py +0 -0
  103. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_tlp.py +0 -0
  104. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cti_processor/insert_archive_yara_rules.py +0 -0
  105. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cve_processor/README.md +0 -0
  106. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cve_processor/insert_archive_cve.py +0 -0
  107. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/arango_cve_processor/manager.py +0 -0
  108. {stix2arango-1.1.5 → stix2arango-1.1.6}/utilities/stix2arango/add_ref_types.py +0 -0
  109. {stix2arango-1.1.5 → stix2arango-1.1.6}/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.5
3
+ Version: 1.1.6
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "stix2arango"
7
- version = "1.1.5"
7
+ version = "1.1.6"
8
8
  authors = [
9
9
  { name = "dogesec" }
10
10
  ]
@@ -65,8 +65,6 @@ class BundleLoader:
65
65
  def get_refs(obj):
66
66
  refs = []
67
67
  for _type, targets in get_embedded_refs(obj):
68
- if _type in ["created-by", "object-marking"]:
69
- continue
70
68
  refs.extend(targets)
71
69
  return refs
72
70
 
@@ -95,7 +93,6 @@ class BundleLoader:
95
93
  all_ids.setdefault(tr, []).extend([sr, obj_id])
96
94
  for ref in self.get_refs(obj):
97
95
  all_ids[obj_id].append(ref)
98
- all_ids.setdefault(ref, []).append(obj_id)
99
96
  if len(to_insert) >= self.chunk_size_min:
100
97
  self.save_to_sqlite(to_insert)
101
98
  to_insert.clear()
@@ -5,31 +5,51 @@ import tempfile
5
5
  from pathlib import Path
6
6
  from unittest.mock import patch
7
7
 
8
- from stix2arango.stix2arango.bundle_loader import BundleLoader # adjust this import path
8
+ from stix2arango.stix2arango.bundle_loader import (
9
+ BundleLoader,
10
+ ) # adjust this import path
9
11
 
10
12
  # Sample bundle with related and unrelated objects
11
13
  STIX_BUNDLE = {
12
14
  "type": "bundle",
13
15
  "id": "bundle--example",
14
16
  "objects": [
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
- {"id": "relationship--1", "type": "relationship", "source_ref": "indicator--1", "target_ref": "indicator--2"},
17
+ {
18
+ "id": "indicator--1",
19
+ "type": "indicator",
20
+ "bad_ref": "some-ref--7",
21
+ "created_by_ref": "creator--1",
22
+ },
23
+ {
24
+ "id": "indicator--2",
25
+ "type": "indicator",
26
+ "object_marking_refs": ["marking--1", "marking--2"],
27
+ },
28
+ {
29
+ "id": "relationship--1",
30
+ "type": "relationship",
31
+ "source_ref": "indicator--1",
32
+ "target_ref": "indicator--2",
33
+ },
18
34
  {"id": "attack-pattern--3", "type": "attack-pattern"},
19
- ]
35
+ {"id": "marking--1", "type": "marking-definition"},
36
+ ],
20
37
  }
21
38
 
39
+
22
40
  @pytest.fixture
23
41
  def temp_json_file():
24
- with tempfile.NamedTemporaryFile(delete=False, mode='w', suffix='.json') as f:
42
+ with tempfile.NamedTemporaryFile(delete=False, mode="w", suffix=".json") as f:
25
43
  json.dump(STIX_BUNDLE, f)
26
44
  return f.name
27
45
 
46
+
28
47
  def test_init_db_and_tempfile_creation():
29
48
  loader = BundleLoader(file_path=tempfile.mkstemp()[1])
30
49
  assert isinstance(loader.db_path, str)
31
50
  assert Path(loader.db_path).exists()
32
51
 
52
+
33
53
  def test_save_to_sqlite_inserts_objects(temp_json_file):
34
54
  loader = BundleLoader(file_path=temp_json_file)
35
55
  objects = STIX_BUNDLE["objects"]
@@ -39,21 +59,24 @@ def test_save_to_sqlite_inserts_objects(temp_json_file):
39
59
  count = cursor.fetchone()[0]
40
60
  assert count == len(objects)
41
61
 
62
+
42
63
  def test_build_groups_creates_correct_groups(temp_json_file):
43
- loader = BundleLoader(file_path=temp_json_file, chunk_size_min=1)
64
+ loader = BundleLoader(file_path=temp_json_file, chunk_size_min=3)
44
65
  groups = loader.build_groups()
45
66
 
46
67
  # There should be at least 2 groups: one for related indicators, one for attack-pattern
47
68
  assert isinstance(groups, list)
48
69
  flat = [id_ for group in groups for id_ in group]
49
- assert "indicator--1" in flat
50
- assert "indicator--2" in flat
51
- assert "relationship--1" in flat
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
70
+ assert set(flat) == {
71
+ "some-ref--7",
72
+ "indicator--2",
73
+ "indicator--1",
74
+ "relationship--1",
75
+ "creator--1",
76
+ "attack-pattern--3",
77
+ "marking--1",
78
+ }
79
+
57
80
 
58
81
  def test_load_objects_by_ids(temp_json_file):
59
82
  loader = BundleLoader(file_path=temp_json_file)
@@ -63,6 +86,7 @@ def test_load_objects_by_ids(temp_json_file):
63
86
  assert isinstance(result, list)
64
87
  assert {obj["id"] for obj in result} == {"indicator--1", "attack-pattern--3"}
65
88
 
89
+
66
90
  def test_get_objects_returns_objects(temp_json_file):
67
91
  loader = BundleLoader(file_path=temp_json_file)
68
92
  loader.save_to_sqlite(STIX_BUNDLE["objects"])
@@ -71,6 +95,7 @@ def test_get_objects_returns_objects(temp_json_file):
71
95
  assert isinstance(result, list)
72
96
  assert result[0]["id"] == "indicator--1"
73
97
 
98
+
74
99
  def test_chunks_generator(temp_json_file):
75
100
  loader = BundleLoader(file_path=temp_json_file, chunk_size_min=1)
76
101
  chunks = list(loader.chunks)
@@ -80,18 +105,20 @@ def test_chunks_generator(temp_json_file):
80
105
  assert isinstance(chunk, list)
81
106
  assert all("id" in obj for obj in chunk)
82
107
 
108
+
83
109
  def test_chunks_with_no_existing_groups_calls_build_groups(temp_json_file):
84
110
  loader = BundleLoader(file_path=temp_json_file, chunk_size_min=1)
85
- with patch.object(loader, 'build_groups', wraps=loader.build_groups) as mocked:
111
+ with patch.object(loader, "build_groups", wraps=loader.build_groups) as mocked:
86
112
  chunks = list(loader.chunks)
87
113
  mocked.assert_called_once()
88
114
  assert len(chunks) > 0
89
115
 
116
+
90
117
  def test_no_crash_on_missing_relationship_fields(temp_json_file):
91
118
  # Remove `source_ref` and `target_ref` to simulate bad data
92
119
  bad_bundle = {
93
120
  "type": "bundle",
94
- "objects": [{"id": "bad--1", "type": "relationship"}]
121
+ "objects": [{"id": "bad--1", "type": "relationship"}],
95
122
  }
96
123
  with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".json") as f:
97
124
  json.dump(bad_bundle, f)
@@ -108,4 +135,3 @@ def test_sqlite_file_removed_after_gc(temp_json_file):
108
135
  assert db_path.exists()
109
136
  del loader
110
137
  assert not db_path.exists(), "should already be deleted"
111
-
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