diff --git a/core/src/main/java/org/owasp/dependencycheck/data/update/NvdApiDataSource.java b/core/src/main/java/org/owasp/dependencycheck/data/update/NvdApiDataSource.java index f8b779c0e2d..0e3a67fa4a7 100644 --- a/core/src/main/java/org/owasp/dependencycheck/data/update/NvdApiDataSource.java +++ b/core/src/main/java/org/owasp/dependencycheck/data/update/NvdApiDataSource.java @@ -215,9 +215,15 @@ private boolean processDatafeed(String nvdDataFeedUrl) throws UpdateException { private void storeLastModifiedDates(final ZonedDateTime now, final Properties cacheProperties, final Map updateable) throws UpdateException { + + ZonedDateTime lastModifiedRequest = DatabaseProperties.getTimestamp(cacheProperties, + NVD_API_CACHE_MODIFIED_DATE + ".modified"); dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_CHECKED, now); - dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_MODIFIED, DatabaseProperties.getTimestamp(cacheProperties, - NVD_API_CACHE_MODIFIED_DATE + ".modified")); + dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_MODIFIED, lastModifiedRequest); + //allow users to initially load from a cache but then use the API - this may happen with the GH Action + dbProperties.save(DatabaseProperties.NVD_API_LAST_CHECKED, now); + dbProperties.save(DatabaseProperties.NVD_API_LAST_MODIFIED, lastModifiedRequest); + for (String entry : updateable.keySet()) { final ZonedDateTime date = DatabaseProperties.getTimestamp(cacheProperties, NVD_API_CACHE_MODIFIED_DATE + "." + entry); dbProperties.save(DatabaseProperties.NVD_CACHE_LAST_MODIFIED + "." + entry, date);