The Drift Log · Provenance, licensing and the paper trail
Reconstructing License Headers from Stripped Vendor Trees
18 November 2026 · 3 min read · 759 words · established

When developers strip copyright notices from vendored files, exact file hashes fail; AST sub-tree hashing recovers upstream provenance and license metadata.
A developer copies a 300-line utility from an Apache-2.0 or BSD-3-Clause repository into src/vendor/ or lib/util/. To satisfy a local linter or clean up the file, they strip the copyright block at the top. Two years and four team transitions later, that code is still in your production bundle.
It has no attribution metadata, no SPDX identifier, and no link to its upstream origin.
When building a software bill of materials (SBOM) or preparing for an audit, this unverified file is a liability. Almost all permissive and copyleft licenses mandate that redistributions retain the original copyright notice and license text. Stripping the header does not strip the legal obligation; it only removes the paper trail.
Why Exact Matching Fails on Vendored Trees
Attempting to resolve vendored code by matching file-level SHA-256 hashes against package registries breaks down immediately.
Vendored dependencies rarely remain byte-identical to their upstream sources. Developers reformat whitespace, rename internal variables to match project conventions, strip types, or inline only the two helper functions they needed. Even running a minifier or updating import paths changes the cryptographic hash of the file.
Upstream (lodash.get / canonical release):
/* @license lodash <https://lodash.com/> ... MIT License */
function baseGet(object, path) { ... }
Vendored local copy:
// Helper for nested lookups
export function baseGet(o, p) { ... }
Line diffing is equally fragile. If a file contains ten modified lines and twenty deleted lines, text-based diffing engines cannot tell whether it is a modified copy of an MIT utility or original code that happens to share idiomatic patterns.
To reconstruct software provenance, you have to compare the abstract syntax tree (AST) of the vendored file against an index of canonical upstream release trees.
Reconstructing Provenance from Syntax Trees
AST matching ignores non-semantic changes: comments, whitespace, identifier renaming, and bracket styles. The matching process works across three steps:
- Normalize the candidate AST. Parse the local uncredited file into an AST. Strip trivia nodes (comments, formatting). Replace variable and parameter identifiers with positional placeholders (alpha-renaming).
- Compute structural sub-tree hashes. Walk the normalized AST and generate hashes for individual function declarations, control structures, and class definitions.
- Query a canonical release corpus. Match the sub-tree hashes against a pre-indexed corpus of upstream package releases (such as canonical tarballs from npm, PyPI, or Crates.io).
When a sequence of structural hashes in a local file matches an upstream release at high confidence, you recover the exact upstream package name, release version, and applicable license text.
Local File (src/vendor/path.js)
-> AST Extraction & Normalization
-> Sub-tree Hash: a8f4e2... (matches nodejs/path v16.14.0:posix.normalize)
-> Upstream Origin: Node.js core (MIT)
-> Inferred License: MIT
Once identified, the build pipeline can re-inject the canonical SPDX header into the source file and append the original copyright text into the project's third-party notice manifest. As detailed in our doctrine on establishing a continuous license attribution pipeline for vendored code, verifying license compliance requires deriving facts from structural analysis rather than trusting manually maintained comments.
// SPDX-License-Identifier: MIT
// Upstream-Origin: https://github.com/nodejs/node/blob/v16.14.0/lib/path.js
// Reconstructed via structural AST match
The Boundary: Derivative Works vs. Pure Vendor Code
Syntax matching works cleanly when vendoring intact units: entire modules, helper files, or self-contained algorithms. It encounters limits when developers heavily rewrite upstream logic or interleave third-party routines inside first-party business logic.
When the structural match confidence falls below a clean threshold, automated header reconstruction must stop. Forcing a license header onto a file that has been fundamentally altered risks misidentifying obligations—such as applying an incompatible license to proprietary business logic or missing a copyleft trigger on a derivative work.
In these cases, the tooling should flag the file for manual disambiguation rather than guessing.
How SHPBL Handles Invariants
At SHPBL, software provenance and licensing invariants are computed, not left to assumption. Every capability in our master catalog is model-independent, owned outright, and checked against explicit input contracts.
When code is integrated through our TypeScript SDK or API, it passes a Build Intent gate. This gate resolves invariants, verifies structural dependencies, and locks attribution before code enters a build. Artifacts are evaluated in a test harness that returns verifiable status verdicts (CERTIFIED, PROVISIONAL, INCONCLUSIVE, or FAILED). You can test your own dependency footprint using our free repository evaluation.
What to Check on Monday
You do not need a complete AST index to start finding missing attributions in your repository:
- Scan for un-attributed files. Run a script across your repository looking for
.js,.ts,.go, or.pyfiles insidevendor/,lib/, orthird_party/directories that lack anSPDX-License-IdentifierorCopyrightcomment. - Locate exact function signatures. For flagged files, take two or three distinct exported function names and search them against public package registries or your organization's internal dependency cache.
- Add automated enforcement. Add a linter rule or CI check that rejects any commit introducing files into vendor directories without an accompanying license declaration and entry in your release SBOM.
This post supports the longer argument in Continuous License Attribution Pipeline for Vendored Code.
Keep reading
Next in the log
- Provenance-First Build Intent: Licensing Invariants Before Disk Writes
Evaluate license compatibility and origin invariants at a build intent gate before external or agent-generated code ever writes to disk.
- Continuous License Attribution Pipeline for Vendored Code
Vendored code strips package manifests and breaks standard dependency scanners. Here is how to enforce license invariants continuously in CI.
- Rejecting Ambiguous SPDX Identifiers in CI Pipelines
Informal license strings like BSD-style or slash delimiters break automated SBOM tooling. Enforce strict SPDX grammar at your CI build gate.
The Strategic Master Library · written and reviewed under the house's own epistemic rules: nothing claimed that we cannot show.