List issues for a package
The Snyk REST API endpoint List issues for a package can be used to get all direct (non-transitive) vulnerabilities for a package using its purl
, which is a uniform way of identifying software packages across ecosystems as defined in the package URL specification.
When you pass a purl
to the endpoint, Snyk will find any known vulnerabilities for that package and return them as part of the response body.
Supported purl types
The current release supports the following purl
types: apk
, cargo
, cocoapods
, composer
, deb
, gem
, generic
, golang
, hex
, npm
, nuget
, pub
, pypi
, rpm
, swift
and maven
.
If you are interested in support for additional ecosystems, submit a request to Snyk Support.
The API is useful when you have a list of packages and want to retrieve a list of vulnerabilities for a package version.
The examples use HTTPie, but you can use any HTTP client to access the Snyk REST API.
Request for List issues for a package endpoint
To call the API endpoint, use the following HTTP request:
The purl must be URL-encoded.
An example using a valid url-encoded purl follows:
For operating system packages, a vendor must be specified in the namespace portion, and a distro
qualifier must be specified. Supported vendors include: debian
, alpine
, rhel
, ubuntu
, amzn
, centos
, oracle
, rocky
, sles
.
An example using a valid url-encoded operating system purl follows:
The Snyk REST API supports pagination. This has a default page limit of 1000, with a default offset of 0. Current, next, and previous pages are returned as links in the response. The following parameters can be supplied as query parameters: offset
, limit
.
An example paginated request follows:
Response for List issues for a package endpoint
The expected output provides a JSON API response that identifies the vulnerabilities associated with the package.
The following example gives the response for a maven
package woodstox-core.
The response provides a list of the vulnerabilities found for the package identified by the purl in the request. The response begins with a description of a vulnerability:
Overview of package:
com.fasterxml.woodstox:woodstox-core is a None. Affected versions of this package are vulnerable to XML External Entity (XXE) Injection, due to insecure processing and missing restriction of XML files.
An attacker can exploit this vulnerability by sending a specially crafted malicious XML file that contains XML entities with URIs that resolve to documents outside of the intended sphere of control.
Remediation:
Upgrade com.fasterxml.woodstox:woodstox-core to version 5.3.0 or higher.
References:
GitHub Commit
GitHub Issue
GitHub Issue
The response is continuous, divided here to allow for explanations.
For each vulnerability, the response provides the following:
The Snyk issue ID and issue types
General metadata about the vulnerability, including title, timestamps relevant to the vulnerability such as publication and disclosure time, and description
The CVSS identifiers and source
The severity or severities of the vulnerability
Any fixes available for that vulnerability and the representation for vulnerable versions
Links to any external resources with further information on the vulnerability
Package metadata is returned, including the following:
Package name
Package type
Package URL specification
Package version