Skip to content

Commit

Permalink
Add function to return the earliest affected version
Browse files Browse the repository at this point in the history
  • Loading branch information
iamamoose committed Nov 4, 2022
1 parent 5ad983e commit 840a4c6
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions bin/vulnxml2jsonproject.py
Expand Up @@ -13,16 +13,27 @@
config['git_prefix'] = "https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h="
config['default_reference_prefix'] = "https://www.openssl.org"

def merge_affects(issue,base):
# let's merge the affects into a nice list which is better for Mitre text but we have to take into account our stange lettering scheme
prev = ""
anext = ""
alist = list()
def get_vlist(issue,base):
vlist = list()
for affects in issue.getElementsByTagName('affects'): # so we can sort them
version = affects.getAttribute("version")
if (not base or base in version):
vlist.append(version)
return vlist

def earliest_affects(issue,base):
vlist = get_vlist(issue,base)
if (not vlist):
return None
ver = sorted(vlist)[0]
return ver

def merge_affects(issue,base):
# let's merge the affects into a nice list which is better for Mitre text but we have to take into account our stange lettering scheme
prev = ""
anext = ""
alist = list()
vlist = get_vlist(issue,base)
for ver in sorted(vlist):
# print(f'version {ver} (last was {prev}, next was {anext})')
if (ver != anext):
Expand Down

0 comments on commit 840a4c6

Please sign in to comment.