Skip to content

Commit 7d93d83

Browse files
authored
Merge pull request #252 from yzainee/latest_version
Added cecosystem to CVE
2 parents 01ee9df + 7bbf400 commit 7d93d83

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/cve.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ def put(payload):
232232

233233
# add or replace CVE node
234234
cve_node_replace_script_template = """\
235-
cve_v=g.V().has('cve_id',cve_id).tryNext().orElseGet{\
235+
cve_v=g.V().has('cve_id',cve_id).has('cecosystem', ecosystem).tryNext().orElseGet{\
236236
graph.addVertex(label, 'CVE',\
237237
'vertex_label', 'CVE',\
238238
'cve_id', cve_id)};\
239-
cve_v.property('ecosystem', ecosystem);\
239+
cve_v.property('cecosystem', ecosystem);\
240240
cve_v.property('description', description);\
241241
cve_v.property('cvss_v2', cvss_v2);\
242242
cve_v.property('modified_date', modified_date);\
@@ -249,7 +249,7 @@ def put(payload):
249249

250250
# add edge between CVE node and Version node if it does not exist previously
251251
add_affected_edge_script_template = """\
252-
cve_v=g.V().has('cve_id',cve_id).next();\
252+
cve_v=g.V().has('cve_id',cve_id).has('cecosystem', '{ecosystem}').next();\
253253
version_v=g.V().has('pecosystem','{ecosystem}')\
254254
.has('pname','{name}')\
255255
.has('version','{version}');\
@@ -270,7 +270,7 @@ def put(payload):
270270
# get CVEs for ecosystem
271271
cve_nodes_for_ecosystem_script_template = """\
272272
g.V().has("vertex_label", "CVE")\
273-
.has("ecosystem",ecosystem)\
273+
.has("cecosystem",ecosystem)\
274274
.values("cve_id")\
275275
.dedup();\
276276
"""

src/schema.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@
123123

124124
// for CVEs
125125

126+
cecosystem = mgmt.getPropertyKey('cecosystem');
127+
if(cecosystem == null) {
128+
cecosystem = mgmt.makePropertyKey('cecosystem').dataType(String.class).make();
129+
}
130+
126131
cve_ids = mgmt.getPropertyKey('cve_ids');
127132
if(cve_ids == null) {
128133
cve_ids = mgmt.makePropertyKey('cve_ids').dataType(String.class).cardinality(Cardinality.SET).make();
@@ -646,6 +651,7 @@
646651
'email',
647652
//'cve_id',
648653
//'fixed_in',
654+
'cecosystem',
649655
'nvd_status',
650656
'cvedb_version',
651657
//'summary',

0 commit comments

Comments
 (0)