diff options
| -rw-r--r-- | meta/recipes-core/meta/cve-update-nvd2-native.bb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/meta/recipes-core/meta/cve-update-nvd2-native.bb b/meta/recipes-core/meta/cve-update-nvd2-native.bb index 8e5b83d7f1..8a48e3ddc3 100644 --- a/meta/recipes-core/meta/cve-update-nvd2-native.bb +++ b/meta/recipes-core/meta/cve-update-nvd2-native.bb | |||
| @@ -125,6 +125,8 @@ def nvd_request_next(url, api_key, args): | |||
| 125 | if api_key: | 125 | if api_key: |
| 126 | headers['apiKey'] = api_key | 126 | headers['apiKey'] = api_key |
| 127 | 127 | ||
| 128 | bb.note("Requesting %s" % str(args)) | ||
| 129 | |||
| 128 | data = urllib.parse.urlencode(args) | 130 | data = urllib.parse.urlencode(args) |
| 129 | 131 | ||
| 130 | full_request = url + '?' + data | 132 | full_request = url + '?' + data |
| @@ -142,7 +144,7 @@ def nvd_request_next(url, api_key, args): | |||
| 142 | r.close() | 144 | r.close() |
| 143 | 145 | ||
| 144 | except Exception as e: | 146 | except Exception as e: |
| 145 | bb.debug(2, "CVE database: received error (%s), retrying (request: %s)" %(e, full_request)) | 147 | bb.note("CVE database: received error (%s), retrying (request: %s)" % (e, full_request)) |
| 146 | time.sleep(6) | 148 | time.sleep(6) |
| 147 | pass | 149 | pass |
| 148 | else: | 150 | else: |
| @@ -173,7 +175,7 @@ def update_db_file(db_tmp_file, d, database_time): | |||
| 173 | today_date = datetime.datetime.now(tz=datetime.timezone.utc) | 175 | today_date = datetime.datetime.now(tz=datetime.timezone.utc) |
| 174 | delta = today_date - database_date | 176 | delta = today_date - database_date |
| 175 | if delta.days < 120: | 177 | if delta.days < 120: |
| 176 | bb.debug(2, "CVE database: performing partial update") | 178 | bb.note("CVE database: performing partial update") |
| 177 | req_args['lastModStartDate'] = database_date.isoformat() | 179 | req_args['lastModStartDate'] = database_date.isoformat() |
| 178 | req_args['lastModEndDate'] = today_date.isoformat() | 180 | req_args['lastModEndDate'] = today_date.isoformat() |
| 179 | else: | 181 | else: |
| @@ -181,7 +183,7 @@ def update_db_file(db_tmp_file, d, database_time): | |||
| 181 | 183 | ||
| 182 | with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: | 184 | with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: |
| 183 | 185 | ||
| 184 | bb.debug(2, "Updating entries") | 186 | bb.note("Updating entries") |
| 185 | index = 0 | 187 | index = 0 |
| 186 | url = d.getVar("NVDCVE_URL") | 188 | url = d.getVar("NVDCVE_URL") |
| 187 | while True: | 189 | while True: |
| @@ -196,7 +198,7 @@ def update_db_file(db_tmp_file, d, database_time): | |||
| 196 | index = data["startIndex"] | 198 | index = data["startIndex"] |
| 197 | total = data["totalResults"] | 199 | total = data["totalResults"] |
| 198 | per_page = data["resultsPerPage"] | 200 | per_page = data["resultsPerPage"] |
| 199 | 201 | bb.note("Got %d entries" % per_page) | |
| 200 | for cve in data["vulnerabilities"]: | 202 | for cve in data["vulnerabilities"]: |
| 201 | update_db(conn, cve) | 203 | update_db(conn, cve) |
| 202 | 204 | ||
| @@ -332,7 +334,7 @@ def update_db(conn, elt): | |||
| 332 | for node in config["nodes"]: | 334 | for node in config["nodes"]: |
| 333 | parse_node_and_insert(conn, node, cveId) | 335 | parse_node_and_insert(conn, node, cveId) |
| 334 | except KeyError: | 336 | except KeyError: |
| 335 | bb.debug(2, "CVE %s has no configurations" % cveId) | 337 | bb.note("CVE %s has no configurations" % cveId) |
| 336 | 338 | ||
| 337 | do_fetch[nostamp] = "1" | 339 | do_fetch[nostamp] = "1" |
| 338 | 340 | ||
