Safeguard
Security Guides•

How do you hand an npm package to a new maintainer safely?

To hand over an npm package, add the new owner, let them publish a test release, then remove yourself. Steps, the npm owner commands, and handover checks.

Safeguard Security Team
3 min read

To hand over an npm package safely, add the new maintainer with npm owner add, have them confirm access and publish a test release through your normal process, then remove your own access with npm owner rm. Do it in that order, in public, and rotate any credentials you shared.

What npm owner does

From the npm CLI documentation:

  • npm owner ls lists every user who can modify the package and publish new versions.
  • npm owner add USER PACKAGE makes a user a maintainer. Added users can change metadata, publish new versions and add other owners.
  • npm owner rm USER PACKAGE removes a user, and the docs say this immediately revokes their privileges.
  • There is one access level. A user can modify the package or cannot.
  • If your account uses 2FA for auth and writes, changing ownership needs a second factor step. You can supply a one time code up front with the otp option.

Because an owner can add other owners, giving someone access is a big step. Treat it like handing over keys.

Why handovers go wrong

The event-stream case is the well known warning. A maintainer handed a package to someone who offered to help, and that person later added malicious code. See event-stream in 2018, when a maintainer hands over a package. Hand over to people you have seen work, not to the first volunteer.

Steps

  1. Vet the person. Look at their history in the project, their other work and whether others vouch for them.
  2. Agree the scope. Will they own releases, security reports and the repository, or only releases?
  3. Check their account. They should use 2FA, ideally a hardware key. See maintainer 2FA methods ranked.
  4. Add them with npm owner add.
  5. Add them to the repository with the right role, and to the security contact list.
  6. Have them publish a test release or a patch through your usual pipeline.
  7. Move CI publishing to trusted publishing tied to the repository, so no personal token travels. See publish from CI or your laptop.
  8. Remove yourself with npm owner rm, once they have shipped and you have both checked.
  9. Post a short note in the README or an issue saying who the maintainer is now.

Credentials to rotate

ItemAction
npm tokens you createdRevoke
CI secrets you addedReplace or remove
Repository admin accessRemove or reduce yours
Shared mailbox or recovery addressesUpdate to the new owner
Signing keysRotate, and announce the new key

Leaving an exit trail

Keep a short handover note: date, new owner, what was transferred, and what you removed. If you later need to prove who could publish when, this helps. See also remove a maintainer access offboarding checklist and open source maintainer succession planning.

Safeguard dependency scanning lists everything your project depends on; the free scan is at gold.safeguard.sh/scan.

Quick check

Is there a single transfer button on npm?

The owner commands add and remove users, so a handover is an add followed by a remove. Check npm's current docs for any account level transfer feature.

Should I remove myself immediately?

No. Wait until the new maintainer has published a test release and both of you have confirmed access.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.