The Drift Log · Provenance, licensing and the paper trail
Extracting Licensing Invariants from Vendored Dependencies
13 November 2026 · 4 min read · 770 words · established

Resolve vendored code provenance by combining static AST invocation analysis with explicit license invariants in your CI pipeline.
A developer copies a forty-line utility function from an open-source repository into src/vendor/string_utils.ts. Three years and four refactors later, nobody knows where it came from. The file has no header. The commit message simply reads add helpers.
When you bypass a package manager, you strip out the metadata layer that tools rely on to establish software provenance. You drop the semantic version, the upstream repository URL, and the explicit license declaration. The code compiles, tests pass, and your CI pipeline turns green. But downstream, in production, you have introduced an untracked legal invariant into your dependency tree.
If that utility originated in an MPL-2.0 or copyleft codebase, your deployment carries obligations you are not fulfilling. Storing vendored code directly in your tree is not an engineering shortcut; it is an unverified assertion about license compliance that breaks the moment your build outputs an artifact.
The Limits of File-Level Scraping
Standard software bill of materials (SBOM) generators inspect manifest files like package.json, go.mod, or Cargo.lock. They resolve the lockfile graph and report what the manifests declare.
When code is checked directly into the source tree, manifest-driven scanners see nothing. A naive remediation is to point a regular expression at file headers inside the vendor directory, looking for standard copyright notices or SPDX tags. This fails in two directions:
- Header evaporation: Developers frequently strip headers when trimming upstream files down to the single function they need.
- Dead paths in living folders: A vendored directory might contain an entire upstream library, but your application only imports a standalone pure utility. Treating the entire directory as a monolithic dependency can flag phantom licensing conflicts for code that is never compiled into your release binary.
Resolving vendored code requires binding two distinct signals: explicit license discovery at the source level, and Abstract Syntax Tree (AST) invocation paths at the compiler level.
// AST resolution: Mapping actual consumer import edges to vendored modules
import { Project, SyntaxKind } from "ts-morph";
const project = new Project({ tsConfigFilePath: "./tsconfig.json" });
const vendorFiles = project.getSourceFiles("src/vendor/**/*.ts");
for (const file of vendorFiles) {
const referencingNodes = file.getReferencingNodesInOtherFiles();
const activeCallSites = referencingNodes.filter(node =>
node.getParentIfKind(SyntaxKind.ImportDeclaration)
);
console.log(`${file.getBaseName()}: imported by ${activeCallSites.length} source modules`);
}
A license applies to the artifact you distribute. If an AST traversal proves that a file in /vendor is never imported, linked, or bundled into your final target, its obligations do not attach to that specific compilation output. If it is imported, you must trace the exact terms attached to that module.
Extracting the Invariant
To turn an opaque directory into an actionable record for an SBOM, you need to formalize the extracted terms into deterministic invariants.
An invariant is a machine-readable rule that your CI pipeline can evaluate on every commit:
- Origin: The cryptographic hash of the file as ingested, matched against upstream registries or canonical repositories.
- SPDX License Identifier: The resolved license expression (for instance,
Apache-2.0 OR MIT). - Invocation Scope: The exact compilation targets that consume symbols exported by this file (e.g.,
client-bundle,server-runtime, ortest-only). - Modification State: A diff against the upstream file to capture whether internal alterations trigger source-redistribution clauses.
When you link your AST call graph to these metadata points, you no longer guess whether your application complies with transitive terms. You have an explicit ledger showing which vendored files reach production bundles, what terms govern them, and where the boundaries lie.
Enforcing Provenance Before Code Lands
Every write an agent or automated pipeline performs inside SHPBL must pass a Build Intent gate first. The proposal is registered, and invariants—including software provenance and licensing terms—are resolved directly in code before returning a terminal state.
Our corpus is model-independent: no AI model runs inside the software, and no runtime behavior depends on model output. Access is unified across four doors—the TypeScript SDK, an HTTP API, an MCP server, and an offline edition running from local files. You can run a free repository evaluation to inspect how your dependencies and existing code pass through the pipeline.
The Monday Morning Audit
Do not wait for a compliance audit to catalog what lives in your source tree. You can establish baseline visibility in an afternoon:
- Find unmanaged modules: Scan your repository for directories containing third-party code that lack package manifests (
vendor/,third_party/,lib/ext/). - Extract symbols and cross-reference: Write a script using your compiler's API to list all import specifiers targeting those paths. Any vendored file with zero incoming edges should be deleted immediately.
- Declare terms in code: For every active vendored file, place an adjacent
.provenance.jsonsidecar capturing its upstream source URL, exact commit hash, and SPDX license expression.
If a file cannot be traced back to an upstream repository and a verified license, quarantine it until the origin is established. An unknown license is not public domain; it is a proprietary liability waiting to be discovered.
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.