Skip to content

Persist artifact license reports and expose them in the API and version pages #312

Description

@andrew

Package and version pages currently show license values from registry metadata. Cached archives can be browsed, but proxy does not retain license evidence from their contents or expose full license and notice text.

Persist a typed license report for each scanned artifact and expose it through the API and the version page. Reports should use the git-pkgs/licenses scan shape, including root and nested expressions, manifest declarations, legal files, decoded text, skipped files, errors, scanner version, and corpus provenance.

Store results per artifact content hash and filename. A package version can have several artifacts, such as a PyPI sdist and multiple wheels, whose license files may differ. Keep registry-derived package and version licenses separate, then derive a version summary from the current artifact reports when presenting it.

Add:

  • GET /api/licenses/{ecosystem}/{name}/{version}, returning the current report for each cached artifact and a derived version summary.
  • A license section on /ui/package/{ecosystem}/{name}/{version} with scanned expressions, declared values, license and notice files, scan status, and provenance.
  • Links from reported legal files to the existing source-browse endpoint when the artifact can be browsed.

The API and UI should read persisted reports rather than scanning during the request. A report must only be reused when its content hash and scanner identity still match the cached artifact. Unsupported files should retain an explicit unsupported status without preventing the artifact from being served.

Initial scope covers artifacts cached through normal server traffic and the mirror API. Existing cached artifacts can show an unscanned state; bulk backfill and the proxy mirror CLI are outside this issue.

Tests should send a real package archive through a public package endpoint, persist its report, and verify the API response and rendered version page. Include a version with two artifact variants so results are not accidentally stored at version level.

Related work:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions