Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: synch last modified timestamp for NVD API #6281

Merged
merged 1 commit into from Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -214,9 +214,15 @@ private boolean processDatafeed(String nvdDataFeedUrl) throws UpdateException {

private void storeLastModifiedDates(final ZonedDateTime now, final Properties cacheProperties,
final Map<String, String> 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);
Expand Down