Class NvdApiDataSource
java.lang.Object
org.owasp.dependencycheck.data.update.NvdApiDataSource
- All Implemented Interfaces:
CachedWebDataSource
- Author:
- Jeremy Long
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final PropertiesgetRemoteDataFeedCacheProperties(NvdApiDataSource.FeedUrl dataFeedUrl) Downloads the metadata properties of the NVD API cache / data feed.getUpdatesNeeded(NvdApiDataSource.FeedUrl feedUrl, Properties cacheProperties, ZonedDateTime now) Determines if the index needs to be updated.booleanDeletes any locally cached data.booleanDetermines if an update to the current data store is needed, if it is the new data is downloaded from the Internet and imported into the current cached data store.
-
Constructor Details
-
NvdApiDataSource
public NvdApiDataSource()
-
-
Method Details
-
update
Description copied from interface:CachedWebDataSourceDetermines if an update to the current data store is needed, if it is the new data is downloaded from the Internet and imported into the current cached data store.- Specified by:
updatein interfaceCachedWebDataSource- Parameters:
engine- a reference to the dependency-check engine- Returns:
- whether or not an update was made to the CveDB
- Throws:
UpdateException- is thrown if there is an exception downloading the data or updating the data store.
-
purge
Description copied from interface:CachedWebDataSourceDeletes any locally cached data.- Specified by:
purgein interfaceCachedWebDataSource- Parameters:
engine- a reference to the dependency-check engine- Returns:
trueif the purge was successful; otherwisefalse
-
getUpdatesNeeded
protected final Map<String,String> getUpdatesNeeded(NvdApiDataSource.FeedUrl feedUrl, Properties cacheProperties, ZonedDateTime now) throws UpdateException Determines if the index needs to be updated. This is done by fetching the NVD CVE meta data and checking the last update date. If the data needs to be refreshed this method will return the NvdCveUrl for the files that need to be updated.- Parameters:
feedUrl- a parsed NVD cache / data feed URLcacheProperties- the properties from the remote NVD API cache or data feednow- the start time of the update process- Returns:
- the map of key to URLs - where the key is the year or `modified`
- Throws:
UpdateException- Is thrown if there is an issue with the last updated properties file
-
getRemoteDataFeedCacheProperties
protected final Properties getRemoteDataFeedCacheProperties(NvdApiDataSource.FeedUrl dataFeedUrl) throws UpdateException Downloads the metadata properties of the NVD API cache / data feed.- Parameters:
dataFeedUrl- a parsed NVD cache / data feed URL- Returns:
- the cache properties
- Throws:
UpdateException- thrown if the properties file could not be downloaded
-