Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 2252e6d

Browse files
committed
[client] handle too large items
1 parent b0c6e40 commit 2252e6d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
20962096
os.rename(write_file, final_write_file)
20972097

20982098
stix2_splitter = OpenCTIStix2Splitter()
2099-
(expectations_number, _, bundles) = (
2099+
(expectations_number, _, bundles, _) = (
21002100
stix2_splitter.split_bundle_with_expectations(
21012101
bundle=bundle,
21022102
use_json=True,

tests/01-unit/utils/test_opencti_stix2_splitter.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ def test_split_bundle():
1010
stix_splitter = OpenCTIStix2Splitter()
1111
with open("./tests/data/enterprise-attack.json") as file:
1212
content = file.read()
13-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
13+
expectations, _, bundles; _ = stix_splitter.split_bundle_with_expectations(content)
1414
assert expectations == 7016
1515

1616

1717
def test_split_test_bundle():
1818
stix_splitter = OpenCTIStix2Splitter()
1919
with open("./tests/data/DATA-TEST-STIX2_v2.json") as file:
2020
content = file.read()
21-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
21+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(content)
2222
assert expectations == 59
2323
base_bundles = json.loads(content)["objects"]
2424
for base in base_bundles:
@@ -40,13 +40,13 @@ def test_split_mono_entity_bundle():
4040
stix_splitter = OpenCTIStix2Splitter()
4141
with open("./tests/data/mono-bundle-entity.json") as file:
4242
content = file.read()
43-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
43+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(content)
4444
assert expectations == 1
4545
json_bundle = json.loads(bundles[0])["objects"][0]
4646
assert json_bundle["created_by_ref"] == "fa42a846-8d90-4e51-bc29-71d5b4802168"
4747
# Split with cleanup_inconsistent_bundle
4848
stix_splitter = OpenCTIStix2Splitter()
49-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(
49+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(
5050
bundle=content, cleanup_inconsistent_bundle=True
5151
)
5252
assert expectations == 1
@@ -58,11 +58,11 @@ def test_split_mono_relationship_bundle():
5858
stix_splitter = OpenCTIStix2Splitter()
5959
with open("./tests/data/mono-bundle-relationship.json") as file:
6060
content = file.read()
61-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
61+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(content)
6262
assert expectations == 1
6363
# Split with cleanup_inconsistent_bundle
6464
stix_splitter = OpenCTIStix2Splitter()
65-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(
65+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(
6666
bundle=content, cleanup_inconsistent_bundle=True
6767
)
6868
assert expectations == 0
@@ -72,7 +72,7 @@ def test_split_capec_bundle():
7272
stix_splitter = OpenCTIStix2Splitter()
7373
with open("./tests/data/mitre_att_capec.json") as file:
7474
content = file.read()
75-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
75+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(content)
7676
assert expectations == 2610
7777

7878

@@ -101,11 +101,11 @@ def test_split_missing_refs_bundle():
101101
stix_splitter = OpenCTIStix2Splitter()
102102
with open("./tests/data/missing_refs.json") as file:
103103
content = file.read()
104-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
104+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(content)
105105
assert expectations == 4
106106
# Split with cleanup_inconsistent_bundle
107107
stix_splitter = OpenCTIStix2Splitter()
108-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(
108+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(
109109
bundle=content, cleanup_inconsistent_bundle=True
110110
)
111111
assert expectations == 3
@@ -115,7 +115,7 @@ def test_split_cyclic_bundle():
115115
stix_splitter = OpenCTIStix2Splitter()
116116
with open("./tests/data/cyclic-bundle.json") as file:
117117
content = file.read()
118-
expectations, _, bundles = stix_splitter.split_bundle_with_expectations(content)
118+
expectations, _, bundles, _ = stix_splitter.split_bundle_with_expectations(content)
119119
assert expectations == 6
120120
for bundle in bundles:
121121
json_bundle = json.loads(bundle)

0 commit comments

Comments
 (0)