Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
duplitect
is a simple tool to detect duplicate versions of installed packages. JavaScript package managers such as NPM and Yarn habitually allow you to install multiple versions of (transient) dependencies. This works most of the time - for certain kinds of packages, it does not.
untool
happens to be among these packages that have to be installed exactly once inside any given project, which is why we built this module.
Using NPM:
npm install -S duplitect
Using Yarn:
yarn add duplitect
Usually, you will want to use duplitect
as a CLI tool. Since most typical Node.js projects contain a significant number of (unproblematic) duplicates, you will probably want to limit duplitect
's output by passing one or more patterns.
$ duplitect untool @untool*
Duplicate: untool
Duplicate: @untool/core
duplitect
supports the wildcard character *
as shown above. This allows you to match multiple, possibly scoped, packages at once.
You can also use duplitect
in your own tools - it exposes two functions: one, that mimics the CLI functionality. And a second one, that additionally provides the versions of the duplicates.
getDuplicates(cwd, [pattern, pattern, ...])
const { getDuplicates } = require('duplitect');
const duplicates = getDuplicates(process.cwd(), 'untool', '@untool*');
duplicates.forEach((duplicate) => console.log(`Duplicate: ${duplicate}`));
getDuplicatesDetails(cwd, [pattern, pattern, ...])
const { getDuplicatesDetails } = require('duplitect');
getDuplicatesDetails(process.cwd(), 'untool', '@untool*').then((duplicates) =>
duplicates.forEach(({ name, version, pathName }) =>
console.log('name: %s, version: %s, pathName: %s', name, version, pathName)
)
);
FAQs
Package Duplicate Detector
We found that duplitect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.