Skip to the content.

License compliance scanning & enforcement

The proxy can evaluate the license of every artifact it serves and block, warn on, or flag pulls whose license violates an operator-defined policy. It reuses the CycloneDX SBOM the vulnerability subsystem already generates (Task 15), so no second pass over the artifact is required, and it runs fully offline — the SPDX catalog and the policy are local, which suits air-gapped deployments.

It answers three supply-chain questions:

  1. Is this license allowed here? — e.g. a proprietary product must not pull GPL/AGPL-licensed code.
  2. Do we know the license at all? — an unknown / NOASSERTION license is a gap that should be reviewed, not silently accepted.
  3. Did the license change? — a package that was MIT yesterday and GPL today (license drift) is a high-signal indicator of a relicensing, a hijacked release, or an upstream you should re-evaluate.

How it works

pull → cache → vuln gate (SBOM) → license gate → serve
                     │                  │
                     └── reused SBOM ───┘
  1. The artifact is cached and its SBOM generated by the vulnerability gate.
  2. The license gate reads each component’s declared SPDX license from the SBOM (extracted from the npm package.json license/licenses field, the NuGet .nuspec <license type="expression">, or the Python wheel/sdist License-Expression / trove classifiers / License metadata).
  3. Each license expression is parsed (supporting AND, OR, WITH, the + or-later suffix, and parentheses) and evaluated against the effective policy for the request’s tenant.
  4. The worst per-component outcome drives an admission action.

When vulnerability scanning is disabled, the license gate extracts the SBOM on demand from the cached content, so it works standalone.

Policy

license:
  enabled: true
  action: block             # when a license is DENIED: warn | block | quarantine
  reviewAction: warn        # for REVIEW / UNKNOWN licenses
  driftAction: warn         # when license drift is detected
  unknown: review           # disposition for unrecognized / NOASSERTION: allow | review | deny
  default: allow            # disposition for a recognized license matching no list
  allow:  [MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, Zlib]
  deny:   ["@strong-copyleft", "@network-copyleft"]
  review: [MPL-2.0, "LGPL-*", EPL-2.0]
  allowExceptions: [Classpath-exception-2.0]
  driftDetection: true
  tenants:
    proprietary:
      deny: ["@copyleft"]   # this tenant rejects ALL copyleft

List entries

Every allow / deny / review entry may be:

Form Example Matches
Exact SPDX id (case-insensitive) MIT MIT
Glob GPL-* GPL-2.0-only, GPL-3.0-or-later, …
@family keyword @strong-copyleft every license in that family

Family keywords: @permissive, @weak-copyleft, @strong-copyleft, @network-copyleft, @copyleft (the union of the three copyleft families), @public-domain, @proprietary, @unknown.

Precedence: when an id matches more than one list, deny wins over review, which wins over allow. This lets a tenant deny a subset of an otherwise-allowed family.

Compound expressions (AND / OR / WITH)

Dispositions & actions

Outcome When Default action
allowed matches allow, or recognized & default: allow serve
unknown unrecognized id / NOASSERTION reviewAction (warn)
review matches review reviewAction (warn)
denied matches deny action (block)

A block/quarantine returns an actionable 403 with the offending license and the per-component findings; a quarantine additionally evicts the artifact from the cache. A warn serves the artifact and sets X-License-Decision: warn (plus X-License-Code / X-License-Reason) response headers.

Per-tenant overrides

tenants.<team> overrides the base policy for requests from an authenticated principal in that team:

This expresses “deny the GPL family only for proprietary tenants” without restating the whole policy.

License drift

With driftDetection: true, the proxy records the license observed for each package version it serves. When a later version of the same package declares a different license, it emits a drift signal: the decision is escalated to at least driftAction (warn by default), an alert fires, and the event is listed in the admin API. Drift is reported only when both the prior and new licenses are known (a transition to/from an undeclared license is treated as an extraction gap, not relicensing). State is in-memory, so it requires no external store.

Observability

Metrics (Prometheus):

Metric Meaning
pullthrough_license_evaluated_total artifacts evaluated
pullthrough_license_allowed_total artifacts allowed
pullthrough_license_denied_total artifacts blocked / quarantined
pullthrough_license_flagged_total artifacts warned (review / unknown)
pullthrough_license_unknown_total component licenses that were unknown / NOASSERTION
pullthrough_license_drift_total license-drift events detected
pullthrough_license_denied_by_license_total{license} denials by offending SPDX license

Notifications: a license event is emitted on every warn/block/quarantine/drift decision and routed through the notification subsystem.

Admin API: GET {adminPrefix}/api/licenses returns the effective policy, the cumulative metrics, the recent non-allow decisions, and the detected drift events.

Offline / air-gapped

The gate performs no network access: SPDX classification and policy evaluation are entirely local. It is enabled unchanged in sealed/air-gapped deployments.