From e55006f6bbd51e327306af0cfa78dbb319adea1f Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Tue, 12 Dec 2023 14:02:21 +0100 Subject: [PATCH] Reduce time span requested from NVD API --- src/glvd/cli/ingest_nvd.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/glvd/cli/ingest_nvd.py b/src/glvd/cli/ingest_nvd.py index 35d6089..97cfa21 100644 --- a/src/glvd/cli/ingest_nvd.py +++ b/src/glvd/cli/ingest_nvd.py @@ -96,14 +96,16 @@ async def fetch_cve( if not last_mod or last_mod <= start: logger.info('Requesting all data') await self.fetch_cve_impl(conn, rsession, {}) + last_mod = now - # Request the last 90 days. This violates parts the the best - # practices documented at + # Request seven days before the last modification. This violates + # parts the the best practices documented at # https://nvd.nist.gov/developers/start-here#:~:text=Best%20Practices # It turns out, we don't work on a stable snapshot, and the # modification timestamp changes. + check = last_mod - timedelta(days=7) params: dict[str, str] = { - 'lastModStartDate': start.isoformat(), + 'lastModStartDate': check.isoformat(), 'lastModEndDate': now.isoformat(), }