public/manifest-license/node
Package manifest declares the license
Implements public/manifest-license for node.
| Severity | info |
| Tiers | 1 |
| Stacks | node |
| Scope | each |
| Kind | expr |
| Source | library v0.6.0 |
| Selected by | fleetlint-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.publicCheck
!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
- https://spdx.org/licenses/ (spec)
- https://fleetlint.org/baseline/#public-repositories (convention)
- https://docs.npmjs.com/cli/v11/configuring-npm/package-json (spec, license)
- https://fleetlint.org/stacks/#nodejs–typescript
Generated by fleetlint docs from catalog v0.6.0.