Omniscio

Git guardrails (part 3)

The newest git-guardrails changes, each dated: the history rule can now be fixed while the app runs, three more ways round the master-key rule are refused, and a shallow fetch in a shared object store is refused on every dial.

On this page

What it is

This is part 3 of the Git guardrails page. It carries the rule changes that landed after part 2 reached the 40,000-character page cap, each dated and named after what it changes. Read it with parts 1 and 2 to see the whole set the guard enforces today.

Where to find it

Nothing on this page is a surface — part 1 covers pausing the guard, what it blocks, the escape hatches and the limits. What follows continues the running list of changes, in the order they landed.

How it behaves

The history rule can be fixed while the app runs (2026-10-31)

The rule that decides which git history reads are allowed — the one that refuses unbounded log and rev-list walks — is no longer frozen into the running app. The app follows the rule file in its own checkout and re-reads it when it changes, and a fix can also be applied directly from one commit:

  • POST /git-policy/apply with {"ref":"<branch or commit>"} (full-trust token) reads the rule at that exact commit and puts it into force for every git call the app makes, on the next call. No restart, and no local agent is touched.
  • Before it switches, the app replays the git calls it actually made recently. If the new rule would refuse any of them, the apply is held and the answer lists each one. Send the same request with "acceptNewRefusals": <that number> to apply it anyway. A changed rule file in the checkout that would refuse recent calls is held the same way and shows up in the status.
  • An applied rule stays in force across an app restart until the checkout itself contains that commit; then the app goes back to following the checkout.
  • GET /git-policy/status says which rule is in force, from which commit, and what the last apply held or allowed. POST /git-policy/revert goes back to the checkout's rule.

A rule file that cannot be loaded is never put into force: the previous rule keeps deciding.

The master-key rule closes three more ways round it (2026-11-05)

The rule that keeps the app's master key out of every tool result allows exactly two uses of it: it may be captured into a variable (TOKEN=$(cat <the key file>), any variable name), and it may be sent as the credential of a curl, wget or Invoke-RestMethod call, where the reply can be piped through head, tail or jq. Three spellings that slipped past it are now refused, and each refusal names the two shapes that work:

  • A wrapper that prints its command. timeout 120 curl … is still the approved send, but env -v curl …, time -v curl … and any wrapper flag the guard does not know now make the send untrusted, because those print the whole command line, key included.
  • A credential flag that makes the client echo the key. The key as the value of -H @, -d @ or -F f=@, as a user flag with no name: part or a cookie flag with no name= part, or as a PowerShell -InFile, -Token, -Credential or -Authentication parameter, becomes a file name or a prompt that the client prints when it fails. -G and --url-query turn the value into a URL the client can print.
  • A key name split around an expansion. cd ~/.amc && echo $(cat cli-token), cat ~/.amc/$(echo cli-token), cat ~/.amc/cli-to$()ken and cat ~/.amc/${X:-cli}-token build the name from pieces on either side of an expansion; the guard now reads the pieces together.

Spellings that make a shell evaluate a captured name as arithmetic (declare -i X=T, [[ T -eq 1 ]]) are not judged yet.

One more, refused on every dial (2026-11-06)

A --depth fetch in a shared object store (shallow-truncating-fetch) — the rule itself is older; what changed is that it now REFUSES on the advisory dial instead of warning.

A worktree's .git is a file pointing at the main checkout's gitdir, and it shares the common object store, so git fetch --depth=1 typed in a scratch worktree writes the boundary file in the MAIN checkout. Git then refuses to walk past that boundary, so merge-base origin/master HEAD answers nothing — and both commands that open a pull request (pr and pr:catch-up --cut) refused for every session on the computer, with a message saying the branch "was never forked from this trunk". Measured 2026-11-06 at 19:52:57Z, the guard's own decision log holds the verdict this rule produced: the detector fired, and the decision layer answered allow, because the rule was not in the always-enforced set and the box runs the advisory dial. The road was down for 13 minutes.

So the rule joined the always-enforced set, where a warning is not an option: the harm is the fetch RUNNING, and the boundary is written before anyone could read a warning. --unshallow is still allowed — it clears the boundary and is the cure — and the per-repo exclusion and the human approval window still lift it.

Both PR roads also stopped misreporting the cause. With the store shallow they now say so, and name the cure (git fetch --unshallow --filter=blob:none origin); a store that holds its own history, or a probe that cannot answer, keeps the original sentence.

A revision grep may name files, not a tree (2026-11-13)

A git grep that names a revision and a FOLDER (git-grep-tree-read) — refused, and refused on every dial.

A git grep <pattern> <rev> -- <folder> reads every blob of that revision out of the object store. src/main alone is 20,605 files here, so the command costs a full core for minutes: measured twice on 2026-11-12, a git.exe at ~0.99 cores (0.87 user + 0.12 kernel). The same grep against one FILE on the same revision takes 0.068 s, so the ref is irrelevant and the pathspec is everything.

The guard now refuses a revision read unless every pathspec resolves to a single regular file. A directory, a trailing slash, a glob, a :(magic) pathspec and anything unresolvable all count as a tree, so a mistake in the predicate fails toward the cheap read. rg <pattern> <dir> over the working tree is the remedy the message names. It is scoped to the Omniscio lane, because a small repo's tree read is cheap and must not be banned.

This class has failed twice, in two different ways, and both are worth knowing. On 2026-10-28 a refusal was built for it and later vanished from the tree; a notice stood in its place for four days, during which 194 calls cost 8,618 s. Then, by 2026-11-13, the shipped classifier allowed both -- src/main and -- src again while the postmortem still read status: resolved — and even the refusal that WAS there would only have warned, because the rule was not in the always-enforced set (the same gap the shallow-fetch rule above records: on the advisory dial a warning is the same as allowing it). This change fixes both halves: the rule joined the always-enforced set, and its specs now fail against a tree that has lost the rule.

One gap is deliberate and stated: a revision read of a single HUGE file is still allowed, because bounding it needs a git call inside the guard, and that call would queue behind the very load the guard exists to prevent.

Last verified 2026-11-07