Skip to content

pnpr v1 readiness: breaking changes, architecture decisions, and missing features #131

Closed

Description

@zkochan

Umbrella for taking pnpr from 0.1.0-alpha.x to a 1.0.0 whose config, URLs, on-disk formats, and wire protocols we commit to keep. It records what a read-through of pnpr/ on 2026-10-14 (commit a03b6bc1bd) found, grouped by the question it answers. Items are verified by reading the code unless marked otherwise. Nothing here is implemented yet; each section is meant to spawn its own task once a decision is made.

Related tracking issues: #19 (verdaccio parity), #21 (stateless deployment), #23 (packument split), #24 (missing dist.integrity), #25 (resolver policy gaps and capability negotiation), #26 (resolver SSRF, now largely addressed by the fetch allowlist and DNS guard and worth re-checking and closing), #111 (runtime administration), #113 (web UI follow-ups).

Summary

  • Breaking changes are needed before v1. The biggest are: the URL layout changes when a second ecosystem is configured, the config schema has mixed casing and two spellings for the same thing, the bundled default config is pnpm's test-registry config, and the hosted store layout lets registries collide. None of these can change compatibly after v1.
  • Architecture needs settling, not rewriting. The routing model (declared provenance, no fall-through) is sound and should be frozen. What needs decisions: identity (a bare username is the whole identity), an owner model for packages, how the pnpr↔pnpm protocol is versioned, and where the publish journal lives on S3.
  • Several production basics are missing: SIGTERM handling, metrics, trusted-proxy support, rate limiting, request timeouts, cache eviction, npm audit, npm token create, provenance publishing, an admin audit log, and a format version plus migration path for every persisted format.

A. Breaking changes to make before v1

A1. Make the URL layout independent of how many ecosystems are configured

Today npm is served at / only when it is the only ecosystem. Adding a Cargo, PyPI, or OCI registry to an existing npm server moves every npm path under /npm/ (crates/pnpr/src/server/routing.rs, crates/registry/src/lib.rs base_path). That breaks .npmrc registry URLs, /~name/ URLs, pnpm publish --batch, the tarball URLs the resolver wrote into existing lockfiles (resolver/wire/tarball_router.rs only recognizes the current prefix), and OIDC workload publish paths. The same URL also changes meaning: /npm is the npm package npm on an npm-only server and the ecosystem prefix otherwise.

Decide one rule. Either npm stays at / forever with /npm/ as an alias (reserving the npm names npm, cargo, pypi, oci, v2 at the root), or every ecosystem is always prefixed. The resolver's tarball URLs and OIDC paths must follow the same rule.

A2. One config schema, consistently named

crates/config/src/config_file.rs and friends:

  • Mixed casing: auth.htpasswd.max_users, upstream.auth.token_env, and verdaccio's maxage sit next to maxFails, failTimeout, accessKeyId, teamsManagedBy. Error messages still say fail_timeout.
  • Two spellings for the same thing: flat registries with ecosystem: versus grouped <ecosystem>: { name: ... } entries, with different default storage namespaces ("" versus <ecosystem>~<name>); defaultRegistry as a string or a map. The internal key ecosystem/name leaks into auth.oidc[].workloads[].registry and groups.teams[].registry, and the admin rules API uses a third form, /{ecosystem}/{name}. Grouped npm registries cannot use OIDC workload publishing at all because the allowed path is built as /~npm/private/....
  • Undocumented alias backend.postgresql.
  • Units: intervals (30s) for upstream and SQL timeouts, integer seconds for libsql.syncIntervalSecs and the CLI flags --packument-ttl-secs and --min-age-secs, bytes for oci.maxBlobBytes, GiB for artifacts.quota.ownerGiB.
  • Overloaded names: cache is a path at the top level and a boolean on an upstream; org on a hosted registry is a storage namespace while artifacts.orgs is an access principal and /-/org/{scope} is an npm scope; routes configures the resolver's fetch allowlist and is easily confused with routers; backend only backs auth but sits at the top level; artifacts.orgs also gates compiler caches and pipeline runs and is read even with artifacts.enabled: false.
  • Unknown keys are silently ignored on the top level and on auth, htpasswd, tokens, backend, s3, osv, log, routes, and upstream auth. A typo like maxUsers: does nothing. Turning on strict parsing after v1 would itself be a breaking change.
  • The --packument-ttl-secs help text says "the loaded config's value wins" but there is no config key for it.
  • The Config and ConfigFile doc comments still claim verdaccio config.yaml compatibility; packages: and groups: are rejected and uplinks is unsupported.

A3. Replace the bundled default config

crates/config/config.yaml is compiled in as the default and used whenever no -c is given and no global config exists, which includes the Docker image's default command. It is pnpm's test-registry config: a public secret: pnpm-registry-mock-secret-key-32 (which also seeds the OCI token signing key and the private cache HMAC), about 60 fixture package names claimed by a hosted registry, unpublish: $authenticated on all of them, verdaccio leftovers (plugins, middlewares, web), and log.level: error while the code default is info. The TypeScript jest setup string-patches this file, and Config::proxy, Config::static_serve, REGISTRY_MOCK_LOCAL_PATTERNS, and registry_mock_rules are public API used only by tests. main.rs has special-case logic (relocate_bundled_auth_state) for it.

Ship a minimal production default (npmjs public upstream, one empty hosted registry, random secret, registration disabled) and move the test config and presets into the test harness (pnpm/tasks/registry-mock or pnpr-fixtures).

A4. Hosted store layout and format versions

crates/storage/:

  • Org namespaces share the key space with the flat root. An org acme collides with an unscoped package acme; a flat-root OCI repository crates/serde writes to the path of crate serde in a Cargo registry with org: crates; cargo~internal is a valid npm name and lands in a grouped Cargo registry's root. oci_maintenance.rs works around this with an ad-hoc exclusion list.
  • Inside an OCI repository, blobs (sha256-<hex>) and the document (package.json) share a directory with nested repository names, which are also valid name components.
  • Every ecosystem's document is called package.json but holds different types. No persisted format (packument, CrateDocument, ProjectDocument, ImageDocument, journal, revision index, staged records, .package-index) carries a format version, and there is no migration code. An older binary that rewrites a newer document drops fields it does not know, including the OCI generation and deleting_blob deletion fences. Unknown-field policy is inconsistent: most persisted structs drop unknowns, while RuleChanges, PackageChanges, and PipelineRun reject them, so after a rolling upgrade an older replica reading a newer rules record denies everyone on that registry.
  • Team rosters and rule overrides are keyed by registry name (.team-rosters/v0/<registry>.json), so moving a registry into an ecosystem group changes the key and the YAML seed silently replaces an admin's tightened rules.
  • On S3, ~ in keys is percent-encoded by object_store, but S3Store::list_package_names and list_blob_files compare against the raw npm~internal/ prefix, so packages of grouped hosted registries are missing from search, the PyPI /simple/ root, the OCI catalog, and oci-gc. Local and S3 layouts also differ for any name containing ~ * [ ] ^ { } | # % < > ?, and there is no local-to-S3 migration tool.
  • The revision reference index stores JSON as an array of byte numbers; its doc comment describes sibling files that are never written.

Decide the layout once (reserved prefix for orgs, separate document and blob subkeys, one name encoding for both backends), add a layout marker and a formatVersion field with a "refuse to rewrite newer" rule, and add a migration or an explicit "wipe and rebuild" rule for each cache.

A5. Auth database schema and token record

crates/auth/: every backend uses CREATE TABLE IF NOT EXISTS with no schema version or migration table. TokenRecord has no expiry, name, scopes, or kind; readonly and cidr_whitelist exist but nothing can set them; last_used_at is written once and never updated. Tokens are bound to the username string, not a stable id. The public types Identity, TokenRecord, TokenBackend, and UserBackend are re-exported from the published pnpr crate and are not #[non_exhaustive], so adding any of these fields later breaks library users. MySQL's default collation makes usernames case-insensitive there but not on SQLite or Postgres.

Add a schema version table and migration runner, add the nullable columns now (expires_at, name, scopes, kind), mark the public types non-exhaustive or make fields private, and set an explicit collation on MySQL. A pnpr_ token prefix for secret scanning can come later compatibly.

A6. Protocol versioning for the pnpm client

crates/pnpr/src/server/pnpr_protocol.rs, resolver/protocol.rs, resolver/wire.rs, and pnpm/crates/pnpr-client:

  • The handshake's versions field means resolver versions; fixLockfile is a feature flag disguised as a version list; compiler cache, registries, admin, SCIM, sign-in, and /-/pnpm/v1/publish are not advertised; the Rust client gates both the resolver and artifacts on one PROTOCOL_VERSION = 0 constant, so bumping one bumps both.
  • Neither client calls the handshake before an npm resolve or verify-lockfile. The TypeScript client never calls it before resolving at all.
  • Both clients reject an unknown NDJSON frame type as a protocol error, so no new frame (a warning, or the "allowed picks" frame proposed in pnpr: policy gaps on the pnpr path (strict mode inert, loose-mode auto-collect, error codes, capability negotiation) #25) can be added without breaking every shipped pnpm. An ignore-unknown-frames rule must exist before v1.
  • Capability detection is one ad-hoc check per field (transforms header, patchedDependencies, publishDirectory, addMissingPeerTypes). The done frame does not echo which policies the server applied, and errors carry no codes, so ERR_PNPM_OUTDATED_LOCKFILE is lost through pnpr and the PyPI fallback matches on error text.
  • The lockfile on the wire is serde JSON of pnpm_lockfile::Lockfile, always stamped 9.0, with no negotiation of the format the client accepts. Format-12 registry-qualified keys can be produced for a pnpm v11 client that only reads 9.0. RegistryDeclaration, PackageExtension, Catalogs, TrustPolicy, and ResolutionMode are pnpm-internal types on the wire, so a serde change in pnpm_config silently changes pnpr's wire format.
  • Mixed versions in paths: /-/pnpm/v1/publish beside /-/pnpr/v0/publish (two batch publish endpoints, the second with no client yet), SCIM at /-/pnpr/v0/scim/v2, on-disk v0 and v1 directories side by side.
  • Every pnpm v11 ever shipped sends nodeVersion/os/arch, expects exactly the package/done/error/violations frames, buffers the response, and never uses verify-lockfile. pnpr v1.x has to keep serving that request shape as long as v11 is supported.

Decide: a client must handshake before resolve and verify; versions are a major number plus a feature list, named per protocol; the request carries the lockfile formats the client accepts and the server renders the highest; wire types move to a versioned schema crate; the done frame echoes the applied policies; errors carry codes. Freeze /-/pnpr/v1/resolve and verify-lockfile only. Keep artifacts, compiler cache, pipeline runs, and the cross-ecosystem publish on v0 outside the v1 commitment, as the docs already label them.

A7. CLI surface

crates/pnpr/src/main.rs: --osv turns a feature on while the other flags turn surfaces off, and PNPR_OSV=false cannot override osv.enabled: true; there is no --disable-pipeline; --packument-ttl-secs and --min-age-secs put the unit in the name; server flags apply to the oci-gc subcommand too; every error exits 1. Settle the flag grammar (pnpr serve with bare pnpr as alias, interval-valued flags, --<feature>[=bool]) before v1. Adding config check, user add, and token create subcommands is additive and can follow.

A8. Distribution

  • Platform packages are named @pnpm/pnpr.linux-x64 while the pnpm CLI uses @pnpm/linux-x64. Pick one convention.
  • The latest dist-tag of @pnpm/pnpr and its platform packages points at 0.0.0-26070301, a July 2026 pre-alpha snapshot, and @pnpm/pnpr-ui@latest is 0.0.0-0. pnpm add -g @pnpm/pnpr installs that snapshot. The release workflow correctly keeps prereleases on next, but nothing ever moved latest. Either move latest to the current alpha or unpublish the snapshots; the docs now say @pnpm/pnpr@next until then.
  • The Docker image runs the bundled test config bound to 0.0.0.0 with no -c and has no init process, so SIGTERM is ignored (see C1).
  • engines: node ">=18.*" is an odd range. The preinstall hard-link has no fallback when install scripts are blocked.
  • @pnpm/pnpr-ui is found by a hard-coded sibling directory name and released in lockstep. Decide whether that stays a v1 rule.

B. Architecture to rethink

B1. Identity is a bare username

Identity is only a username (crates/policy/src/access.rs). Self-registration (PUT /-/user/org.couchdb.user:{name}) never checks OIDC bindings, workload bindings, or auth.admins, so while max_users allows registration anyone can register as release-ci or as an admin who has no password account yet and inherit that principal's rights. The docs even recommend letting the first admin self-register before locking registration. SCIM-provisioned names are not reserved either. Decide how identities are namespaced (at minimum, reserve bound and admin names), and whether tokens reference a user id. Changing this after v1 changes what every access list means.

B2. No owner or maintainer model

There is no npm owner, no first-publish claim, and no tombstone. With the default publish: $authenticated, any authenticated user can squat any name an open pattern covers and publish new versions of packages others created; after a full unpublish the name can be re-claimed and an unpublished version republished with different bytes. npm owner add also fails because its first request is a GET on the login path, which only accepts PUT. maintainers is stored but never used. Even an opt-in $owners access token with first-publisher-becomes-owner semantics changes what "publish" means, so the default matters and should be decided before v1. #19 lists this as open.

B3. Publish journal durability on S3

With the S3 backend the publish journal and staging area live under the local cache directory, which the docs call disposable. A replica that dies after sealing a transaction and before applying it loses that publish, and a cross-ecosystem batch can be left half-applied on shared storage. ManifestBlob.tmp_path is also stored as an absolute path, and a missing tmp file during replay is treated as "already promoted", so a moved or wiped cache leaves a packument advertising versions with no tarball. Decide where the journal lives (bucket-side, or a durable volume that is documented as such) and make replay verify the final blob exists.

B4. Per-ecosystem meaning of shared concepts

unpublish means npm unpublish, OCI delete, nothing for Cargo (yank uses publish), and nothing for PyPI. teamsManagedBy: api is accepted on Cargo, PyPI, and OCI registries but unreachable, because the team API resolves an npm scope. OIDC workloads, staged publishing, dist-tags, OSV, minimumReleaseAge, and trustPolicy are npm-only. The packages: pattern language has no prefix form for Cargo or PyPI, so on a router fronting crates.io or pypi.org every new private crate needs a config change the admin API cannot make, and adding a prefix glob later would break the "one key per specificity tier" rule. Either reject the meaningless combinations or add ecosystem-neutral equivalents, and decide the tie-break rule for prefix patterns before freezing.

B5. Shared secret

One secret: keys the private cache HMAC and derives the OCI token signing key. Rotating it invalidates caches; leaking it lets someone forge OCI tokens. An unresolved ${VAR} substitutes an empty string with only a warning, so an unset ${PNPR_SECRET} silently falls back to a random per-process secret and OCI tokens stop working across replicas. Split the keys (or derive per-purpose subkeys), document rotation, and make an unresolved variable in a secret-bearing field a hard error.

B6. Crate structure and the public Rust API

crates/pnpr is 49k lines (26k source, 23k tests); server/ is 17.5k, with npm (about 6k), OCI (3k), Cargo (0.7k), PyPI (0.6k), and auth/admin (3k). There is no surface-level trait; Cargo, PyPI, and OCI share HostedDocument, staging, and target resolution, while npm is the older separate path. Ecosystem knowledge is scattered: write classification sniffs paths in authentication.rs, upstream download hosts are hardcoded in ecosystem.rs, match ecosystem dispatch appears in several places. The resolver pulls in 19 pnpm-* crates that every registry-only build carries. The pnpr crate is publishable and re-exports a large config and registry API while still describing itself as an "npm registry server". The split (server core, per-ecosystem surfaces, resolver, binary) is internal and can wait; marking the library re-exports unstable or publish = false before v1 cannot.

B7. Extensibility decision (from #19)

UserBackend/TokenBackend are public traits; HostedBackend is crate-private; policy, upstreams, and ecosystems are compiled in; SQL backends are Cargo features. State explicitly that v1 has no plugin surface beyond embedding the library, or define and document the trait surface.

C. Features missing for production

In rough priority order. Those marked (parity) are already in #19.

  1. SIGTERM handling. shutdown_signal only awaits ctrl_c, and the image runs pnpr as PID 1, so docker stop and Kubernetes shutdowns wait out the grace period and kill it. Also make /-/ping or a new readiness endpoint check storage, S3, and the auth database.
  2. Trusted-proxy support. Client IP is always the socket peer; CIDR-restricted tokens, logs, and any future rate limiting see the proxy's address. crates/config/src/ip_network.rs is used only for outbound policy. (parity)
  3. Rate limiting, request timeouts, and concurrency limits. None exist. Login is protected only by bcrypt cost; anonymous PUT /{name} buffers up to 100 MiB before authorize runs; concurrent upstream fetches of one package are not coalesced.
  4. Metrics and request IDs. No Prometheus endpoint, no OpenTelemetry, and the access log has no request id, user, client IP, user agent, or byte count. (parity)
  5. Cache eviction. The upstream tarball and packument cache has no size cap, LRU, or TTL deletion; oci-gc is the only reclamation tool. Orphaned private namespaces from per-process secrets are never cleaned. (parity)
  6. npm audit. No /-/npm/v1/security/audits, /quick, or /advisories/bulk; OSV is only used to hide versions. pnpm audit against pnpr fails. (parity)
  7. npm token create with read-only, CIDR, expiry, and name, so least-privilege CI credentials exist outside OIDC workloads (which cover npm only). Also update last_used_at.
  8. npm publish --provenance. The .sigstore attachment is rejected because attachment names must end in .tgz; /-/npm/v1/attestations and /-/npm/v1/keys do not exist.
  9. Admin audit log. User, rule, team, SCIM, and unpublish handlers emit no log events.
  10. Packument caching headers. No ETag or 304 on packuments, no Vary: Accept although the body depends on Accept, and no Cache-Control on public packuments (pnpr: split the packument into a mutable version index and immutable per-version docs to speed up resolution #23 lists the cheap wins).
  11. Login web flow (/-/v1/login) so plain npm login can use SSO; today OIDC sign-in is a pnpr-specific URL.
  12. Tooling: config check, verify (every document against its blobs), export, backup guidance, local-to-S3 migration, verdaccio htpasswd import (bcrypt-only today, and one {SHA} line rejects the whole file).
  13. Webhooks, hot reload, TLS: decide and document. The docs still mention a config reload that does not exist (fixed in the docs PR below); rustls is only used by the libsql client.

D. Bugs found during the audit

The pnpr audit bugs below were fixed in pnpm/pnpm#16927:

  • Unpublishing a package named pnpr-store, pnpr-cache, osv, shared-artifacts, or pnpr-hosted-staging runs remove_dir_all on pnpr's own cache subsystems, because Storage::remove_package and remove_blob also remove <cache>/<name> at the cache root (crates/storage/src/lib.rs). Nothing writes there any more.
  • The S3 listing prefix bug for ~ in grouped-registry namespaces (A4).
  • Journal replay writes a document whose tarball may not exist (B3).
  • PUT /{pkg}/-rev/{rev} keeps the body verbatim; immutability covers only dist.integrity and dist.tarball, so a caller with publish and unpublish rights can rewrite dependencies, bin, or scripts of a published version (package_mutation/immutability.rs).
  • is_write_request denies listed methods instead of allowing listed reads: POST /-/stage/package/{name} and POST /-/stage/{id}/approve are not classified as writes, and on a PyPI-only server POST /legacy/ is not either. Harmless today only because nothing can mint a read-only token.
  • Rewriting htpasswd through write_atomic resets its permissions, losing an operator's chmod 600; tokens.db gets default permissions too.
  • Login reveals which usernames exist: unknown user with registration disabled gets an immediate 403 registration_disabled; known user with a wrong password gets a 401 after bcrypt.
  • Self-registration accepts an empty password; bcrypt input is silently truncated at 72 bytes (hash_with_result instead of the non-truncating variant).
  • npm upstream proxy clients are explicitly excluded from the fetch guard and DNS guard that the resolver uses (server/state.rs), so a redirecting upstream can make pnpr fetch internal addresses.
  • Config derives Debug including the cache secret, and LibsqlSettings.auth_token and SQL URLs with passwords use derived Debug. Nothing logs them today.
  • The admin user deletion endpoint does not end OIDC browser sessions; only SCIM does. OIDC sessions are capped at 1,024 per process, so one user can lock everyone out of browser login for an hour.
  • PipelineRun is stored as the wire type with deny_unknown_fields; after a rollback one newer record makes list fail.
  • entry_digest for shared artifacts hashes serde_json::to_vec(subject), so any change to how ArtifactSubject serializes moves every entry.

Still open:

  • The benchmark hooks PACQUET_BENCHMARK_PNPR_SERVER_REGISTRY and PACQUET_BENCHMARK_PNPR_TARBALL_REWRITE_FROM ship in the pnpm binary (pnpm/crates/cli/src/cli_args/install/pnpr_request.rs).

E. Sound and worth freezing as-is

  • Declared provenance: routers pick the first claiming source, never fall through, are validated at load, with coverage computed per ecosystem.
  • ecosystem as a property of a concrete registry, routers filtering sources by it.
  • Canonical names per ecosystem at the request boundary, packages: keys normalized the same way.
  • The access grammar ($all, $authenticated, $anonymous, team:, username), which rejects unknown $ and kind: forms at load so new kinds can be added later.
  • One token store with per-client header shapes; OCI scoped tokens derived from a parent token and re-checked per request.
  • OCI /v2/ at the host root plus /oci/ for path-capable clients.
  • S3 conditional writes for cross-replica publish safety.
  • Upstream cache namespaces keyed by registry and credential; credentials attached only to same-origin HTTPS or loopback destinations.
  • OIDC: exact-subject bindings, no account auto-creation, PKCE and nonce, public-IP-only discovery.

F. Documentation

Stale documentation found during the audit was fixed in pnpm/pnpm#16926: the duplicated crate README and OIDC.md, the @pnpm/pnpr.client README (old remoteSideEffectsCache spellings and a stale owner rule), the handshake description, the namedRegistries field name, the claim that pnpm handshakes before resolving, the nonexistent config reload, the packument TTL help text, the --config help text, and the install instructions (@next).

Still to write for v1: the reverse-proxy and TLS deployment guide, backup and restore, the S3 journal caveat, exit codes, and a settings reference entry for pnprServer on the pnpm side (it is documented only in pnpr's docs today).

Suggested order

  1. Decide A1 (URL layout), A2 (config shape), and A4 (store layout) together; they share the ecosystem and namespace questions.
  2. Replace the bundled default config (A3) and fix the Docker default command and SIGTERM (C1); these are small and unblock running the current alpha safely.
  3. Add format versions and the auth schema version (A4, A5) before any other persisted-format change.
  4. Settle identity and ownership (B1, B2).
  5. Version the pnpm protocol (A6) together with pnpr: policy gaps on the pnpr path (strict mode inert, loose-mode auto-collect, error codes, capability negotiation) #25.
  6. The remaining C items can land in any order and most are additive.

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

Activity

  1. zkochan commented on Oct 14, 2026

    @zkochan
    MemberAuthor

    Opened draft PR pnpm/pnpm#16927 covering the Section D audit bugs:

    • Storage subsystem isolation: Restricted Storage::remove_blob and remove_package to the hosted backend so unpublishing packages named pnpr-store, pnpr-cache, etc. does not delete internal cache subsystems.
    • S3 grouped-registry namespace prefix: Percent-decodes package names and normalizes prefixes via object_store::path::Path.
    • Journal replay tarball loss prevention: Checks open_hosted_blob() before marking blobs lost during crash recovery journal replay.
    • Published version metadata immutability: Rejects modifications to metadata fields (dependencies, scripts, bin, etc.) of already published versions in PUT /{pkg}/-rev/{rev} and restores omitted metadata fields from the hosted manifest.
    • Write request classification: Switched is_write_request to an explicit read-method and read-endpoint allowlist so sensitive endpoints (POST /-/stage/..., POST /legacy/) cannot be accessed with read-only tokens.
    • Auth file permissions: Preserves permissions on atomic file write and defaults newly created htpasswd and tokens.db to 0600 on Unix.
    • Anti-user-enumeration: Runs dummy bcrypt verification and returns 401 instead of 403 on disabled registration when a user is not found.
    • Password length & non-truncating bcrypt: Enforces a 71-byte maximum password length and non-truncating bcrypt verification (verify_password / hash_password).
    • Upstream proxy fetch guard: Uniformly applies with_fetch_guard to npm upstream proxy clients to prevent requests to loopback or private network addresses via redirects.
    • Secrets in Debug representations: Implemented manual Debug for Config, LibsqlSettings, and database config redacting secrets and tokens.
    • Admin user deletion OIDC session revocation: Revokes active OIDC sessions when an admin deletes a user account.
    • PipelineRun schema flexibility: Removed deny_unknown_fields from PublishPipelineRun deserialization.
    • Domain-separated artifact entry digest: Domain-separates artifact fields with null bytes in entry_digest.

    Created by Antigravity (gemini-2.5-pro)

  2. zkochan commented on Oct 14, 2026

    @zkochan
    MemberAuthor

    PR pnpm/pnpm#16927 has merged to main, resolving the Section D audit bugs for pnpr:

    • Storage subsystem isolation: Restricted Storage::remove_blob and remove_package to the hosted backend so unpublishing packages named pnpr-store, pnpr-cache, etc. does not delete internal cache subsystems.
    • S3 grouped-registry namespace prefix: Percent-decodes package names and normalizes prefixes via object_store::path::Path.
    • Journal replay tarball loss prevention: Checks open_hosted_blob() before marking blobs lost during crash recovery journal replay.
    • Published version metadata immutability: Rejects modifications to metadata fields (dependencies, scripts, bin, etc.) of already published versions in PUT /{pkg}/-rev/{rev} and restores omitted metadata fields from the hosted manifest.
    • Write request classification: Switched is_write_request to an explicit read-method and read-endpoint allowlist so sensitive endpoints (POST /-/stage/..., POST /legacy/) cannot be accessed with read-only tokens.
    • Auth file permissions: Preserves permissions on atomic file write and defaults newly created htpasswd and tokens.db to 0600 on Unix.
    • Anti-user-enumeration: Runs dummy bcrypt verification and returns 401 instead of 403 on disabled registration when a user is not found.
    • Password length & non-truncating bcrypt: Enforces a 71-byte maximum password length and non-truncating bcrypt verification (verify_password / hash_password).
    • Upstream proxy fetch guard: Uniformly applies with_fetch_guard to npm upstream proxy clients to prevent requests to loopback or private network addresses via redirects.
    • Secrets in Debug representations: Implemented manual Debug for Config, LibsqlSettings, and database config redacting secrets, query params, and tokens.
    • Admin user deletion OIDC session revocation: Revokes active OIDC sessions when an admin deletes a user account.
    • PipelineRun schema flexibility: Removed deny_unknown_fields from PublishPipelineRun deserialization.
    • Domain-separated artifact entry digest: Domain-separates artifact fields with null bytes in entry_digest.

    Updated by Antigravity (gemini-2.5-pro)

  3. zkochan commented on Oct 14, 2026

    @zkochan
    MemberAuthor

    Draft pull request opened at pnpm/pnpm#16934 implementing Section C1 (Container shutdown & readiness):

    • Implements Unix SIGTERM signal listening in shutdown_signal alongside SIGINT (Ctrl-C) to perform graceful container shutdowns and connection draining.
    • Implements check_readiness() across all storage (local filesystem, S3 bucket with 5s timeout) and auth backends (htpasswd, SQLite, Libsql, PostgreSQL, MySQL).
    • Exposes dedicated GET /-/ready and GET /-/live endpoints globally and under registry prefixes, and updates GET /-/ping to return 503 when backend services are inaccessible.

    This addresses §C1 of this issue.


    Created by Antigravity (gemini-2.5-pro)

  4. zkochan commented on Oct 14, 2026

    @zkochan
    MemberAuthor

    Pull request pnpm/pnpm#16934 has merged, completing Section C1 (Container shutdown & readiness):

    • Unix SIGTERM handling for graceful container shutdown alongside SIGINT.
    • Storage and authentication backend readiness checks (check_readiness()).
    • Dedicated /-/ready and /-/live health endpoints, with /-/ping returning 503 Service Unavailable on backend outages.

    Created by Antigravity (gemini-2.5-pro)

  5. zkochan commented on Oct 14, 2026

    @zkochan
    MemberAuthor

    Opened draft PR pnpm/pnpm#16939 covering Section C2 (Trusted-proxy support):

    • Adds trusted_proxies configuration to pnpr-config (HttpConfig) with CIDR, IP, and loopback support.
    • Implements secure client IP resolution traversing Forwarded, X-Forwarded-For (right-to-left), and X-Real-IP when socket peer is trusted, skipping intermediate trusted proxies.
    • Ignores forwarding headers when socket peer is untrusted.
    • Attaches ClientIp to request extensions and logs it to pnpr::access trace span.
    • Deduplicates CIDR token checks with pnpr_config::IpNetwork.

    Created by Antigravity (gemini-2.5-pro)

  6. 60 remaining items

  7. zkochan commented on Oct 18, 2026

    @zkochan
    MemberAuthor

    Section A4, storage-layout half, is merged in pnpm/pnpm#17100.

    • The hosted store has one layout on disk and in S3: layout.json, default/packages/<name>/{document.json,blobs/<file>} for registries without an org, orgs/<org>/packages/... for each org.
    • Every name, org and file name is one path segment ([a-z0-9._-] as is, other bytes as ! and two hex digits), so an org, a package, a blob and a nested image repository can no longer collide, names that differ only in case get separate directories, and S3 keys are the local paths. That also fixes the S3 ~ listing/sweep bug and removes the .package-index workaround and the exclusion lists in OCI GC and verify.
    • pnpr refuses a store marked by a newer pnpr or an unmarked store in the earlier layout; pnpr upgrade-storage [--dry-run] converts it on disk or in a bucket and can be resumed. The proxy cache is emptied once and refills.

    Still open in A4:

    • a formatVersion field in every persisted document (packument, CrateDocument, ProjectDocument, ImageDocument, journal, revision index, staged records), with a rule never to rewrite a newer document
    • one unknown-field policy for persisted records (RuleChanges, PackageChanges and PipelineRun reject unknown fields, the rest drop them)
    • team rosters and rule overrides keyed by registry name, so moving a registry into an ecosystem group changes their key
    • the revision reference index stored as a byte array
    • a local-to-S3 migration that covers more than npm packages

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

  8. zkochan commented on Oct 18, 2026

    @zkochan
    MemberAuthor

    Draft PR pnpm/pnpm#17112 has been opened covering the deliverables for Section A (Production Readiness):

    • A2: Persisted-document format versions: Added explicit format versions (formatVersion) to packuments, OCI image documents, crate documents, and state journals, rejecting documents written by newer format versions with DocumentFormatTooNew.
    • A4: CLI surface grammar: Supported the pnpr serve subcommand and added parse_cli_interval for duration units (s/m/h/d) and bare seconds on interval flags (--packument-ttl, --min-age, --max-age).
    • A6: Strict config validation & naming: Enforced strict YAML schema validation (rejecting unknown fields, removed blocks, and deprecated options), and unified field naming across configuration and CLI flags.
    • A7: Protocol versioning & pnpm client: Implemented /-/pnpr capability handshake, versioned endpoints (/-/pnpr/v1/resolve, etc.), policy echo verification in terminal frames, and structured error reporting.
    • A8: Distribution improvements: Added Node.js fallback wrapper script, aligned engines range, and added tini to the Docker image.

    Note: This PR addresses Section A. The remaining sections (Section B onwards) will follow in separate milestones.


    Generated by Antigravity (model: pro).

  9. zkochan commented on Oct 19, 2026

    @zkochan
    MemberAuthor

    Opened draft PR pnpm/pnpm#17126 covering Section B requirements (B4, B5, B6, B7):

    • B5: Hardened configuration secret parsing to fail fast at startup when secret-bearing fields contain unresolved ${VAR} references instead of silently falling back to empty strings or random per-process keys. Added support for independent secrets.cache and secrets.oci configuration for key rotation without cross-invalidation, and domain-separated HMAC-SHA256 subkeys derived from secret:.
    • B4: Enforced per-ecosystem validation rules rejecting teamsManagedBy: api on non-npm registries and package unpublish rules on Cargo and PyPI registries.
    • B6: Set publish = false on pnpr/crates/pnpr/Cargo.toml to prevent accidental crates.io publication.
    • B7: Documented the v1 extensibility model: compile-time trait implementations (UserBackend, TokenBackend), no dynamic plugin runtime.
  10. zkochan commented on Oct 19, 2026

    @zkochan
    MemberAuthor

    All requirements and audit findings for pnpr production readiness have now landed across the following pull requests:

    Section A: Breaking Changes

    Section B: Architecture

    Section C: Production Features

    Section D: Audit Bugs

    Section F: Documentation

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions