Can git itself refuse a push that asks for too much memory, so the pack scanner gets simpler?
Answered 2026-10-06. Decided 2026-10-16: as recommended, with the wire-byte and per-push caps and receive.maxInputSize lowered from 1 GiB to 256 MiB. The decision is in the I102I102 (closed): X28-git-alloc-limit: git's allocation cap against delta bombsX26-pre-receive-check (#74) found that a small pack makes receive-pack allocate a delta's declared result before any hook runs (2 GiB from an 8 KiB pack), and that macOS refuses ulimit -v and -d on the git child. comment that starts Decision (2026-10-16):. Source: 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? (I102I102 (closed): X28-git-alloc-limit: git's allocation cap against delta bombsX26-pre-receive-check (#74) found that a small pack makes receive-pack allocate a delta's declared result before any hook runs (2 GiB from an 8 KiB pack), and that macOS refuses ulimit -v and -d on the git child.). Changes 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. and S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…. Follows B74-pre-receive-checkB74-pre-receive-check: Can Wraith Box refuse a bad push before any of it reaches the landing repository, and before it uses up the host's memory?Yes, with conditions..
Figure 1. A push after 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 scanner streams the pack and holds back only its checksum. It refuses, with a named rule, when a size, the wire bytes, the object count or the per-push total is over its cap. Git’s own limit is the second layer: it refuses an allocation over the 100 MiB cap by itself, so the scanner no longer has to hold entries back to protect git’s memory.
Options
Section titled “Options”Impact
Section titled “Impact”| Requirement | A. Limit and streaming scanner | B. Limit alone | C. Scanner alone |
|---|---|---|---|
| SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped. memory, CPU and disk capped | two memory layers, CPU capped | memory yes, CPU to the watchdog | one memory layer |
| NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it. refusals name the rule | scanner names it | git’s fatal: line | scanner names it |
| NFR07-maintainabilityNFR07-maintainability: MaintainabilityMost code is cross-platform Go. fuzzing for every parser | one target, simpler | none | one target |
Evidence
Section titled “Evidence”- verified With
GIT_ALLOC_LIMIT=100m, git 2.56.0 and Apple git 2.54.0 refused one delta of 256 MiB to 2 GiB, 8 deltas of 256 MiB, a delta with 128 MiB of its own data, a delta against a 200 MiB blob in the borrowed repository, and a 400 MiB blob, each in 0.02 to 0.06 s with the git child at 15 MiB or less, leaving nothing inlanding.git. Without the limit the same packs took 207 to 2,063 MiB. Source: 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?, “Memory and time”. - verified A pack header declaring 1,638,400 objects or more was refused by the limit before git read an entry. Source: same, “The object table”.
- verified An object of exactly 100 MiB needs a limit of 104857601, because git adds a byte to the buffer. Source: same.
- verified The Go repository’s whole history and a one-commit push passed with the limit, with the same memory as without. Source: same, “Cost”.
- verified 640 deltas of 96 MiB each took 145 s of CPU in git with the limit set, before the
pre-receivecheck refused them on the total. A 1 GiB blob streams past the limit. Source: same. - verified Without the pack’s checksum,
index-packresolved no delta: every delta bomb failed withearly EOFat 15 MiB or less. Source: same, “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., no limit, pack without its checksum” rows inresults/x28-run1-homebrew.txt. - verified
git hash-object --stdinwithGIT_ALLOC_LIMIT=1kon 2 KiB exits with 128 andover limitin both gits, which is the start check. An unparsable value also exits with 128, with another message, so the check needs both. Source: same, condition 2,results/x28-probe.txt. The security review of PR116PR116 (merged): docs(spikes): X28-git-alloc-limit result, yes with conditionsResult of spike X28-git-alloc-limit: yes, with conditions. reproduced it. - assumed That later gits, Git for Windows and Linux gits honor the variable the same way. It isn’t in
git(1), only in git’s tests. The start check fails closed if one doesn’t. - inferred That the scanner’s memory, once it forwards as it reads, is its inflate state plus one size per entry, which the object count cap bounds. Follows from the design, and the fuzz target in S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq… checks it.
- inferred
index-pack --fix-thinreads and writes one base fromexport.gitfor each distinct REF_DELTA base not in the pack, before the pre-receive check runs. At about 34 bytes each, 16 MiB names about 490,000 of them, and a pack under the 1 GiB size limit as many as the object count allows. Counting REF_DELTA source sizes and capping their number bounds it. Source: the security review of PR116PR116 (merged): docs(spikes): X28-git-alloc-limit result, yes with conditionsResult of spike X28-git-alloc-limit: yes, with conditions., from reading git. Not measured here.
What this unblocks
Section titled “What this unblocks”- The git gateway in
wb-hostd, towards V1-M4-claude-end-to-endV1-M4-claude-end-to-end: `wb claude` end to endGit round trip with carry-in, landing and flagging, the model credential, the terminal records and the session summary, wb diff and wb land, on a sealed image.: 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. no longer waits on I102I102 (closed): X28-git-alloc-limit: git's allocation cap against delta bombsX26-pre-receive-check (#74) found that a small pack makes receive-pack allocate a delta's declared result before any hook runs (2 GiB from an 8 KiB pack), and that macOS refuses ulimit -v and -d on the git child. for the scanner’s scope.
Details and glossary
Why git’s limit doesn’t make the scanner unnecessary. The limit stops one big allocation. A pack can instead hold many deltas that each stay under the cap. Git builds each one in full to check its hash, so the work grows with the number of deltas, while the pack is a few KiB. Only a running total, read before git starts building, stops that early.
Why the scanner can stream now. Git reads a pack in two passes. In the first, as bytes arrive, it allocates each object and each delta’s instructions from sizes in the entry header. The scanner checks that header before forwarding it. Only after the checksum at the end does git build the deltas. Holding back the checksum gives the scanner time to finish its totals, and git’s limit covers anything the scanner gets wrong.
Glossary
GIT_ALLOC_LIMIT: an environment variable git’s test suite uses. Git refuses and exits when one allocation would exceed it.- Delta: an object stored as copy instructions against another object. Its header gives the size of the result.
- Checksum: the 20 bytes at the end of a pack that cover everything before them.
index-pack: the git program that reads a pushed pack and builds its index.