›bobbyencoded_
/posts/newsletter/courses/about
/posts/newsletter/courses/about

The Decode

The week's AI & software news, decoded.

Subscribe →

// © 2026 BobbyEncoded Inc. — A Canadian corporation

← Back to Blog

Identity by Name vs by ID

November 10, 2026 · 8 min read

Security, npm, Supply Chain, GitHub Actions, Distributed Systems, Developer Tools

There's a rule in distributed systems that the industry keeps relearning: a name is not an identity. Names get renamed, deleted and reused. If you decide who someone is by their name, eventually you'll decide that a stranger is them.

On October 13, security researchers at Bloom Security published a flaw in npm's Trusted Publishing that is exactly this mistake, in one of the most security-sensitive places in the JavaScript ecosystem. GitHub had shipped a mitigation on October 2. I want to walk through how it worked, because the lesson applies well beyond npm, including to the apps I build.

What Trusted Publishing is

Publishing a package to npm used to mean storing a long-lived npm token as a CI secret. Steal the token, publish anything. Trusted Publishing removes the token:

  1. A maintainer tells npm: "this package may be published by this GitHub repository, running this workflow file."
  2. When that workflow runs in GitHub Actions, GitHub issues it a short-lived OpenID Connect (OIDC) token describing where it's running.
  3. npm checks the token against the configuration and, if it matches, hands back a short-lived publish credential.

No secret sits in CI waiting to leak. It's a genuinely better design, and npm and GitHub have been pushing maintainers toward it. Which is why the flaw matters.

The bug: matching on the slug

The question is what "this GitHub repository" means. A repository has two identifiers:

  • its slug, owner/repo, which is a name and can change, and
  • its numeric IDs, repository_id and repository_owner_id, which GitHub assigns once and never reuses.

GitHub's OIDC token carries both. According to Bloom's write-up, when a maintainer created a trusted publishing configuration, npm stored the slug and the workflow filename (and environment, if set), but not the numeric IDs. It only recorded the IDs after the first successful publish.

So for a package whose configuration had never been used to publish, the attack went like this:

  1. The maintainer renames, transfers or deletes the bound repository, or the owner account is renamed or deleted. The old owner/repo name is now free.
  2. The attacker creates a repository at that exact name. GitHub gives it a new repository ID, but the slug matches.
  3. The attacker adds a workflow with the same filename as the one in the configuration, say release.yml, with permission to request an OIDC token.
  4. npm compares slug and filename, both match, and issues a publish credential.
  5. The attacker publishes a new version of someone else's package. No credentials stolen.

Bloom demonstrated this end to end against a package scope it owns. It counted more than 1,500 exposed packages with over 10 million total downloads, and Help Net Security reports the same issue affected npm's GitLab integration. Bloom says it hasn't seen it exploited in the wild, and isn't naming the affected packages. One partial safeguard existed already: Help Net Security notes that GitHub retires the names of repositories with more than 100 clones in the week before their owner account is renamed or deleted, which protected some popular packages.

Bloom says it reported the issue through GitHub's bug bounty programme on June 6, it was validated on June 9, and the fix shipped roughly four months (Bloom counts 120 days) after the report.

Why provenance didn't help

This is the part I find most instructive. npm packages published from CI can carry provenance: a signed statement, logged in a public transparency log, saying which repository and build produced this package. It's meant to answer "where did this come from?"

In this attack, provenance worked perfectly. The malicious version would carry a valid attestation, correctly naming the attacker's repository. Nothing was forged.

The problem is the question people ask of provenance. "Is this package signed?" Yes. "Was it built in CI?" Yes. Neither tells you it was built in the right repository. npm's own docs are careful here: provenance tells you where a package was built, not that it's safe. A signature proves who signed something. It can't tell you whether that's who you expected. It's the same lesson as the AsyncAPI attack I covered in The Decode #002, from a different direction.

The old lesson underneath

None of this is new; it's one of the oldest mistakes in distributed systems, and it keeps coming back because names are so convenient.

  • Identity providers. Microsoft's identity platform docs say the upn claim "is not a durable identifier for the user and shouldn't be used for authorization," and recommend the immutable object ID (oid) as the key instead. Usernames and emails change. Object IDs don't.
  • GitHub's own OIDC tokens. The token's sub claim used to be name-based, repo:owner/repo:.... GitHub announced in April 2026 that new repositories, and repositories that are renamed or transferred, get an immutable subject format that includes the owner and repository IDs (repo:OWNER@OWNER-ID/REPO@REPO-ID:...) from July 15, 2026. Older repositories can opt in. GitHub's docs say plainly why: name-based subjects can be reused when a namespace is recycled.
  • Anything with a reusable namespace. Expired domains that still receive password resets. Deleted usernames that get re-registered. Hostnames that point at a recycled IP.

The rule I keep coming back to is: look things up by name, trust them by ID. A name is fine for finding something. When you store a trust decision, store the identifier that can't be handed to someone else, and check it every time.

What GitHub changed

GitHub's changelog entry for October 2 says:

  • Unvalidated configurations now expire 48 hours after they're created, and can't authorize publishing after that.
  • A configuration becomes validated, and exempt from expiry, after its first successful publish.
  • Changing the repository or project identity requires a new trust relationship with a fresh 48-hour window.
  • npm now also rejects trusted publishing tokens from issue_comment workflow events, alongside the existing pull_request_target restriction. Publish from push, release or workflow_dispatch instead.

As I read it, this narrows the window rather than switching the check to IDs at creation time. A configuration either gets used quickly, at which point the IDs are recorded, or it dies. Bloom says it would have preferred storing the IDs when the configuration is created, which is what its write-up recommends.

What to do

If you publish packages to npm with Trusted Publishing:

  • Run npm trust list <package> for each package (the npm trust command needs npm 11.15.0 or later) and check that every repository it lists still exists and is still yours.
  • If you renamed or transferred a bound repository, remove the old configuration and create a new one for the current name. The docs show npm trust list to find its ID, then npm trust revoke --id <id>.
  • Treat renaming, transferring or deleting a repository as a security event. Remove the trust configuration first.
  • After creating a configuration, publish soon. That's what validates it now.
  • If you publish from an issue_comment workflow, move it.

If you build apps that depend on npm packages, which is most of us at some point, even with mostly native iOS and Android code:

  • Use a lockfile and review dependency updates, rather than always taking the latest version.
  • Run npm audit signatures to check signatures and attestations, but remember what it can't tell you: the provenance names a repository, and only you know whether it's the right one.
  • Be careful letting coding agents add dependencies unreviewed. Bloom's write-up makes this point directly: agents install a lot of packages, usually the latest version, and rarely check where they came from. The constitution in my spec-driven setup says "no new dependencies without asking" for exactly this reason.

If you design systems: wherever you store "this thing is trusted", ask what happens when its name is freed and someone else picks it up. If the answer is "they inherit the trust", key it on an ID.

Sources

  • GitHub Changelog, Unvalidated npm trusted publishing configurations now expire (Oct 2, 2026)
  • Bloom Security, SlugFest research write-up (Oct 13, 2026)
  • npm Docs, npm trust command reference
  • npm Docs, Generating provenance statements
  • GitHub Docs, OpenID Connect reference, and GitHub Changelog, Immutable subject claims for GitHub Actions OIDC tokens (Apr 23, 2026)
  • Microsoft Learn, Optional claims reference (the upn guidance)
  • Help Net Security, npm Trusted Publishing flaw exposed 1,500+ npm packages to takeover (Oct 13, 2026)
← Previous

The 2026 AI Architect's Checklist: 15 Questions Before You Ship an AI Feature

Next →

React Learning Path, Part 3: Advanced React and React 19

Thoughts on this?

Tell me on X: @bobbyencoded · Share this post on X

Want more like this? Subscribe to The Decode, a weekly email on the AI and developer news worth your time.