Repository navigation
feat: add nvd commands for the NVD API 2.0 compatible endpoints - #346
Merged
Merged
Conversation
One subcommand per endpoint (cves, cvehistory, cpes, cpematch, source) and one
flag per query parameter, named as the parameter in kebab-case. Values are
sent unchanged and validated by the API, and each command makes one request:
page with --cursor ("" for the first page, then each nextCursor) or
--start-index, as the API does.
Output follows the existing model. The endpoint's records go to stdout, or the
whole NVD response with --full, passed through as the server sent them. Status
lines go to stdout in text mode and stderr under --json. A refused request
becomes the standard error envelope with the API's reason: MetaError now also
decodes the NVD endpoints' {"message", "status"} body, which it previously
reduced to an empty error.
robc-vulncheck
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
vulncheck nvd, with one subcommand per NVD API 2.0 compatible endpoint:nvd cvesGET /rest/json/cves/2.0nvd cvehistoryGET /rest/json/cvehistory/2.0nvd cpesGET /rest/json/cpes/2.0nvd cpematchGET /rest/json/cpematch/2.0nvd sourceGET /rest/json/source/2.0The commands mirror the API and add nothing to it.
--cve-idiscveId,--last-mod-start-dateislastModStartDate).--cursor ""for the first page, then each response'snextCursor, or--start-index(the only paging onsource). There is deliberately no--all.Output
Output follows the existing model, as
index listdoes:vulnerabilities,cveChanges,products,matchStringsorsources), or the whole NVD response with--full. Both are passed through as the server sent them.--json, so--jsonstdout is only the payload.MetaErrornow also decodes the NVD endpoints'{"message", "status"}body; before this, the reason was dropped and the error came out empty.Testing
TestParametersAreTheAPIspins each command's flags to its endpoint's parameters, so the CLI neither drops one the API takes nor offers one it doesn't.--cursorbeing sent;--full;--jsonoutput;sourcehaving no--cursor;bad_requesterror with the API's message.GetNvd, including query reset between calls, and an NVD case added to theMetaErrorshape test.--full, a two-page cursor walk, a multi-word--event-name,cpes,cpematchandsource. An over-long date range returnedbad_requestwith the API's reason and exit 2.commands --jsonlistsnvd.go test ./...passes andgolangci-lintis clean.