CTL-023 · human
Claim Internal Package Names
Reserve internal package names on public registries and force builds to resolve them only from the internal registry.
TechnicalEffort LowEffectiveness High
Dependency confusion relies on build tools looking at public registries for internal names. Using a scope or namespace the company owns, placeholder packages for unscoped names, and a registry proxy that never falls through to public for internal names removes the trick.
Review new package names in code review so the naming rule is followed from the start. Watch for internal names that appear in public issues or docs, since that makes them easier to target.
Put it in place
- 01Move internal npm packages to an organization scope you own, such as `@corp/`.
- 02Register placeholder packages for any internal names that cannot move.
- 03Configure the registry proxy so internal names resolve only from the internal repository.
- 04Commit lockfiles and fail builds that resolve from unexpected registries.