/package-manager-development:package-manager-supply-chain-and-workspacesfrom package-manager-development
Reference for hardening package ecosystems against supply-chain attacks, covering the 2025-2026 npm worm era, attack taxonomy (typosquatting, dependency confusion, account takeover, install-time malware), registry and client-side controls, lifecycle scripts, workspaces, and non-registry dependencies.
Ships in package-manager-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Part 3 of 5 of the Package Manager Development reference (plugin
package-manager-development), covering §8–§10. Sibling skills:package-manager-versioning-and-resolution(§0–§4),package-manager-registries-and-installation(§5–§7),package-manager-ux-ecosystems-and-governance(§11–§14),package-manager-reference(§15–§20). Section numbers are shared across the set; a reference written as §N →skillpoints into that sibling skill.Currency: Verified August 2026. See §17 →
package-manager-referencefor the currency snapshot and what goes stale first.
How to read this. Reference, not tutorial. Sections are independent. Three markers:
- [DURABLE] — computer science, or a lesson every ecosystem has independently learned. Does not expire.
- [ECOSYSTEM] — specific to npm, PyPI, crates.io, Go, etc. Verify against that ecosystem's current docs.
- [CONTESTED] — the ecosystems have made genuinely different, defensible choices, or the practitioners disagree. Both cases given.
⚠️ GOTCHA boxes mark the design mistakes that produce unreproducible builds, wedged caches, exponential resolutions, or supply-chain compromise.
The framing that organizes everything below: a package manager is a distributed systems problem wearing a CLI. It is a cache-coherency problem, a constraint-solving problem, a trust-and-identity problem, and a compatibility-contract problem, all of which happen to be invoked by typing
install. Every serious difficulty in this document is one of those four, and treating it as "just downloading files" is the root of most bad designs.
[ECOSYSTEM, but the lessons are universal.] This is the most important recent case study in package-manager security, and its details matter.
Timeline:
shai-hulud-workflow.yml it dropped, a Dune reference) entered via maintainer
phishing. It injected malicious postinstall scripts, stole credentials, then — the
novel part — used the stolen npm token to authenticate as the compromised developer,
enumerate their other packages, inject itself, and publish new versions. Exponential
spread with no attacker involvement. It also created public GitHub repos named
"Shai-Hulud" containing the victim's exfiltrated secrets. GitHub removed 500+ compromised
packages and blocked uploads matching the malware's IoCs.keyv, flat-cache, cache-manager and 400+ packages across
multiple unrelated publishers, ~2 billion monthly installs, within hours. Microsoft's
analysis describes a heavily obfuscated Bun-based payload executing via npm
preinstall, harvesting npm, GitHub, AWS, Kubernetes, and HashiCorp Vault credentials.main and cutting a release through legitimate CI. JFrog documented one sample that,
inside a specific GitHub Actions run, requested an Actions OIDC token with audience
npm:registry.npmjs.org — i.e. abusing trusted publishing itself..pth file, which
auto-executes on every interpreter start — no import required.Scale context: ReversingLabs measured a 73% year-over-year increase in malicious open-source packages, with npm accounting for roughly 90% of open-source malware; Sonatype tracked 512,847 malicious packages in a single year.
[DURABLE] The five design lessons:
npm's response (worth knowing as the reference remediation): mandatory 2FA for publishing, revocation of legacy never-expiring tokens, granular access tokens with short expiry, and trusted publishing so build systems push without stored credentials.
| Attack | Mechanism | Defense |
|---|---|---|
| Typosquatting | reqeusts, python-dateutil vs dateutil | Name-similarity checks at publish, install-time warnings |
| Dependency confusion | Public package shadows a private one of the same name | Scoped/namespaced private packages; never let a public index satisfy an internal name. Configure per-registry scope pinning |
| Maintainer account takeover | Phishing, credential stuffing | Mandatory 2FA/WebAuthn, trusted publishing |
| Token theft | Exfiltrated from CI, dotfiles, a compromised machine | Short-lived OIDC credentials; no long-lived tokens |
| Self-replicating worm | Stolen token → publish to all your packages | §8.1; per-package publish scoping |
| Malicious maintainer / hostile handoff | Legitimate owner turns, or hands the package to an attacker | Ownership-change alerts, cooldowns, code review of updates |
| Protestware / sabotage | Author deliberately breaks or wipes | Lockfiles + cooldowns + vendoring for critical paths |
| Release poisoning | Add a malicious file to an old, trusted release | §5.3 → package-manager-registries-and-installation — PyPI's 14-day rule |
| Repojacking / name reuse | Take over an abandoned name or deleted repo | Never allow name reuse; verify repo ownership continuously |
| Compromised build tool | The CI action itself is backdoored (Trivy, KICS in 2026) | Pin actions by commit SHA, never by mutable tag |
.pth / import-time execution | Python-specific auto-execution | Restrict what installs may place on sys.path |
| Compromised mirror / MITM | Substituted bytes | TLS + lockfile hashes + transparency logs |
⚠️ GOTCHA — mutable references are a recurring root cause. The March 2026 LiteLLM and Telnyx compromises traced to a mutable reference in their use of the Trivy GitHub Action.
uses: some/action@v1is a moving target controlled by someone else. Pin to a full commit SHA. This single practice would have prevented multiple 2026 incidents.
package-manager-registries-and-installation).package-manager-registries-and-installation).Cooldowns / minimum release age are the highest-value new control. The idea: refuse to install a version published less than N days ago, so the ecosystem's detection machinery gets a chance first.
--uploaded-prior-to; uv has --exclude-newer;
pnpm has minimum-release-age; Dependabot has a cooldown setting. All rely on
registry-reported upload timestamps (PEP 700 in Python).The rest of the client-side baseline:
--frozen-lockfile / ci mode everywhere in CI. Never resolve in CI.npm sbom, syft) — this is what
turns "are we affected?" from a week into minutes, and is increasingly a legal
requirement (§14.3 → package-manager-ux-ecosystems-and-governance).[DURABLE] Arbitrary code execution at install time is the original sin of package
management. npm install running preinstall/postinstall, pip install executing
setup.py, gem install running extconf.rb — in every case, fetching a dependency
executes attacker-controlled code with the developer's full privileges.
Every major worm in §8.1 used this. Shai-Hulud's move from postinstall to preinstall
was specifically to execute before installation completed, widening the blast radius.
It exists because native code needs compiling and platforms differ. The escapes, in order of how well they worked:
manylinux/musllinux/macosx platform tag scheme made prebuilt binaries portable.
This single change removed install-time execution from the overwhelming majority of
Python installs — and it's why sdists (which do run setup.py) are now the risky path.pyproject.toml's [build-system] replaced executable
setup.py configuration with data. Cargo's Cargo.toml was declarative from birth
(with build.rs as a deliberate, visible exception).onlyBuiltDependencies is the pragmatic
modern answer: scripts don't run unless you name the package. npm has --ignore-scripts.
Bun and Yarn have equivalents.[DURABLE] If you are designing a package manager today: do not run install-time scripts
by default. Provide an explicit, per-package allowlist that lives in the manifest and is
reviewable in a diff. The compatibility cost is real (native modules — node-gyp builds,
sharp's prebuilt binaries, Prisma's engine downloads — all use postinstall) and it is
worth paying.
PATH, no ambient config, no $HOME dotfiles.If you ship prebuilt artifacts, you need a platform tag scheme answering: OS, libc
(glibc version! musl!), CPU architecture, and language/ABI version. Python's
manylinux_2_28_x86_64 encodes a glibc floor; that design is worth copying because it
expresses forward compatibility rather than distro identity.
Also decide: what happens when there's no matching binary? Fall back to source (and thus to executing a build), or fail? Both answers are defensible; silently falling back to source build is how "it worked on my machine and took 40 minutes in CI" happens.
Multiple packages in one repository, resolved together, with local packages satisfying each other's dependencies instead of the registry.
Requirements that make a workspace implementation good:
workspace:* always resolves to the local
package — making it impossible to accidentally test against the published version when you
meant local. That is the correct default and worth copying.[workspace.dependencies],
Maven's dependencyManagement. Without this, upgrading a dependency across 50 packages is
50 edits.--filter, run in dependency order.Path, git (with a pinned commit, never a branch), URL, and vendored dependencies. Each needs a lockfile representation that preserves reproducibility — a git dependency locked to a branch name is not locked.
overrides (npm, pnpm), resolutions (Yarn), [patch] (Cargo), replace (Go).
[DURABLE] You need this escape hatch — a transitive dependency has a CVE and the
intermediate package hasn't updated. Design it explicitly rather than letting people
hand-edit lockfiles.
But make it loud: overrides silently violate a dependency's declared constraints, which means you own the compatibility risk. Print them on install. Make them expire or require periodic re-confirmation if you can.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/package-manager-referenceUse when reviewing a package manager or registry design for known anti-patterns, weighing contested questions (MVS vs constraint solving, multiple versions coexisting, hoisted vs isolated vs PnP, lockfiles for libraries, one standard lockfile format, whether SemVer is worth it, package manager as build tool, cooldowns vs patch latency, vendoring), checking whether an ecosystem or tooling claim is still current (snapshot verified August 2026), finding the foundational writing and primary sources, or needing the build-it-in-order checklist, diagnostic first moves, and numbers. Companion to the other package-manager-development skills./package-manager-registries-and-installationUse when building or operating a package registry or the install side of a client. Covers the registry API surface, immutability as the single most important property, mutable-release poisoning, namespacing and name allocation, the content-addressed store, the layout problem's four answers (flat, nested, isolated, PnP), multiple versions coexisting, runtime resolution as part of the design, and publishing and authentication — the evolution from API tokens to trusted publishing with OIDC, provenance and attestations, Sigstore, and SLSA./package-manager-ux-ecosystems-and-governanceUse when making a package manager fast and usable, comparing ecosystems, or running one as infrastructure. Covers performance (parallel fetching, caching, lockfile fast paths), CLI UX and error messages as the product, the cross-ecosystem comparison of npm/pnpm/yarn, pip/uv, Cargo, Go modules, Maven, NuGet, apt/dnf, and Nix, and governance and sustainability — the registry as critical infrastructure, the policies you will need (deprecation, yanking, name disputes, takedowns), and the regulation that now reaches package managers./package-manager-versioning-and-resolutionUse when designing or debugging the core of a package manager: the anatomy every package manager shares (the router for the whole package-manager-development reference), semantic versioning and what it really promises, the version-scheme decision and constraint syntax, what belongs in a manifest vs a lockfile, dependency resolution stated formally (NP-complete), the algorithm families, PubGrub and why it won, MVS as the radical simplification, escape hatches when there is no solution, making resolution fast, and lockfile design — what it must contain, the properties that matter, whether libraries should commit lockfiles, and the Python standardization story.npx claudepluginhub the-vibey-project/vibey --plugin package-manager-development