Skip to content

C08 - Git

Purpose: The test cases for the git round trip: the transport, the pack scanner and the pre-receive check, git’s own limits behind them, and the data scope of what a session gets from the host repository.

Verifies: S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem. (the data scope of 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.), S08-05-push-limitsS08-05-push-limits: Push LimitsCleanup after a push that failed, the size cap of landing.git, and the time and memory bounds of the git gateway. (“Bounds”), 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., X26-pre-receive-checkX26-pre-receive-check: Push checks before the quarantine landsCan a pre-receive check that Wraith Box owns, never the repository, refuse a push whose objects inflate past a cap, and repeat the ref checks git only runs in update(), so a refused push leaves nothing in landing.git…, 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?

  • The environment builder of wb-hostd sets GIT_ALLOC_LIMIT=104857601 for receive-pack.

Push each of these, and see the scanner refuse it with its rule before the pack’s checksum reaches git, and so before git resolves any delta, with the memory of the git child and of wb-hostd measured (X26-pre-receive-checkX26-pre-receive-check: Push checks before the quarantine landsCan a pre-receive check that Wraith Box owns, never the repository, refuse a push whose objects inflate past a cap, and repeat the ref checks git only runs in update(), so a refused push leaves nothing in landing.git…, 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 delta whose result, source size or own data length is over the per-object cap;
  • a blob whose inflated size is over it;
  • objects whose sizes add up to more than the per-push cap;
  • REF_DELTA entries whose declared source sizes alone add up to more than the per-push cap;
  • 10,001 REF_DELTA entries against distinct small bases in export.git, refused before git reads a base;
  • a pack header that declares more objects than the count cap, with no entries after it;
  • an entry that declares a size of 1 byte, followed by empty zlib stored blocks until the pack is one byte over the 256 MiB wire-byte cap, which the scanner refuses on that cap while its memory doesn’t grow.

Under the caps, the git child’s peak memory stays near what X26-pre-receive-checkX26-pre-receive-check: Push checks before the quarantine landsCan a pre-receive check that Wraith Box owns, never the repository, refuse a push whose objects inflate past a cap, and repeat the ref checks git only runs in update(), so a refused push leaves nothing in landing.git… 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? measured, 207 MiB at a 100 MiB per-object cap.

With the scanner off and receive.unpackLimit=1, as S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem. sets it:

  • Record the wall-clock time of the slowest pushes the caps allow, against the 5 minute watchdog: 256 MiB of empty zlib stored blocks behind one entry, 256 MiB of trees under --strict, and 256 MiB of bases that --fix-thin copies in from export.git, each just under its cap. Each one must finish well inside the watchdog.
  • Start wb-hostd with a stand-in git that ignores GIT_ALLOC_LIMIT and exits with 0, one that exits with 128 and another message, and one that hangs past the 5 s timeout, and see every push refused with the reason.

The git data scope of S08-workspace-and-git

Section titled “The git data scope of S08-workspace-and-git”

Spec: 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..

Each refusal with its rule in the audit log:

  • Start a session with an untracked file that holds a token the scanner knows, and a tracked binary file changed to hold one. See the untracked file absent from the guest, the tracked file at its HEAD version, and both listed in the summary.
  • Start a session with an untracked symbolic link to a host file, and see a link in the guest whose target is the string only, with none of the file’s content.
  • Give the host repository remotes with a token in the user info, an ext:: URL, a git+ssh:// URL, an IP-literal host and a URL that doesn’t parse. See the guest get only cleaned https:// URLs, and the rest listed as withheld.
  • Start wb and wb-hostd with a stand-in git that reports a version below the minimum, and one that reports a release candidate of the minimum, and see both refused with the reason.
  • Fill landing.git until its size plus the worst case of one push is over the cap, and see the next push refused before receive-pack starts.
  • Remove a ref from the selection, start a session, and see a fetch of that ref’s tip commit by ID refused, and the ref not advertised.

Status: Draft