Based on the specified PURL, this endpoint will return a list of vulnerabilities that are related to the package.
You can find a list of supported package managers here
curl --request GET \
--url https://api.vulncheck.com/v3/purl?purl=pkg:hex/coherence@0.1.2 \
--header 'Accept: application/json' \
--header 'Authorization: Bearer insert_token_here'
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"github.com/vulncheck-oss/sdk-go-v2/vulncheck"
)
func main() {
configuration := vulncheck.NewConfiguration()
configuration.Scheme = "https"
configuration.Host = "api.vulncheck.com"
client := vulncheck.NewAPIClient(configuration)
token := os.Getenv("VULNCHECK_API_TOKEN")
auth := context.WithValue(
context.Background(),
vulncheck.ContextAPIKeys,
map[string]vulncheck.APIKey{
"Bearer": {Key: token},
},
)
resp, httpRes, err := client.EndpointsAPI.PurlGet(auth).Purl("pkg:hex/coherence@0.1.2").Execute()
if err != nil || httpRes.StatusCode != 200 {
log.Fatal(err)
}
prettyJSON, err := json.MarshalIndent(resp.Data, "", " ")
if err != nil {
log.Fatalf("Failed to generate JSON: %v", err)
return
}
fmt.Println(string(prettyJSON))
}
import vulncheck_sdk
configuration = vulncheck_sdk.Configuration(host="https://api.vulncheck.com/v3")
configuration.api_key["Bearer"] = "insert_token_here"
with vulncheck_sdk.ApiClient(configuration) as api_client:
endpoints_client = vulncheck_sdk.EndpointsApi(api_client)
api_response = endpoints_client.purl_get("pkg:hex/coherence@0.1.2")
print(api_response.data)
vulncheck purl pkg:hex/coherence@0.1.2
{
"_benchmark": 0.057389,
"_meta": {
"purl_struct": {
"type": "hex",
"namespace": "",
"name": "coherence",
"version": "0.1.2",
"qualifiers": null,
"subpath": ""
},
"timestamp": "2023-09-11T15:02:50.325502302Z",
"total_documents": 1
},
"data": {
"cves": [
"CVE-2018-20301"
],
"vulnerabilities": [
{
"detection": "CVE-2018-20301",
"fixed_version": "0.5.2"
}
]
}
}