Skip to content

SBOM export endpoint #142

@andrew

Description

@andrew

Add a GET /api/sbom endpoint that emits the proxy's cached package inventory as a CycloneDX or SPDX document.

The database already has everything a CycloneDX component needs: purl, SPDX-normalised license, supplier, repository URL, content hash, size, and vulnerabilities (internal/database/types.go). The git-pkgs/sbom module provides sbom.New() / sbom.AddPackage() / sbom.Encode() for both CycloneDX (JSON, XML) and SPDX JSON with no extra dependencies, so this is mostly a query-and-map job.

Query parameters:

  • formatcyclonedx-json (default), cyclonedx-xml, spdx-json
  • ecosystem — optional filter, e.g. npm
  • cached — when true, only include versions with a cached artifact (so hashes are populated)

Vulnerabilities from the vulnerabilities table can go into the CycloneDX vulnerabilities block when the format supports it (1.4+).

This is the inverse of proxy mirror --sbom and the open-source equivalent of JFrog Xray's component/exportDetails and Sonatype Lifecycle's /api/v2/cycloneDx/{version}/{appId} endpoints.

UI: a "Download SBOM" button on the packages list page (internal/server/templates/pages/packages_list.html) that hits this endpoint with the current ecosystem filter applied, plus an unfiltered one on the dashboard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions