Skip to content

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

guest, untrustedgit pushgit-remote-wbhost: wb-hostdref filterX07pack scannerstreams; count, totalreceive-packGIT_ALLOC_LIMIT:no allocation over the cappre-receive checklanding.git640 deltas: stopped on the total2 GiB delta: scanner refuses, git backs it up

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.

Set GIT_ALLOC_LIMIT to the per-object cap plus one byte. Check at start that the git found honors it, and refuse pushes if not. The scanner checks each entry’s header, forwards the entry at once, and holds back only the pack’s checksum. It keeps its caps on wire bytes (1 GiB), object size, the per-push total and the object count, counts the base of every REF_DELTA toward the total, and allows at most 10,000 REF_DELTA entries. Git’s receive.maxInputSize is 1 GiB as well. A push must ask for side-band-64k, and gets a 60 s idle timeout and a 5 minute watchdog.

Set the limit and drop the scanner.

C. The scanner as decided on I74, no limit

Section titled “C. The scanner as decided on I74, no limit”

What 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. says today: the scanner holds each entry until it passes.

RequirementA. Limit and streaming scannerB. Limit aloneC. Scanner alone
SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped. memory, CPU and disk cappedtwo memory layers, CPU cappedmemory yes, CPU to the watchdogone memory layer
NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it. refusals name the rulescanner names itgit’s fatal: linescanner names it
NFR07-maintainabilityNFR07-maintainability: MaintainabilityMost code is cross-platform Go. fuzzing for every parserone target, simplernoneone target
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.