Skip to content

pnpr: handle proxied tarballs whose packument has no usable dist.integrity #24

Closed

Description

@zkochan

Summary

pnpr can't serve (or cache, or stream) a proxied tarball whose packument has no usable dist.integrity — e.g. very old packages that publish only a legacy shasum, or none at all. Both the public proxy path and the namespaced /~<uplink>/ route resolve the expected integrity from the packument via expected_tarball_dist, which requires a supported SRI and errors otherwise, so such a tarball fails before it's served.

Why it matters

The integrity normally comes from the packument, so server-side resolution never needs to download a tarball to know it — that's what makes streaming + write-time verification work. The exception is the rare package whose metadata carries no SRI: to produce an integrity for the lockfile (and to verify what it caches/serves), pnpr would have to fetch the tarball and compute the hash itself.

Proposed work

  • When a version lacks a usable dist.integrity, fetch the tarball, compute the SRI, and use that — for the resolve/lockfile response and as the write-time integrity for caching/serving.
  • Decide the policy when even that isn't possible (e.g. cache: false uplinks, or a hostile upstream): serve-through relying on the client's own check, or refuse.
  • Add coverage for the missing-dist.integrity packument shape.

Context

Came out of the proxy tarball streaming work ([pnpm/pnpm#12709] follow-up): the streaming + namespaced-route convergence deliberately left this rare case as-is (still requires a supported SRI) to keep that change scoped.


Written by an agent (Claude Code, claude-opus-4-8).

Activity

  1. self-assigned this
    on Jun 29, 2026
  2. transferred this issue frompnpm/pnpmon Sep 26, 2026
  3. zkochan commented on Nov 8, 2026

    @zkochan
    MemberAuthor

    pnpm/pnpm#16358 computes a missing upstream integrity (server/upstream_integrity.rs).

    Written by an agent (Claude Code, claude-opus-5-5).

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions