Repository navigation
Conversation
The core already honours nvd.api.datafeed.startyear when updating from an NVD data feed, but the CLI could only set it through a properties file. Add --nvdStartYear so that a run against a data feed, such as --updateonly with --nvdDatafeed, skips the yearly files before the given year. The year must be between 2002 and the current year. The data feed has no files before 2002, and such a start year makes every update download the whole feed again; a future year makes the first update fail with a NullPointerException. Fixes dependency-check#7569
|
Im not sure there is any need or demand for this. do you actually have a use case for this? |
|
Fair question. It's not a use case of my own: I picked it up from #7569, which @marcelstoer opened for I think it's still worth keeping, for two reasons. The Gradle plugin already exposes it as I agree the missing-CVE risk is real, so I'm happy to make it explicit: log a warning when the start year is after 2002 that older CVEs won't be detected, and say the same in the help text. If you'd still rather drop the setting, I can do that instead. |
|
Yeah, when that was opened the transition to the NVD API was underway I believe and the earlier mentioned flag was removed from the Maven and Ant plugins. The gradle plugin is an outlier, partly because it is maintained in a different repo which lags this one. Its also possible right now to set all these values with JVM system properties via -D args (and thus JAVA_TOOL_OPTIONS env var for the cli) so the question is whether it's worth adding yet another integration-specific value. If we do this i'd prefer it was from a real user request in the CLI. @marcelstoer is a contributor so he may have been raising the earlier issue after looking at someone else's issue rather than for his own use. Not sure. I'd also prefer it is named consistently so it is clear it only affects the data feed, not normal API usage, similar to how it is named within the Gradle plugin, so |
Match the Gradle plugin's nvd.datafeedStartYear and make it clear that the option only applies to the NVD data feed, not the NVD API.
|
Thanks, that context helps. I've renamed it to |
|
Yup, fair point if we want people to use it. Some settings are deliberately obscure as using it can have bad consequences (like this one, potentially creating false negatives and positives). |
|
@jeremylong perhaps you could have a look at the comments and discussion with Marcel at #7569 (comment) to decide the future of |
Co-authored-by: Jeremy Long <jeremy.long@gmail.com>
Description of Change
Adds a
--nvdDatafeedStartYearoption to the CLI. It sets the existingnvd.api.datafeed.startyearsetting, which the NVD data feed update already uses to choose which yearly files to fetch. Until now the CLI could only set it through--propertyfile.With it, the command from the issue only fetches the files from 2018 onwards:
Notes:
NullPointerExceptioningetUpdatesNeeded.--advancedHelp, the CLI arguments page and the bash completion script.Checked by hand:
--updateonly --nvdDatafeed=<hosted feed> --nvdDatafeedStartYear=2026on an empty data directory downloaded onlynvdcve-2026.json.gzandnvdcve-modified.json.gz.Related issues
Have test cases been added to cover the new functionality?
yes:
AppTestchecks that the option reachesSettings, andCliParserTestchecks that years before 2002 and years in the future are rejected.