Documentation ¶
Index ¶
Constants ¶
const ( // QueryEndpoint is the URL for posting queries to OSV. QueryEndpoint = "https://api.osv.dev/v1/querybatch" // GetEndpoint is the URL for getting vulenrabilities from OSV. GetEndpoint = "https://api.osv.dev/v1/vulns" // BaseVulnerabilityURL is the base URL for detailed vulnerability views. BaseVulnerabilityURL = "https://osv.dev/vulnerability/" // MaxQueriesPerRequest splits up querybatch into multiple requests if // number of queries exceed this number MaxQueriesPerRequest = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchedQuery ¶
type BatchedQuery struct {
Queries []*Query `json:"queries"`
}
BatchedQuery represents a batched query to OSV.
type BatchedResponse ¶
type BatchedResponse struct {
Results []MinimalResponse `json:"results"`
}
BatchedResponse represents an unhydrated batched response from OSV.
func MakeRequest ¶
func MakeRequest(request BatchedQuery) (*BatchedResponse, error)
type HydratedBatchedResponse ¶
type HydratedBatchedResponse struct {
Results []Response `json:"results"`
}
HydratedBatchedResponse represents a hydrated batched response from OSV.
func Hydrate ¶
func Hydrate(resp *BatchedResponse) (*HydratedBatchedResponse, error)
Hydrate fills the results of the batched response with the full Vulnerability details.
type MinimalResponse ¶
type MinimalResponse struct {
Vulns []MinimalVulnerability `json:"vulns"`
}
MinimalResponse represents an unhydrated response from OSV.
type MinimalVulnerability ¶
type MinimalVulnerability struct {
ID string `json:"id"`
}
MinimalVulnerability represents an unhydrated vulnerability entry from OSV.
type Package ¶
type Package struct { PURL string `json:"purl,omitempty"` Name string `json:"name,omitempty"` Ecosystem string `json:"ecosystem,omitempty"` }
Package represents a package identifier for OSV.
type Query ¶
type Query struct { Commit string `json:"commit,omitempty"` Package Package `json:"package,omitempty"` Version string `json:"version,omitempty"` Source Source `json:"omit"` }
Query represents a query to OSV.
func MakeCommitRequest ¶
MakeCommitRequest makes a commit hash request.
func MakePURLRequest ¶
MakePURLRequest makes a PURL request.
func MakePkgRequest ¶
func MakePkgRequest(pkgDetails lockfile.PackageDetails) *Query
type Response ¶
type Response struct {
Vulns []Vulnerability `json:"vulns"`
}
Response represents a full response from OSV.
type Vulnerability ¶
Vulnerability represents a vulnerability entry from OSV.