I forged a Codex ACCEPT with four lines of text and my merge check passed it
My merge check passed an approval that no reviewer wrote. I typed four lines into a text file, named Codex as the reviewer, and merge-check.sh answered OK. No review ran. In my review gate, Claude Code writes a change a
My merge check passed an approval that no reviewer wrote. I typed four lines into a text file, named Codex as the reviewer, and merge-check.sh answered OK. No review ran.
In my review gate, Claude Code writes a change and Codex reviews it read-only. Three scripts hold the merge. gate.sh runs the tests and writes a pass record named after the commit. review.sh asks the other engine for a verdict and saves it under the commit hash. merge-check.sh refuses the merge unless that exact commit has both.
The test came from a comment thread. ARC Failure Lab #2: A Signed PASS for the Wrong Commit ends by asking for the smallest fixture that would falsify your own review gate. In the comments its author, asagiman, named mine: keep HEAD where it is, write the verdict file by hand, and see whether the merge check notices. I had answered from the script's logic that I expected it to pass. On 22 November I ran it.
The run
A scratch repo with one function and one test. Nothing is recorded yet, so the check refuses:
$ merge-check.sh
merge-check: REFUSED: no test pass record for c5809d919478; run gate.sh
A real test run:
$ GATE_CMD='python3 -m unittest test_calc' gate.sh
gate: running 'python3 -m unittest test_calc' on c5809d919478
gate: PASS on c5809d919478, record .ai/tests/c5809d919478ba1f85405985bc66cc8a083e3ab2.pass
The tests passed and no review exists, so it refuses again:
$ merge-check.sh
merge-check: REFUSED: no review verdict for c5809d919478; run review.sh
Now the forgery. I never ran review.sh. I wrote the file it would have saved:
$ cat .ai/reviews/c5809d919478.md
Head: c5809d919478ba1f85405985bc66cc8a083e3ab2
Builder: claude
Reviewer: codex
Verdict: ACCEPT
$ merge-check.sh
merge-check: OK: c5809d919478 has a test pass and an ACCEPT from codex (builder claude)
Four lines, exit 0. The OK line credits Codex with a review it never did.
The test record forges the same way
The pass record that gate.sh writes has three lines: the commit, the test command and the date. merge-check.sh reads one of them. I replaced the record with a single hand-written Head: line, with no command and no date, and the check still answered OK.
So the Command: line is a note for a person. Nothing compares it with the command that should have run.
What the check still refuses
The same hand-written file fails as soon as one field is wrong:
# Reviewer: claude, the same engine as the builder
merge-check: REFUSED: the verdict for c5809d919478 does not name two different engines
# a Head: line with another commit's hash
merge-check: REFUSED: the verdict .ai/reviews/c5809d919478.md is not for c5809d919478ba1f85405985bc66cc8a083e3ab2
# two Verdict: lines
merge-check: REFUSED: the verdict for c5809d919478 is not a single ACCEPT
# one new commit on top, with the old records still on disk
merge-check: REFUSED: no test pass record for 949082ca1fbb; run gate.sh
That list is what the gate is for. An old ACCEPT can't cover a new commit, a verdict for another commit can't be borrowed, and a verdict that names the builder as its own reviewer is refused.
Why a written file passes
The check reads fields. It compares the Head: line with the current commit, compares the builder's name with the reviewer's name, and counts the Verdict: lines. It has no way to know who typed them. Builder, reviewer and merge check all run on my machine as my user, and anything that can write to the repo can write under .ai/.
The script says so itself. The header of merge-check.sh calls it "A local guard against merging the wrong commit, not a security boundary." The run shows where that line sits: the guard holds against stale and mismatched records, and a record someone wrote on purpose walks through it.
What would close it
asagiman's answer in the thread has three parts. A controller starts the reviewer in an environment the builder can't reach. The reviewer's run is recorded through a channel the builder can't write to. A signing step accepts only that record. Signing a verdict the builder hands over would only turn a forged file into a signed forged file.
On one machine with one user, I can't build that. It needs a second machine, or a CI job the builder holds no token for. I don't have one yet, so the header stays accurate.
Run it on your gate
- Pick a commit your gate has not approved.
- Write the approval by hand, in whatever form your gate stores one: a file, a label, a status or a comment.
- Run the merge check.
If it passes, you know what your gate checks: that an approval exists, with nothing about who wrote it.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.