Hand-Carried Dependency
A hand-carried dependency is a private package that a build receives as a single sealed file placed beside the project, instead of fetching it from a server, so that the build reaches nothing and holds no key for it.
The file is a packed release, such as a tarball, copied into a folder that version control ignores. The project names it by path and pins it by its content hash. Whatever builds or installs the project, a container build or a deploy server, finds the file already there. It never learns where the package came from.
It resembles vendoring, except that nothing is committed: the dependency travels with the working tree but never enters the project's history.
Why carry it
The usual ways to reach a private package give the builder more than the package. Cloning from a private git host over a forwarded SSH agent lends the builder keys that open far more than one repository. A private registry needs a token, a server to run, and often a public port and a certificate. Each turns "install this one package" into "be able to reach this place".
Carrying the file inverts the direction. The builder doesn't reach out; it finds exactly what it needs already in place. Someone has to do the carrying, but that cost lands on the side that already has access, not on the builder.
What it is
- Placed, not fetched. The file is already there; the builder never asks for it.
- Sealed. One release is packed once, and every project gets a copy of the same file, so the hash in each lockfile matches.
- Out of history. Only the name and the hash are committed. The package's contents stay in its own repository.
- Per dependency. A build can carry one private package while still fetching public ones as usual.
What it isn't
- Not vendoring. Vendored code is committed and becomes part of the project's history.
- Not a registry. There is no server, no token and nothing to operate.
- Not a shared workspace. The projects don't share source. They share a packed artifact.
- Not a local shortcut. A
file:path to a sibling checkout points at live source that keeps changing. A carried file is a fixed release. - Not a hermetic build. Only the carried dependency is closed off; the rest of the build may still fetch.
- Not removing access. Whoever fills the folder still needs to reach the package. The access moves to the side that already has it, away from the builder.
- Not trust. Carrying limits what the builder can reach. It says nothing about whether the package itself is safe.
Tests
- No fetch: does the build make no request for this package?
- No credential: does the builder hold no key or token for it?
- Sealed: is it pinned by content, and is every copy the same file from one pack?
- Uncommitted: does it stay out of the project's history?
Examples
| Case | Verdict | Why |
|---|---|---|
A packed release copied into an ignored vendor/ folder, named by path, copied into the container before install |
Yes | Passes all four. |
| The same, while the build also fetches public packages from the public registry | Yes | Hand-carrying is per dependency. |
| The tarball committed to the repository, as in an offline mirror | No | It is vendoring. Test 4 fails. |
| The build clones the package from a private git host through a forwarded SSH agent | No | It fetches, and it borrows keys. Tests 1 and 2 fail. |
| The build pulls from a private registry with a read-only token | No | It fetches with a credential, however narrow. Tests 1 and 2 fail. |
| Each project packs the release again for itself | No | The copies differ, and so may their hashes. Test 3 fails. |
A file: path to a sibling checkout of the package's source |
No | Live source, not a sealed release. Test 3 fails. |
Trade-offs
- A fresh clone is empty. The ignored folder isn't in the repository, so a new clone, a worktree or a CI run needs a step that fills it before install.
- The source file needs a home. If the only copy of a release is lost, it has to be packed again from its tag, and the hash may change, so every lockfile has to follow.
- No update tooling. Automated dependency updaters don't follow file paths, so new releases have to be noticed by hand.
- It suits a small set of private packages. As they multiply, keeping a copy and a fill step for each grows heavier, and a registry starts to pay for itself.
Raising a version costs about the same as with a registry or a git dependency: change the name, install again. Only the copy is added.
Related concepts
- Principle of least privilege (Saltzer and Schroeder). The closest relative. A hand-carried dependency applies it to one handover: the builder gets the package and nothing that reaches beyond it.
- Vendoring (common practice; e.g. Go's
vendor/). The key contrast: also keeps the dependency beside the project, but commits it. - Offline mirror (Yarn). The nearest precedent: package tarballs kept in the repository so installs need no network. It is committed, where a carried file is not.
- Hermetic builds (Bazel). The wider goal of building only from declared inputs, of which this is a narrow, single-dependency case.
No errand, no key.