fleetlint Policy for a fleet of repositories
v0.9
Getting started

public/manifest-license/node

Package manifest declares the license

Implements public/manifest-license for node.

Severityinfo
Tiers1
Stacksnode
Scopeeach
Kindexpr
Sourcelibrary v0.6.0
Selected byfleetlint-recommended@v0.6.0

Requirement

package.json has an SPDX expression in license (not UNLICENSED), unless it is "private": true.

Why

Registries, SBOM tools and license checkers read the manifest, not the LICENSE file.

Capability applies when

repo.public

Check

!file("package.json") || (has(json("package.json").private) && json("package.json").private == true) || (has(json("package.json").license) && type(json("package.json").license) == string
    && json("package.json").license.matches(r'^\(?[A-Za-z0-9][A-Za-z0-9.+-]*( (AND|OR|WITH) \(?[A-Za-z0-9][A-Za-z0-9.+-]*\)?)*\)?$')
    && json("package.json").license != "UNLICENSED")

Fix

Add the SPDX identifier of the LICENSE file to package.json license; fleetlint fix --apply does it when the LICENSE text is one recognised license.

Agent instruction: Set the manifest’s license field to the SPDX identifier matching the LICENSE file; ask if the LICENSE text is not a recognised license.

fleetlint fix can apply this rule’s fix automatically (1 action(s)).

A finding of this rule points at package.json.

Sources


Generated by fleetlint docs from catalog v0.6.0.