mocknvd

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mocknvd is an embedded HTTP server that serves canned NVD 2.0 CVE API JSON. It is shared by the Go unit tests (httptest) and the standalone cmd/mockserver binary used by the haybarn SQL E2E. It honors the same query parameters as the real NVD endpoint that this worker uses:

cveId=CVE-2021-44228          -> a Log4Shell-shaped record (10.0, CRITICAL)
cveId=CVE-2099-00000 (or any
  other unknown id)           -> HTTP 404
keywordSearch=...             -> a paginated 2-page response (3 records)
cpeName=...                   -> CVEs affecting a CPE

Pagination is driven by resultsPerPage / startIndex exactly like NVD.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler() http.Handler

Handler returns an http.Handler serving the canned NVD 2.0 responses at the single path the worker calls. Mount it at /rest/json/cves/2.0.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL