The Drift Log · Provenance, licensing and the paper trail
Tracking Upstream Patch Provenance in Vendored Git Trees
28 September 2026 · 3 min read · 588 words · established

Store a cryptographic provenance file alongside each vendored source to retain a verifiable upstream commit link.
In‑tree cherry‑picks erase their source
A developer copies an upstream fix into a vendored subtree and commits it as a plain patch. Weeks later the commit message is edited, the branch is rebased, or the file is moved. The original upstream SHA‑1 disappears. When a licence audit or a security advisory asks “which upstream version introduced this line?”, the repository cannot answer. The missing link becomes a liability: you cannot prove that the code is covered by a permissive licence, nor can you locate the upstream patch that fixes a vulnerability.
Relying on ad‑hoc comments is fragile
Teams often add a comment at the top of the file:
// cherry‑picked from upstream@a1b2c3 – MIT
That line is easy to delete, to rewrite, or to forget when the file is reformatted. It does not survive a git filter‑branch, a subtree split, or a merge that resolves conflicts automatically. Moreover, the comment does not give a machine‑readable way to verify the claim, so an SBOM generator cannot include the upstream reference without custom scripting.
Store a cryptographic reference next to the vendored file
Treat the provenance record as a first‑class artifact. For each vendored file create a sibling file with the extension .prov. The file contains:
upstream-commit: a1b2c3d4e5f6g7h8i9j0
upstream-repo: https://github.com/example/libfoo
license: MIT
retrieved-at: 2024-09-20T12:34:56Z
- The
upstream-commitis the exact SHA‑1 (or SHA‑256) of the upstream commit that introduced the lines now present in the vendored file. - The
upstream-repopoints to the public repository, not a private mirror. - The
licensefield records the licence declared by the upstream project at that commit. retrieved-atis a timestamp that can be signed later if required.
Because the file lives in the same directory as the vendored source, it moves with the file during refactors, and it is versioned by Git alongside the code. A simple script can verify the integrity of the provenance record:
#!/usr/bin/env bash
set -e
file=$1
prov="${file}.prov"
commit=$(awk -F': ' '/upstream-commit/ {print $2}' "$prov")
git -C "$(dirname "$file")" cat-file -e "$commit"
If the commit no longer exists in the upstream repository, the script fails, signalling that the provenance is stale and needs re‑validation.
Hook the record into your SBOM pipeline
Most SBOM tools accept an additional JSON file per component. Convert the .prov file to the SPDX PackageVerificationCode format:
{
"SPDXID": "SPDXRef-Package-foo",
"name": "libfoo",
"downloadLocation": "git+https://github.com/example/libfoo@a1b2c3d4e5f6g7h8i9j0",
"licenseConcluded": "MIT",
"verificationCode": {
"value": "a1b2c3d4e5f6g7h8i9j0"
}
}
When the SBOM is generated, the tool picks up this JSON and records the exact upstream commit. Auditors can then trace any line back to the original source without manual digging. The approach also satisfies the “software provenance” requirement of many compliance frameworks, because the provenance data is stored, versioned, and cryptographically linked to the upstream commit.
Keep the record honest with a build‑intent gate
If your organisation already uses a build‑intent gate to resolve licences, extend the gate to reject any vendored file that lacks a matching .prov file. The gate can also verify that the licence declared in the provenance record matches the licence declared in the upstream repository at that commit. This prevents accidental licence drift when upstream licences change.
Monday’s concrete step
- Pick a single vendored library that you update regularly.
- For the most recent upstream commit you have applied, create a
<file>.provfile next to the vendored source using the format above. - Add a CI job that runs the verification script for every
.provfile in the repository. - Commit the provenance files and the CI configuration.
By the end of the week you will have a reproducible chain of custody for that library, and the same pattern can be rolled out to the rest of your vendored code. This small discipline eliminates the “paper‑trail debt” described in the pillar post /blog/vendoring-code-without-a-paper-trail-is-unsecured-debt and makes future licence compliance and security patching far less painful.
Keep reading
Next in the log
- Auditing Vendored Source Trees for Missing Attribution
Recover provenance and license terms for orphaned vendored files using Git blob hashes, Software Heritage identifiers, and commit-tree verification.
- Tracking Code Provenance When Agents Paste External Logic
When coding agents paste external logic directly into a repository, manifest-based SBOMs fail. Here is how to enforce origin tagging at ingest time.
- Verifying License Compatibility for Transitive Dependencies
Directly vendoring code severs the package graph, hiding transitive copyleft obligations. Here is how to gate imports against license term collisions.
The Strategic Master Library · written and reviewed under the house's own epistemic rules: nothing claimed that we cannot show.