Skip to content
BETAGuardrails are in beta. The library, the configuration format and the CLI command can still change.

Guardrails / supply-chain

The bill of materials names a licence for what it lists

supply-chain/components-licensed@v1

Enough of the components the bill of materials lists name a licence that the inventory can answer what the artifact may be distributed under.

Idsupply-chain/components-licensed
Versionv1
Categorysupply-chain
Default severitywarning
Interpreterpython3
Timeout30 seconds
Violations tolerated0
Collectssbom

Collectors

This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.

CollectorGathersInputs it is given
sbomThe components a build says it ships, read from the bill of materials it already wrote, whether that is CycloneDX or SPDX, JSON, XML or tag-value, normalized into one list carrying the licence each component names.none

The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.

Configuration

json
{
  "guardrails": {
      "failOn": "error",
      "comment": true,
      "checks": [
          {
              "use": "supply-chain/components-licensed@v1",
              "severity": "warning",
              "with": {
                  "minPercent": "95"
              },
              "exemptions": []
          }
      ]
  }
}

Inputs

InputDescriptionDefaultEnvironment variable
minPercentShare of components that must name at least one licence, as a percentage.95GUARDRAIL_INPUT_MINPERCENT

How to fix

Generate the bill of materials from the resolved dependency graph rather than from the manifest, so the generator has the metadata to read a licence from:

bash
syft dir:. -o cyclonedx-json=bom.json

A component with no licence is not an unlicensed component: it is one nobody looked up. The distinction matters the first time somebody asks whether this artifact can ship to a customer, because the answer has to be given for every line and "unknown" is not one of the acceptable answers.

More in supply-chain

All 6 supply-chain guardrails

Buildnote Limited
Registered in England and Wales, Reg: 16140412