Skip to content

Lesson 7 of 9 · 23m

Registry Accounts and Publish Credentials

Protect maintainer accounts, publication tokens, OIDC trust, machine identities, and ownership transfer paths across package registries.

Most registry compromises are not cryptographic breakthroughs. They are stale tokens, shared maintainer accounts, overpowered CI secrets, or recovery emails controlled by one contractor who left three years ago. Registry hygiene is identity hygiene plus publication power management.

Inventory who can publish

Start with the uncomfortable question: which humans and machines can publish or modify release artifacts right now?

package registry owners
organization administrators
maintainers with publish rights
CI tokens and deployment keys
OIDC trust relationships
bot accounts and service accounts
domain/email accounts used for recovery
source repository admins who can edit release workflows

A registry account is only part of the boundary. If a repository maintainer can edit the workflow that mints an OIDC token, repository write access may effectively be publish access.

Prefer OIDC trusted publishing over static tokens

Static registry tokens are copyable credentials. They leak through CI logs, developer laptops, backup systems, and forgotten repository secrets. Trusted publishing exchanges a short-lived workload identity for publication rights:

permissions: {id-token: write, contents: read}
steps:
  - uses: actions/checkout@v4
  - run: python -m build
  - uses: pypa/gh-action-pypi-publish@release/v1
    with: {attestations: true}

The exact mechanics differ by ecosystem, but the principle is consistent: the registry trusts a specific repository, workflow, branch, and environment rather than a long-lived secret. Restrict those claims tightly.

Scope tokens like production credentials

Where static tokens remain, inventory and minimize them:

# example token inventory format, stored outside the repo
registry=npm owner=platform-ci scope=@acme permission=publish expires=2026-12-31 rotation_owner=marta
registry=docker owner=release-ci repository=payments-api permission=push expires=2026-12-31 rotation_owner=devon

Never use one token for every repository. Never place publish credentials in pull-request-triggered jobs. Never let untrusted code execute before secrets are needed.

Protect ownership transfer and recovery

Attackers target the edges: expired domains, weak registrar accounts, maintainer transfer workflows, package abandonment, and recovery inboxes. Enforce phishing-resistant MFA for registry maintainers, registrar accounts, email providers, and source control. Review ownership changes, not just publishes.

Watch publication events

A legitimate release process has rhythm. New versions appear after tags, CI runs, approvals, or changelogs. Investigate anomalies:

publish outside release window
version published without matching source tag
maintainer added outside normal onboarding
token created but never rotated
package unpublished and republished
provenance setting suddenly disabled

Registry audit logs are only useful if someone consumes them.

Field notes

  • Shared bot accounts destroy accountability even when they simplify automation.
  • Rotate tokens after personnel changes even if you believe access was removed; copies matter more than permissions.
  • Registry MFA protects humans, not CI tokens. CI needs trust-scoping and short credential lifetime.
  • Pull request workflows must not receive publication identities, even accidentally through reusable workflows.
  • Practice revoking a publish credential. A rotation procedure first written during compromise is not a procedure.

Was this lesson helpful?

Sign in to rate