dependency-confusion
Skill0 starsChanged 3 months agoMITView on GitHub
This skill should be used when the user asks "how do I secure our package supply chain", "what is dependency confusion", "how do I stop typosquatting", "is this package safe to install", "should I pin dependency hashes", or is configuring a private registry, lockfile policy, or CI credentials for package installs.
- Installs packages
5 other projects use a version of this.
Adopted by
Most recently taken up by
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- Kur1sulab/blackboxtheir own version, first seen Aug 12, 2026
- langbyyi/websec-skillstheir own version, first seen Jun 12, 2026
- JustineDevs/premortemtheir own version, first seen Jun 9, 2026
- yaklang/hack-skillstheir own version, first seen Apr 29, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- yaklang/hack-skills★ 2.4ksame name
- langbyyi/websec-skills★ 4same name
- Kur1sulab/blackbox★ 3same name
- JustineDevs/premortem★ 2same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- algorithmic-complexity-attacksSkill
- cache-stampedeSkill
- clocks-and-timeSkill
- code-hotspotsSkill
- connascenceSkill
- connection-poolingSkill
- consistent-hashingSkill
- coordinated-omissionSkill
- cyclomatic-complexitySkill
- database-queuesSkill
- expand-contractSkill
- floating-pointSkill
- hyrums-lawSkill
- index-designSkill
- isolation-anomaliesSkill
- keyset-paginationSkill
- metamorphic-testingSkill
- module-depthSkill
- mutation-testingSkill
- mvcc-and-bloatSkill
- parse-dont-validateSkill
- query-plansSkill
- queueing-and-utilizationSkill
- retry-amplificationSkill
- start-hereSkill
- tail-latencySkill
- unicode-pitfallsSkill
- universal-scalability-lawSkill
- write-amplificationSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Verify a new dependency by checking:
- Distinctive: line 87
Do install scripts run, and does that step hold credentials or network access?
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Supply chain: dependency confusion and friends
Dependency confusion
Disclosed by Alex Birsan in 2021, and it worked against Apple, Microsoft, PayPal, Tesla, and Shopify simultaneously.
Most package managers configured with both a private registry and the public one resolve a name by asking both and taking the highest version. An attacker publishes your-internal-package-name publicly at version 99.0.0, and every build resolving that name installs the attacker's code. No misconfiguration is required beyond the default resolution order.
Internal names are not secret. They leak through published manifests, source maps, Docker layers, CI logs, job postings, and code search.
Fixes by ecosystem
| Ecosystem | Control |
| npm | Scope everything as @yourorg/pkg and claim the scope publicly, then map the scope to the private registry in .npmrc. Strongest fix, since a scope is a namespace nobody else can publish under |
| npm, alternative | One upstream that proxies public packages, never two registries able to answer for the same name |
| Python | Never use --extra-index-url, which is exactly the ambiguous-resolution setting. Use --index-url against one proxying repository. Pip has no scoping |
| Go | GOPRIVATE and GONOSUMDB for internal prefixes. Module paths are already domain-scoped |
| Maven | Configure the private repo as a mirror of everything, not an additional repository |
| Ruby | Per-gem source blocks in the Gemfile |
The general rule: one resolution source. Any configuration where two registries can answer for one name is exploitable, because the tiebreak is version-based, not source-based.
Defensively registering internal names publicly is a stopgap. It does not scale and fails for every name added later.
Typosquatting and slopsquatting
Typosquatting: reqeusts, crossenv versus cross-env. Install scripts then run arbitrary code.
Slopsquatting is the newer variant: language models hallucinate plausible package names, and attackers register the frequently hallucinated ones. Any package name suggested by a model or by autocomplete requires verification before entering a manifest.
Verify a new dependency by checking:
- The repository link resolves and matches the package name.
- Download counts and publication history. Twenty downloads and one version published last week warrants scrutiny.
- The maintainer list against the project's actual maintainers.
- Whether install scripts exist (
preinstall,postinstall, code executing insetup.py). - Whether the package is even needed, since a small dependency is often worse than ten lines of code.
Lockfiles and pinning
- Commit the lockfile. Without it, resolution is a function of when the build ran.
- Install with the lockfile-respecting command:
npm cirather thannpm install,uv syncorpip-syncrather thanpip install -r. Regular install commands silently update the lockfile. - Pin with hashes where supported:
pip install --require-hashes, npm integrity fields, Go'sgo.sum. A version identifies a name, a hash identifies content, and only the hash survives a compromised registry or a republished version. - Review lockfile diffs. An unexpected transitive change in a PR that touched no dependencies is worth reading.
Other vectors
| Vector | Defense |
| Maintainer account takeover | Hash pinning, delayed adoption (skip versions published in the last 24 to 48 hours), advisory monitoring |
| Malicious install scripts | --ignore-scripts by default, build in a sandbox with no network and no credentials |
| CI credential theft | Never expose publish tokens or cloud credentials to a step running third-party code. Separate install from deploy |
| Compromised build system | Reproducible builds and provenance attestation (SLSA, npm provenance, Sigstore) |
| Package deletion or protestware | Vendor critical dependencies, or run an internal proxy caching every version fetched |
| Git dependency on a mutable ref | Pin to a commit SHA, never a branch or tag, since tags can be moved |
Configuration
npm config set ignore-scripts true# .npmrc scoped to the private registry only
@yourorg:registry=https://registry.internal.example.com
//registry.internal.example.com/:_authToken=${NPM_TOKEN}# Python: one index, hashes required
--index-url https://pypi.internal.example.com/simple
--require-hashesAudit checklist
- Can any internal package name resolve from a public registry? This is the dependency confusion test and the answer must be no.
- Are internal npm packages scoped, with the scope claimed publicly?
- Does
--extra-index-urlappear anywhere in Python config or Dockerfiles? - Does CI install with a lockfile-respecting command?
- Do install scripts run, and does that step hold credentials or network access?
- Are git dependencies pinned to commit SHAs?
- Are hashes required, or only version numbers?
Item 1 is the one to check immediately. It has a definite answer, and a "yes" is a live vulnerability rather than a theoretical one.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

