Repository navigation
v0.6.0: the warrant leaves the harness — gateway interceptor, baselines, signed heads - #23
Merged
Merged
Conversation
…es, signed heads
Enforcement was one vendor's hook. Three surfaces widen it, and one
pre-existing bug turned out to be in the README's own example.
`docket intercept` — the warrant as a Docker MCP Gateway interceptor.
Every tools/call from any client to any server is checked before it
runs. The gateway's contract inverts the hook's in a way that changes
what "a bug" means: empty stdout means the tool RUNS, so an interceptor
that crashes, warns on stdout, or emits anything the gateway can't
unmarshal has allowed the call. All three count as fail-open in the new
red-team suite (18 hostile tool calls — mail, merges, refunds, DROP
TABLE, a planted git hook, a wire transfer — 0 allowed, 0 crashes).
One asymmetry is deliberate and documented everywhere it matters: a
gateway has no human to prompt, so `ask` blocks rather than asks. That
is strictly tighter than the hook, which is the only direction a surface
is allowed to differ.
`extends:` — one baseline governing many loops. Every list is a union,
parent first, and that single rule is what makes it safe: the verdict
order is never → ask → allow, so a union can only add entries and the
two lists consulted first are the restricting ones. A child widens only
into space the baseline left open. No override escape hatch — a baseline
a child can opt out of is a suggestion. Verdicts now name the policy
that produced them (`from:`), in the reason text and on the record.
`docket record sign` — ed25519 attestations over the chain head. The
chain can't see its own tail being cut off; verification here checks the
entry at the attested sequence number, so cutting ten entries and
appending three doesn't hide it. Signing refuses on a chain that doesn't
verify, and an unpinned attestation reports what it actually proved
rather than printing a green check that means less than it looks like.
Dockerfile + Compose example so the gate runs where there's no Node, and
docs/sandboxes.md works through the composition: isolation bounds reach,
egress bounds destination, the warrant bounds authority, the record
proves what happened — and the record gets mounted out, because a
sandbox is designed to be disposable and an audit trail is not.
Fixes along the way:
- The YAML subset never supported flow collections, so the README's
headline loop file (`read: [policy documents, denial letter]`) and the
agent-contract example (`budget: { attempts: 3 }`) did not parse.
Anyone who copied them got "`warrant.read` must be a list" and no clue
why. A format's real grammar is whatever its examples use.
- SPEC.md claimed Bash maps to `change`. The implementation has always
fallen it through to `send`, correctly — a shell command can send mail
or push a branch, and the gentler verb would hand it permissions
written for editing files. Spec corrected to match.
Red-team program: 10,608 checks across seven suites, still zero silent
allows and zero fail-open outcomes. 190 tests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvKRRHp1KYfc5foJ4CoeFt
Self-review of the v0.6.0 diff turned up two real defects, both in the
direction that matters.
1. A gated hook failed OPEN when a loop file could not be loaded.
Loading a loop can throw — bad frontmatter, an `extends` pointing at a
baseline that isn't there, an inheritance cycle. Uncaught, that exits
1, and exit 1 is Claude Code's NON-blocking error: stderr is shown and
the tool runs anyway. So a broken rule file was a way to switch the
gate off, which contradicts the invariant the hook documents about
itself ("once the config expresses intent to gate, every failure mode
fails closed").
Reproduced before fixing: `--strict`, one unresolvable loop in the
directory, a `rm -rf /` payload → exit 1, no decision emitted.
Pre-existing in kind (a malformed loop file always did this), but
`extends` widened the ways to trigger it, so it belongs to this
change. Both the hook and the interceptor now catch and gate. Four
cases added to the live red-team corpora so it stays fixed.
2. `docket record verify --attest <file>` silently verified a different
file.
`attest` is declared boolean so `--attest --key K` doesn't swallow the
key as its value — which sent a named file to the positionals, where
nothing read it, and verification fell back to the newest attestation
on disk. A green check about a file the user never asked about is the
worst available outcome for this command. Named files are now honored
in all three spellings, and a named file that isn't there is an error
rather than a fallback.
Nits from the same pass: `.dockerignore` used a bare `*.md`, which reads
as "every markdown file" when spec/SPEC.md is deliberately COPYed into
the image (it worked — Docker's `*` doesn't cross `/` — but it worked by
accident); imports moved to the top of record.js.
192 tests, 10,612 red-team checks, still zero fail-open.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvKRRHp1KYfc5foJ4CoeFt
`docket review` mines repeated asks and proposes warrant widenings. Two ways inheritance could have broken it, both now tested: - It must read the MERGED loop, or it would propose allowing something the baseline deliberately reserves for a human. (It does — proposals come from listLoops, which resolves.) - It rewrites the loop file, so it must write the CHILD's own frontmatter. Rewriting from the merged object would copy the whole baseline into the child and quietly cut the inheritance link. (It doesn't — addToWarrant re-reads the raw file.) Both were already correct; neither was covered. A governance property nobody tests is a governance property that regresses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NvKRRHp1KYfc5foJ4CoeFt
The docs site was still describing v0.3's command set. Adds two guided sections (the MCP gateway gate, baselines & inheritance), the signing half of the record page, the new CLI rows, and the seventh eval suite — including the part that is easy to leave out: at a gateway `ask` blocks rather than asks, and silence is an allow, so a crash is a fail-open. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NvKRRHp1KYfc5foJ4CoeFt
The interceptor caps the target it builds from a tool call's arguments. That cap is a real softness: pad an innocuous field and the consequential one falls off the end, and a target that loses words loses matches — against `ask` and `never`, the two lists that match fuzzily. Checked rather than assumed. Padding degrades deny → ask; it cannot reach allow, because allow requires every remaining clause to be covered and padding only adds uncovered ones. Both shapes are now in the gateway hostile corpus — one where the salient-key ordering saves the real field from the cut, one where it doesn't — so the property is enforced rather than argued. 30 gateway checks, 20 hostile, still 0 allowed. 10,614 total. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NvKRRHp1KYfc5foJ4CoeFt
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NvKRRHp1KYfc5foJ4CoeFt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enforcement used to mean one vendor's hook. Everything else docket did — compiled context, MCP tools — worked only when the agent cooperated. This widens the enforced surface three ways, and turned up four bugs along the way (two pre-existing, two mine).
docket intercept— the warrant as a Docker MCP Gateway interceptorAn agent's most consequential actions don't go through the harness's file tools. They go out over MCP: to a mail server, a ticket tracker, a cloud API, a payments provider. Docker's MCP Gateway already intercepts what a gateway can know generically (secrets in payloads, OAuth failures). Docket adds what it can't: whether this action was permitted, for this job, by the person accountable for it.
The gateway's contract inverts the hook's, and that changes what counts as a bug. Empty stdout means the tool runs. So an interceptor that crashes, prints a warning to stdout, or emits anything the gateway can't unmarshal has allowed the call. All three are counted as fail-open in the new red-team suite rather than filed as polish — 20 hostile tool calls (mail, PR merges, refunds,
DROP TABLE, an S3 wipe, a planted git hook, a wire transfer, padding attacks against the target's length cap), 0 allowed, 0 crashes.One asymmetry is deliberate and stated everywhere it matters: a gateway has no human on the connection, so
askblocks rather than asks. Strictly tighter than the hook — the only direction a surface is allowed to differ — but it means a gateway-fronted workflow stops dead on anything unlisted rather than waiting for a yes.No verb is inferred from a tool name (
search_and_purgereads like a read), so everything defaults tosend.--action readoverrides it and is documented as the real widening it is.extends:— one baseline, forty loopsThe merge rule is one sentence: every list is a union, parent first. It's safe for a structural reason rather than a careful one — the verdict order is
never→ask→ allow, so a union can only add entries and the two lists consulted first are the restricting ones. A child can't delete a parent's hard stop, and a child that allows something the parent asks about doesn't win: theaskis reached first and the child's entry is never consulted. A child may widen only into space the baseline left open. There is deliberately no override escape hatch.Verdicts now name the policy that produced them, in the reason text and on the record (
from: org-baseline). Baselines areabstract: true, so nothing routes to them. Budgets inherit with a floor: numeric limits merge to the minimum.docket reviewwas checked against this in both directions — it reads the merged loop (so it can't propose retiring a rule the baseline reserves) and writes the child's raw frontmatter (so applying an amendment doesn't flatten the baseline into the child and cut the link). Both were already correct; neither was covered. Now tested.docket record sign— signed headsA hash chain can't see its own tail being cut off. Verification checks the entry at the attested sequence number, not just the current head, so cutting ten entries and appending three doesn't hide it:
Two things it refuses to overstate:
signwon't sign a chain that doesn't verify (that's a rubber stamp), and an attestation carrying its own public key proves only that the attestation wasn't edited. Without--key,verifysays exactly that rather than printing a green check that means less than it looks like.Container + composition
Dockerfile(non-root, zero deps) so the gate runs where there's no Node, plus a runnable Compose example. CI builds the image, runs the interceptor inside it against a hostile call, and asserts the mounted record outlived the container.docs/sandboxes.mdworks the composition through: isolation bounds reach, egress bounds destination, the warrant bounds authority, the record proves what happened. The load-bearing detail is mount.docketout of the sandbox — a sandbox is designed to be disposable and an audit trail is not. It ends with what none of the four layers give you.Bugs found
Two pre-existing:
read: [policy documents, denial letter, claim correspondence]) and the agent-contract example (budget: { attempts: 3, parallelism: 1 }) parsed as plain strings, so anyone copying them got`warrant.read` must be a listand no clue why. A format's real grammar is whatever its examples use. Now supported at one level; nested ones are an error rather than a best-effort parse.SPEC.mdclaimedBashmaps tochange. The implementation has always fallen it through tosend, correctly — a shell command can send mail or push a branch. Spec corrected to match the code.Two found in self-review of this diff:
extendswidened the ways to trigger it. Both hook and interceptor now catch and gate; four cases added to the live corpora.record verify --attest <file>silently verified a different file.attestis boolean so--attest --key Kdoesn't swallow the key, which sent a named file to the positionals where nothing read it — falling back to the newest attestation and printing a green check about a file the user never named. Fixed in all three spellings; a named file that isn't there is now an error, not a fallback.Verification
npm test), up from 133.npm run eval), up from 10,582: zero silent allows, zero fail-open outcomes. The gateway suite adds "benign work blocked" as its own invariant — a gate that cries wolf is a gate somebody unwires.fromreaching the record, the interceptor blocking and allowing, keygen → sign → verify, truncation detection, and the README's own example now parsing.Not verified locally: the image. This session has the Docker CLI but no daemon, so
docker buildcouldn't run — which is why the build and an in-container interceptor call are wired into CI as a job rather than asserted by hand.