S08-08 - Host Git
Purpose: Which git binary runs on the host, the oldest version Wraith Box accepts, and where that is checked.
Design
Section titled “Design”Git on the host parses data the guest built (SEC03-no-host-execSEC03-no-host-exec: No host code execution via returned workNothing the agent produces executes on the host without an explicit user action; returned changes to files the host may later execute are flagged.):
receive-packandindex-packparse each push intolanding.git;wb landfetches the same objects into the user’s repository.
Wraith Box doesn’t ship git. It requires a minimum version of the host’s git instead.
Which git
Section titled “Which git”wb and wb-hostd resolve the git binary the same way, and never from
PATH:
- the
gitsetting in<config>/config.toml, when it is set; - otherwise the platform’s fixed default:
/usr/bin/giton macOS and Linux, andC:\Program Files\Git\cmd\git.exeon Windows.
A git setting that isn’t an absolute path is refused.
On macOS without the Command Line Tools, /usr/bin/git is a stub that
doesn’t run git. The version check then fails there, and its message
says to install the Command Line Tools or set git.
wb never runs a binary that wb-hostd names. It resolves its own,
compares it with the path wb-hostd reports, and refuses on a
mismatch. So a compromised wb-hostd can’t make wb run a program it
wrote (SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts.).
Minimum version
Section titled “Minimum version”The minimum is git 2.54.0, as a constant in wb and wb-hostd. That
is the oldest version the git spikes ran: Apple git 2.54.0 in
X07-git-round-tripX07-git-round-trip: Git round tripRemote helper over vsock, read-only upload-pack, restricted receive-pack into the landing repository, flagging of risky paths. and X28-git-alloc-limitX28-git-alloc-limit: git's allocation cap against delta bombsDoes GITALLOCLIMIT in receive-pack's environment make both host gits refuse each delta bomb of X26-pre-receive-check before allocating its result?.
A git security release that fixes code the round trip runs raises the
minimum, by a change to this spec. That code is upload-pack, fetch,
receive-pack and index-pack.
Where it is checked
Section titled “Where it is checked”wb-hostdchecks its git before it confines itself (S04-architectureS04-architecture: ArchitectureName the processes, the boundaries between them, and which requirement each boundary serves.). It refuses every push and every session start when the check fails.wbchecks its own resolved git inwb setup, at each session start, and before eachwb land. Every other command that resolves a project from a directory, thewb projectcommands among them, checks it too, since it runs git in that directory.wbrefuses a command that resolves a project from a directory whenwb-hostdreports a failed check of its own git, or another git binary thanwb’s.wb-hostdrefuses only the session start itself. The stricter side inwbkeeps one git for both processes.
Each check runs the absolute path as git version. It reads git version <major>.<minor>.<patch> from the start of the output. After
the patch number it accepts only:
- the end of the line;
- a space and a comment, such as
(Apple Git-157); .windows.<n>.
Anything else counts as output it can’t read, a release candidate such
as 2.54.0.rc1 included.
The check refuses on output it can’t read, a failed run, or a version below the minimum. The message names the binary, its version, and the minimum (NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it.). The decision goes to the audit log with the rule.
Kept on top
Section titled “Kept on top”These stay, whatever the version:
- the settings of
receive-pack: every object check an error, the size limit, andGIT_ALLOC_LIMIT(S08-03-pushesS08-03-pushes: PushesWhere the guest's pushes land, the settings receive-pack runs with, which refs a push may write, and the push at session end.); - the pack scanner (S08-04-push-checksS08-04-push-checks: Push ChecksThe checks that bound the memory and work of a push before git unpacks it: git's allocation limit, the pack scanner, and the pre-receive check.).
Decisions
Section titled “Decisions”Require a minimum git, don’t ship one
Section titled “Require a minimum git, don’t ship one”- Why: git is GPL-2.0, and S10-tech-stackS10-tech-stack: Technology ChoicesFix languages, libraries, packaging, and repository layout, with the reason for each choice. allows only permissive licenses.
- Decided: B41-git-data-scopeB41-git-data-scope: Which git data may reach the guest, and how far does the host trust its own git?Serve the guest from a host-side export repository holding only the session's branch, scan carried-in files, clean remote URLs, and require a minimum git version., item 4.
git receive-pack in V1
Section titled “git receive-pack in V1”A receive side written in Go, in place of git receive-pack, is an
option for a later version, not V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there..
Status: Draft