Skip to content

The Drift Log · Provenance, licensing and the paper trail

Continuous License Attribution Pipeline for Vendored Code

17 November 2026 · 6 min read · 1320 words · established

A wax seal resting on a page of hash digests

Vendored code strips package manifests and breaks standard dependency scanners. Here is how to enforce license invariants continuously in CI.

Most repositories contain a directory nobody likes to touch. It might be called vendor/, third_party/, or buried in src/lib/. Inside sits code pulled down three years ago: an unversioned HTTP router, a modified cryptographic routine, or a utility library copy-pasted to dodge a package manager dependency.

The strategy for this code is usually optimism. A developer pastes the files, strips what looks like boilerplate to get it compiling, and leaves the rest to good intentions. We call this the folder of hope.

The folder of hope survives until legal audit, enterprise procurement, or acquisition due diligence demands an exact provenance ledger. At that moment, someone has to inspect four hundred files, cross-reference commit histories, search for original copyright notices, and verify whether a long-forgotten modification introduced a copyleft obligation.

Finding licensing problems during an audit is expensive. Finding them after an artifact has shipped to client infrastructure is catastrophic. License attribution for vendored code cannot be an annual forensic exercise; it must be a continuous, automated property of your CI pipeline.

Why Package Managers Fail at Vendoring

Modern package managers have trained engineering teams to believe license compliance is a solved problem. If you run npm audit or inspect a Cargo.lock file, you get a clean list of top-level dependencies and their declared SPDX identifiers.

Vendored code breaks this assumption entirely.

When code is vendored directly into a repository tree, package metadata disappears. Package manifests (package.json, Cargo.toml, .gemspec) are frequently omitted. File headers get truncated during refactoring. Multiple distinct libraries might be merged into a single internal helper directory. Upstream patches get applied inline without updating the originating repository URL or the corresponding attribution notice.

repo/
├── src/
│   ├── auth/
│   └── vendor/
│       ├── curve25519/        <-- Stripped LICENSE file; Apache-2.0 or BSD?
│       ├── fast-json/         <-- Modified upstream; MIT, but missing copyright banner
│       └── trie-matcher.c     <-- Pasted from an AGPL-3.0 gist in 2021

Once third-party source files live directly in your source tree, your build system treats them as first-party code. If an engineer accidentally imports a file containing a copyleft requirement into a proprietary binary, standard dependency scanners will not alert you. The code has no package wrapper to inspect.

To govern vendored code, you need a provenance pipeline that acts on the filesystem level, parses licensing invariants on every commit, and emits machine-verifiable software bills of materials (SBOMs).

Invariant Verification Beats Scheduled Audits

Scheduled compliance audits fail because they decouple license verification from the authoring process. Code lands on main every day; audits happen once a quarter. In the intervening ninety days, dozens of architectural decisions build upon the introduced dependencies.

A continuous license attribution pipeline treats licensing rules as software invariants. Just as a type checker prevents passing an integer to a string parameter, a license verification gate prevents merging code whose provenance violates predefined invariants.

Commit -> Hash & Parse -> Invariant Validation -> SPDX Generation -> Verification Pass/Fail

To build a continuous pipeline, you need three discrete stages:

  1. Extraction and Identity Hashing: Every vendored file must be hashed (SHA-256) and scanned for license identifiers, copyright notices, and author signatures. If a file lacks explicit headers, the pipeline matches the content against known open-source signatures.
  2. Policy Invariant Validation: The pipeline evaluates discovered licenses against an organisational policy matrix. For example: permissive licenses (MIT, Apache-2.0, BSD-3-Clause) are permitted with mandatory attribution generation; copyleft licenses (GPL, AGPL) are blocked; and ambiguous files fail the build immediately.
  3. Artifact Generation: On every merge, the pipeline compiles a verified SPDX SBOM and generates a rendered ATTRIBUTION.md or embedded license ledger.

By integrating this process directly into your pull-request validation, attribution debt never accumulates. The developer who introduces the foreign code is the developer responsible for establishing its provenance before the branch can merge.

Resolving Edge Cases: Stripping, Headers, and Dual Licenses

A basic script that greps for the word "Copyright" will not survive real-world codebases. Vendored code presents distinct edge cases that require concrete programmatic handling.

Stripped Headers and Modified Sources

When engineers vendor source files, they frequently modify them to remove unused routines or conform to internal style guides. A strict hash check against upstream repositories will fail because the file has drifted.

Your pipeline must extract licensing invariants from vendored dependencies separately from the file's implementation body. The pipeline needs to record:

  • The base upstream commit hash and origin URL.
  • The precise license text extracted from the original source.
  • A cryptographic diff of all internal modifications applied on top of that base.

If a refactor subsequently strips the embedded license comment, the pipeline flags the missing invariant because the commit history shows a tracked vendored file losing its required notice.

Transitive Vendoring

Third-party code often vendors other third-party code. An engineer may vendor a utility library without realising that its subfolder internal/compat/ contains an embedded, differently-licensed string library.

A pipeline that only inspects root directory LICENSE files will misattribute the nested files. The provenance pipeline must parse files recursively on a per-file basis, tracking license boundaries across directories rather than assuming directory-wide uniformity.

Inconclusive States

Heuristics often fail. A file might contain conflicting statements, such as an MIT notice followed by a proprietary reservation of rights.

Naive scanners often guess or silently default to the most permissive license found. A robust pipeline must treat ambiguity as an explicit state: INCONCLUSIVE.

[PASS] src/vendor/lz4/lz4.c (BSD-2-Clause, Copyright 2011 Yann Collet)
[PASS] src/vendor/xxhash/xxhash.h (BSD-2-Clause, Copyright 2012 Yann Collet)
[FAIL] src/vendor/crypto/poly1305.c
       Error: INCONCLUSIVE licensing metadata. 
       Found conflicting dual-license markers without resolution expression.
       Build halted by Build Intent Gate.

When the pipeline encounters an inconclusive state, it must reject the commit. A human must supply an explicit resolution rule, recording the conclusion and the rationale directly into the repository's attribution metadata manifest.

The SPDX Pipeline Architecture

To standardise the output, your pipeline should produce SPDX 2.3 or SPDX 3.0 documents natively. SPDX provides a standard schema for expressing the relationship between files, their origin, their declared licenses, and their concluded licenses.

A minimal configuration tracks vendored trees via a structured manifest (e.g., vendor-manifest.json):

{
  "packages": [
    {
      "name": "embedded-tls-helper",
      "path": "src/vendor/tls-helper",
      "upstream": "https://github.com/example/tls-helper",
      "commit": "8f3b2c1e4d5a",
      "declaredLicense": "Apache-2.0",
      "files": [
        {
          "path": "tls_helper.c",
          "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
          "concludedLicense": "Apache-2.0"
        }
      ]
    }
  ]
}

In CI, the pipeline performs three steps:

  1. Validates that every file inside src/vendor/ is accounted for in vendor-manifest.json.
  2. Recalculates all file hashes to detect silent modifications or drift.
  3. Renders the complete, machine-readable SPDX document and updates the bundled attribution bundle.

By checking the rendered SPDX artifact directly into the release package, your distribution artifacts carry byte-for-byte verifiable licensing records.

How SHPBL Enforces Provenance

At SHPBL, we treat license attribution and code provenance as foundational properties of the build. Software in our library is computed and validated through a model-independent pipeline; we maintain strict byte-for-byte reproducibility sealed by published archive checksums.

Every write operation executed against a codebase passes through a Build Intent gate first. The proposal is registered, and licensing invariants are resolved explicitly in code before an artifact can transition to a terminal state. Our certification harness exercises artifacts and records explicit verdicts—CERTIFIED, PROVISIONAL, INCONCLUSIVE, or FAILED—ensuring that unverified or ambiguous licensing can never slip into production software.

You can evaluate your existing repository’s provenance posture using our free repository evaluation, or inspect how our verification gauntlet runs live at the certification harness.

What to Do on Monday Morning

Do not try to build a full automated legal engine in a single sprint. Instead, replace the folder of hope with an initial gate that halts the accumulation of unmanaged code:

  1. Inventory the unmanaged directories: Run a recursive search across your repository for files containing vendor, third_party, external, or standalone .c, .go, or .ts files that lack package manifest ancestry.
  2. Establish a hard manifest: Create a basic vendor-manifest.json that indexes these directories and lists their SHA-256 hashes, upstream sources, and declared licenses.
  3. Add a CI assertion: Add a basic script to your CI pipeline that fails the build if any new file is added to those directories without an entry in the manifest.
  4. Automate attribution generation: Use an open-source SPDX generator or an offline provenance tool to emit an attribution ledger automatically from the manifest whenever your build produces a release artifact.

Once the invariant is established in CI, you no longer rely on memory or optimism. Every line of foreign code entering your repository comes with a verified origin, a recorded license, and an automated audit trail.

Keep reading

Next in the log

The Strategic Master Library · written and reviewed under the house's own epistemic rules: nothing claimed that we cannot show.