Class VulnerabilityResource

Represents a single OSV vulnerability resource, identified by its OSV ID.

Implements PromiseLike<OsvVulnerability> so it can be awaited directly to fetch the vulnerability, while also acting as a resource handle.

// Await directly
const vuln = await osv.vuln('GHSA-jfh8-c2jp-hdp8');

// Or call get() explicitly
const vuln = await osv.vuln('GHSA-jfh8-c2jp-hdp8').get();

Implements

Methods

Methods

  • Fetches the full vulnerability record for this OSV ID.

    GET /v1/vulns/{id}

    Returns Promise<OsvVulnerability>

    The full OSV vulnerability object

    const vuln = await osv.vuln('GHSA-jfh8-c2jp-hdp8').get();
    console.log(vuln.summary);
    console.log(vuln.affected?.map(a => a.package.name));