Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
spdx-correct
Advanced tools
The spdx-correct npm package is used to correct invalid SPDX license identifiers to valid ones. SPDX (Software Package Data Exchange) is a standard format for communicating the licensing information of software packages. The spdx-correct package takes a possibly incorrect SPDX expression and returns a corrected version that is valid according to the SPDX specification, if possible.
Correcting invalid SPDX license identifiers
This feature takes an invalid SPDX license identifier, such as 'Apache 2.0', and corrects it to a valid identifier, 'Apache-2.0'.
"use strict";
const spdxCorrect = require('spdx-correct');
const corrected = spdxCorrect('Apache 2.0');
console.log(corrected); // 'Apache-2.0'
This package parses valid SPDX license expressions, ensuring they conform to the SPDX specification. Unlike spdx-correct, it does not correct invalid expressions but rather parses and validates the structure of valid SPDX expressions.
This package provides a list of SPDX license identifiers. It can be used to validate if a given license identifier is a valid SPDX identifier. It does not correct invalid identifiers but can be used to check validity against the list of known identifiers.
This package checks if a given license string is a valid npm package license string, which can be an SPDX license expression. It is similar to spdx-correct in that it deals with license validation, but it does not correct invalid identifiers.
var correct = require('spdx-correct')
var assert = require('assert')
assert.strictEqual(correct('mit'), 'MIT')
assert.strictEqual(correct('Apache 2'), 'Apache-2.0')
assert(correct('No idea what license') === null)
// disable upgrade option
assert(correct('GPL-3.0'), 'GPL-3.0-or-later')
assert(correct('GPL-3.0', { upgrade: false }), 'GPL-3.0')
spdx-correct has benefited from the work of several contributors. See the GitHub repository for more information.
FAQs
correct invalid SPDX expressions
The npm package spdx-correct receives a total of 19,674,308 weekly downloads. As such, spdx-correct popularity was classified as popular.
We found that spdx-correct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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 uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.