summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKonrad Weihmann <kweihmann@outlook.com>2020-07-26 16:10:06 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-07 21:20:21 +0100
commitc25965e378d8fb2eef806bd19f8662c7511c6ffa (patch)
tree325a3375c51acb528d7f3806f4ff23223b97467d /meta
parent75fdc94ecbd16cd59ab4f182ce4b9f5437db52b1 (diff)
downloadpoky-c25965e378d8fb2eef806bd19f8662c7511c6ffa.tar.gz
cve-update: handle baseMetricV2 as optional
Currently in NVD DB an item popped up, which hasn't set baseMetricV2. Let the parser handle it as an optional item. In case use baseMetricV2 before baseMetricV3 (From OE-Core rev: 135a6a4f55aed6148f45d01b307fadbd45be2997) Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit fdcbf3f28289188c5a97664d1421d4a5c4991eda) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb13
1 files changed, 9 insertions, 4 deletions
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb
index f27ade40db..32d6dbdffc 100644
--- a/meta/recipes-core/meta/cve-update-db-native.bb
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -176,15 +176,20 @@ def update_db(c, jsondata):
176 if not elt['impact']: 176 if not elt['impact']:
177 continue 177 continue
178 178
179 accessVector = None
179 cveId = elt['cve']['CVE_data_meta']['ID'] 180 cveId = elt['cve']['CVE_data_meta']['ID']
180 cveDesc = elt['cve']['description']['description_data'][0]['value'] 181 cveDesc = elt['cve']['description']['description_data'][0]['value']
181 date = elt['lastModifiedDate'] 182 date = elt['lastModifiedDate']
182 accessVector = elt['impact']['baseMetricV2']['cvssV2']['accessVector']
183 cvssv2 = elt['impact']['baseMetricV2']['cvssV2']['baseScore']
184
185 try: 183 try:
184 accessVector = elt['impact']['baseMetricV2']['cvssV2']['accessVector']
185 cvssv2 = elt['impact']['baseMetricV2']['cvssV2']['baseScore']
186 except KeyError:
187 cvssv2 = 0.0
188 try:
189 accessVector = accessVector or elt['impact']['baseMetricV3']['cvssV3']['attackVector']
186 cvssv3 = elt['impact']['baseMetricV3']['cvssV3']['baseScore'] 190 cvssv3 = elt['impact']['baseMetricV3']['cvssV3']['baseScore']
187 except: 191 except KeyError:
192 accessVector = accessVector or "UNKNOWN"
188 cvssv3 = 0.0 193 cvssv3 = 0.0
189 194
190 c.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)", 195 c.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",