Skip to content

Commit 9cb64e4

Browse files
authored
Update CVE EPSS (#111)
* add top-level arango properties for muchdogesec/vulmatch#304 * update tests
1 parent 4af4107 commit 9cb64e4

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

arango_cve_processor/managers/base_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class STIXRelationManager:
2626
MIN_DATE_STR = "1970-01-01"
2727
BATCH_SIZE = 1000
2828
CHUNK_SIZE = BATCH_SIZE
29+
UPDATE_CHUNK_SIZE = 5000
2930
DESCRIPTION = "please set"
3031

3132
def __init_subclass__(cls, /, relationship_note, register=True) -> None:
@@ -105,9 +106,9 @@ def upload_vertex_data(self, objects):
105106

106107
logging.info("updating %d existing reports", len(self.update_objects))
107108
for batch in chunked_tqdm(
108-
self.update_objects, n=10_000, description="update existing objects"
109+
self.update_objects, n=self.UPDATE_CHUNK_SIZE, description="update existing objects"
109110
):
110-
self.arango.db.collection(self.vertex_collection).update_many(batch)
111+
self.arango.db.collection(self.vertex_collection).update_many(batch, silent=True, check_rev=False)
111112

112113
self.update_objects.clear()
113114
logging.info("uploading %d vertices", len(objects))

arango_cve_processor/managers/cve_epss.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class _CveEpssWorker(STIXRelationManager, relationship_note="cve-epss", register
1919
default_objects = [
2020
"https://raw.githubusercontent.com/muchdogesec/stix2extensions/refs/heads/main/automodel_generated/extension-definitions/properties/report-epss-scoring.json"
2121
]
22-
CHUNK_SIZE = 20_000
22+
CHUNK_SIZE = 10_000
2323

2424
def __init__(self, *args, **kwargs) -> None:
2525
super().__init__(*args, **kwargs)
@@ -101,6 +101,8 @@ def relate_single(self, cve_object):
101101
"x_epss": all_epss,
102102
"modified": latest_epss["date"] + "T00:00:00.000Z",
103103
"_arango_cve_processor_note": self.relationship_note,
104+
"_epss_score": latest_epss["epss"],
105+
"_epss_percentile": latest_epss["percentile"],
104106
},
105107
self.make_opencti_properties(cve_object["_key"], latest_epss),
106108
]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "arango_cve_processor"
7-
version = "1.4.3"
7+
version = "1.4.4"
88
authors = [
99
{ name = "dogesec" }
1010
]

tests/unit/managers/test_cve_epss.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def test_epss_backfill(acp_processor):
6666
"_record_md5_hash": "dd9295679421ae55cd4ab7a20532a509",
6767
"_is_latest": True,
6868
"_taxii": {"last": True, "first": True, "visible": True},
69+
"_epss_score": 0.00043,
70+
"_epss_percentile": 0.11665,
6971
},
7072
{
7173
"type": "report",
@@ -104,6 +106,8 @@ def test_epss_backfill(acp_processor):
104106
"_record_md5_hash": "f25e43d30c9d44a2e73a698d12dc015d",
105107
"_is_latest": True,
106108
"_taxii": {"last": True, "first": True, "visible": True},
109+
"_epss_score": 0.00043,
110+
"_epss_percentile": 0.11665,
107111
},
108112
{
109113
"type": "report",
@@ -142,6 +146,8 @@ def test_epss_backfill(acp_processor):
142146
"_record_md5_hash": "19c7516d89633f14acb35319480dcd3c",
143147
"_is_latest": True,
144148
"_taxii": {"last": True, "first": True, "visible": True},
149+
"_epss_score": 0.00087,
150+
"_epss_percentile": 0.39353,
145151
},
146152
{
147153
"type": "report",
@@ -180,6 +186,8 @@ def test_epss_backfill(acp_processor):
180186
"_record_md5_hash": "daf44f8b6498071b6c6cd7d213fbecd8",
181187
"_is_latest": True,
182188
"_taxii": {"last": True, "first": True, "visible": True},
189+
"_epss_score": 0.00054,
190+
"_epss_percentile": 0.25386,
183191
},
184192
]
185193

0 commit comments

Comments
 (0)