Repository navigation
Closed
Description
Status: planned. Phase 1 is in progress.
pnpr permissions can only change through a config deploy. Teams and package rules live in YAML. The npm team endpoints answer teams_config_managed (403) to every write. There is no admin role, and the web UI can only read because CORS allows only GET/HEAD. This plan adds runtime administration in phases. Each phase ships as one pnpm/pnpm PR plus one Bit lane on pnpm.pnpr for the UI.
Current state (origin/main, 2026-10-08)
Identityis only a username (pnpr/crates/policy/src/lib.rs). Nothing grants admin rights.- When the config is compiled, team members are copied into
AccessToken::Team { members }(pnpr/crates/config/src/access.rs).Configis immutable for the process lifetime, and nothing reloads it. - Shared state across replicas: users and tokens in the SQL auth backend, and records in the hosted store (
read_record/create_record/replace_record_if_current, compare-and-set on S3). - CORS:
allow_methods([GET, HEAD, OPTIONS])inpnpr/crates/pnpr/src/server/routing.rs. Credentials travel only in theAuthorizationheader. The OIDC cookie only carries login state, so cross-origin writes are not exposed to CSRF.
Phase 1: admin role and runtime teams
Server:
- Top-level
admins:config: a list of usernames who may administer every registry. - Per hosted registry:
teamsManagedBy: config | api, defaulting toconfig, which keeps today's behavior. Withapi, the registry's YAMLteams:only seeds the store the first time. After that the store owns the teams. AccessToken::Teamreads a shared, swappable team directory instead of a copied member set. A rule that references a team sees membership changes immediately. A team missing from the directory admits nobody.- Teams are persisted as a hosted-store record (
.teams/v0/<registry>). Writes are read-modify-write with compare-and-set and retry on conflict. Every replica refreshes its directory from the store when it is older than a short TTL. The refresh runs in the request middleware, so there is no background task, and the first request after startup waits for the load. - On
apiregistries, admins can use the npm team endpoints that returnteams_config_managedtoday: create a team, destroy a team, add a member, remove a member. That makespnpm team/npm teamwork. Destroying a team that apackages:rule references is refused with 409.configregistries keep answering 403. GET /-/pnpr/v0/admin/mereturns{ "admin": bool, "teams": { "<registry>": "config" | "api" } }, so the UI shows edit controls only where they work.- CORS adds PUT, POST, DELETE.
UI (pnpm.pnpr lane):
pnprFetchgains write methods. The comment that the app only issues GET goes away.- New
api/teamshooks and commands, plus apages/teamspage: list teams per scope and their members, and for admins onapiregistries, create, destroy, add, and remove. - A "Teams" nav entry under Server.
Phase 2: user administration
UserBackendgainslist,create,delete, andset_passwordfor htpasswd, libsql, and sqlx. Deleting a user revokes their tokens.- Admin API:
GET/PUT/DELETE /-/pnpr/v0/admin/users[/{name}], plus listing and revoking tokens per user. - Limitation: htpasswd users stay per-replica. Multi-replica deployments need the SQL backend, as they do today.
- UI: Users page.
Phase 3: runtime package rules
- Admins can replace
access/publish/unpublishfor package patterns a registry already claims. Patterns themselves stay in config, because they feed routing. - Stored with the same record and refresh mechanism as teams, and recompiled into
PackageRulesbehind a swappable handle. - npm
access grant/revokemapped onto team rules where the shapes match. - UI: rule editor on the registry page.
Phase 4: SSO group mapping
- OIDC
login.usersbindings may name a claim (for examplegroups) whose values map to team memberships, refreshed at each sign-in. - Optional SCIM endpoint for deprovisioning, once phase 2 exists.
Out of scope
- A cross-replica push channel. TTL polling bounds staleness instead.
- Replacing YAML. Config stays a valid source, and
apimanagement is opt-in per registry.
Written by an agent (Claude Code, claude-opus-5-5).
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(pnpr): let admins manage teams through the npm team API (#16725)
zkochan commentedon Oct 8, 2026
Phase 1 landed in pnpm/pnpm#16725: the
auth.adminsrole,teamsManagedBy: api, store-backed team rosters, and npm team writes. The registry directory reportsadminandteamsManagedByin place of the planned/-/pnpr/v0/admin/me. The UI half is Bit change request https://bit.cloud/pnpm/pnpr/~change-requests/team-administration.Starting phase 2: user administration.
Written by an agent (Claude Code, claude-opus-5-5).
feat(pnpr): let admins manage accounts through an admin API (#16729)
zkochan commentedon Oct 8, 2026
Phase 2 landed in pnpm/pnpm#16729: the admin account API (
/-/pnpr/v0/admin/users), admin-created accounts that bypassmax_users, and token revocation on removal. The UI half (an Accounts screen) is on Bitmainthrough theuser-administrationlane.One deliberately open case is recorded in that PR: a login racing a removal whose final token sweep fails keeps its token until the removal is repeated.
Starting phase 3: runtime package rules.
Written by an agent (Claude Code, claude-opus-5-5).
feat(pnpr): let admins change package rules through an admin API (#16732
zkochan commentedon Oct 8, 2026
Phase 3 landed in pnpm/pnpm#16732:
rulesManagedBy: apiand/-/pnpr/v0/admin/rules/{ecosystem}/{name}. Admins replace a hosted registry's defaultaccessand theaccess/publish/unpublishlists of its declared patterns.PackageRulesis now a live handle, so the resolver sees changes too. The UI (a Package rules panel on the Registries screen) is on Bitmain.Follow-ups left by phase 3:
npm access grant/revokeonto rules.If-Match), if concurrent admin edits turn out to matter. Today it is last-writer-wins by design.pnpm.design/actions/[email protected]declares a react-router-dom^5.3.4peer while pnpr-web uses v6. Three pnpr-ui components now pin^6.30.6to work around it.Remaining: phase 4 (OIDC group-to-team mapping, SCIM).
Written by an agent (Claude Code, claude-opus-5-5).
feat(pnpr): grant registry teams from OIDC groups (#16735)
zkochan commentedon Oct 8, 2026
Phase 4 (group mapping) landed in pnpm/pnpm#16735.
auth.oidc[].login.groupsmaps an ID-token groups claim to registry teams. The memberships last for the session and ride on the request identity, not the roster.Every phase of the plan has now shipped except SCIM, which was left out deliberately: it needs its own provisioning surface and credential type.
Open follow-ups:
npm access grant/revokeonto rules.If-Match) for the rules API.pnpm.design/actions/button's react-router-dom^5.3.4peer (three pnpr-ui components pin v6 to work around it).Written by an agent (Claude Code, claude-opus-5-5).
zkochan commentedon Oct 8, 2026
Progress on the follow-ups:
If-Matchfor the rules API: feat(pnpr): make rule changes conditional on the version they read pnpm#16739, with UI change request https://bit.cloud/pnpm/pnpr/~change-requests/rules-if-match.npm access grant/revoke/list packagesonto rules: feat(pnpr): map npm access grant and revoke onto rules pnpm#16740 (draft, stacked on 16739).react-router-domonnavigation/link,actions/button, andactions/cta-buttonto^5.3.4 || ^6.30.6. pnpm.io still runs 5.3.4, so moving to^6alone would have broken it. After it merges, the three pnpr-ui pins can go.SCIM plan (deprovisioning first)
Constraint: an OIDC sign-in creates no account row, and its session lives in memory on one replica. Deleting an account row is therefore not enough to deprovision anyone.
auth.scim.token, a bearer secret (${VAR}substitution applies). It only authenticates/scim/v2/*. It is not a user token and is not admin on the npm API..scim-users/v0) and replicas reload it on the managed-state TTL, like rosters and rules. A user's SCIMidis the username.GET /scim/v2/Users, withfilter=userName eq "...",startIndex, andcount.GET /Users/{id}.POST /Users.PUT /Users/{id}andPATCH /Users/{id}, foractiveonly.DELETE /Users/{id}.active: falseorDELETE. It:POST, oractive: true) only marks the username active. It does not create a password, because the IdP is the sign-in path.login.groupsalready carries memberships per session. A SCIM Groups resource ontoteamsManagedBy: apirosters can follow if an IdP needs push-based groups.ServiceProviderConfig,ResourceTypes, andSchemas, at the minimum Entra ID and Okta need to connect.Written by an agent (Claude Code, claude-opus-5-5).
feat(pnpr): make rule changes conditional on the version they read (#…
feat(pnpr): deprovision accounts through SCIM
zkochan commentedon Oct 8, 2026
Merged:
If-Matchfor the rules API)Still open, both rebased onto main:
npm accessgrant, revoke, and list)Waiting for review: Bit change requests
rules-if-match(pnpr) androuter-peer(design).Written by an agent (Claude Code, claude-opus-5-5).
feat(pnpr): deprovision accounts through SCIM (#16742)
zkochan commentedon Oct 8, 2026
Merged:
npm accessgrant, revoke, and list)Every pnpm/pnpm follow-up from this plan has now landed. Still open: the Bit change requests
rules-if-match(pnpr UI) androuter-peer(design system). Afterrouter-peermerges, the three pnpr-ui pins of react-router-dom^6.30.6can go.Written by an agent (Claude Code, claude-opus-5-5).
zkochan commentedon Oct 8, 2026
The Bit follow-ups have landed too:
pnpm.pnpr/rules-if-match: the admin UI sendsIf-Matchon rules edits.pnpm.design/router-peer: link, button, and cta-button accept react-router-dom 6 as a peer.pnpm.pnpr/drop-router-pins: the pnpr UI components no longer pin react-router-dom themselves and use the tagged design-system versions.Nothing from this plan is left open in pnpm/pnpm or on bit.cloud.
Written by an agent (Claude Code, claude-opus-5-5).
zkochan commentedon Nov 8, 2026
Every phase and follow-up has merged (pnpm/pnpm#16725, pnpm/pnpm#16729, pnpm/pnpm#16732, pnpm/pnpm#16735, pnpm/pnpm#16738, pnpm/pnpm#16739, pnpm/pnpm#16740 and pnpm/pnpm#16742).
Written by an agent (Claude Code, claude-opus-5-5).