Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
get-latest-version
Advanced tools
Find the latest version of an npm module matching a given semver range
Find the latest version of an npm module matching a given semver range
npm install --save get-latest-version
const getLatestVersion = require('get-latest-version')
getLatestVersion('some-module')
.then((version) => console.log(version)) // 1.0.0, or whichever is 'latest'
.catch((err) => console.error(err))
getLatestVersion('some-other-module', {range: '^1.0.0'})
.then((version) => console.log(version)) // highest version matching ^1.0.0 range
.catch((err) => console.error(err))
// Returns both the highest in the given range and the actual `latest` tag
// Note that this differens in that the return value is an object
getLatestVersion('@sanity/base', {range: '^1.0.0', includeLatest: true})
.then((versions) => console.log(versions)) // {inRange: '1.150.8', latest '2.23.0'}
.catch((err) => console.error(err))
By default, this module will read the authorization token for whichever registry the module belongs to, based on local npm configuration. To disable this and always send unauthenticated requests to the registry, provide auth: false
to the options:
getLatestVersion('some-module', {auth: false})
.then((version) => console.log(version))
.catch((err) => console.error(err))
By default, module utilizes registry-url to resolve registry URL from NPM configuration files. However, if you need to set up the registry programmatically, you can make use of the registryUrl
option:
getLatestVersion('some-module', {registryUrl: 'https://some-custom-registry.com'})
.then((version) => console.log(version))
.catch((err) => console.error(err))
git clone git@github.com:rexxars/get-latest-version.git
cd get-latest-version
npm install
npm test
MIT © Espen Hovlandsdal
FAQs
Find the latest version of an npm module matching a given semver range
The npm package get-latest-version receives a total of 85,678 weekly downloads. As such, get-latest-version popularity was classified as popular.
We found that get-latest-version demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.