
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
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 27,556,756 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
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.