DEV Community

Cover image for ARC Failure Lab #2: A Signed PASS for the Wrong Commit
asagiman for Netsujo

Posted on Edited on

ARC Failure Lab #2: A Signed PASS for the Wrong Commit

A pull request passes independent review. The reviewer signs a PASS receipt. The implementation branch advances by one commit, but the old receipt is still available.

What, exactly, does that signature approve?

We build Agent Role Contracts (ARC) at Netsujo. ARC validates the consistency of declared roles, scopes, review relationships, and handoffs. Its declaration-level PASS does not authenticate reviewer keys or authorize a merge. Those are responsibilities of the surrounding runtime and integration gate.

This second Failure Lab is a host-gate companion experiment, not a claim that ARC implements cryptographic review receipts. It is small enough to run with Node.js alone.

One receipt, five decisions

Our example gives an authorized reviewer a temporary Ed25519 key pair and pins its public key in a tiny verifier. The receipt includes a run identity, exact candidate SHA, policy ID, and verdict. Its signature covers all four fields using an explicitly ordered serialization.

We test the following behavior:

Case Change Expected decision
Matching reviewer receipt Candidate A, policy v1, trusted key EVIDENCE_MATCHED_ONLY
Stale candidate Present A's valid receipt while checking candidate B DENY_STALE_CANDIDATE
Changed policy Present v1's valid receipt under policy v2 DENY_STALE_POLICY
Different signer Implementer signs the same fields with another key DENY_UNTRUSTED_SIGNER
Missing receipt No verifiable input PENDING_MISSING_RECEIPT

The success condition is intentionally called EVIDENCE_MATCHED_ONLY. A valid receipt is evidence for a particular subject. It is not by itself permission to merge, deploy, or perform external actions.

Run the fixture

Save the following as review-receipt-fixture.mjs and run it with Node.js 22 or later:

node review-receipt-fixture.mjs
Enter fullscreen mode Exit fullscreen mode
import assert from 'node:assert/strict';
import { generateKeyPairSync, sign, verify } from 'node:crypto';

// Synthetic identifiers; no real PR, credentials, agent or network request.
const shaA = 'a'.repeat(40);
const shaB = 'b'.repeat(40);
const runId = 'lab-run-001';
const policyV1 = 'review-policy-v1';
const policyV2 = 'review-policy-v2';

const reviewer = generateKeyPairSync('ed25519');
const implementer = generateKeyPairSync('ed25519');

// Deliberately fixed serialization for this small educational fixture.
// A production protocol needs a specified canonical encoding and key lifecycle.
function signedBytes(r) {
  return Buffer.from(JSON.stringify([
    1, r.runId, r.candidateSha, r.policyId, r.verdict
  ]), 'utf8');
}
function issue(receipt, privateKey) {
  return {
    receipt,
    signature: sign(null, signedBytes(receipt), privateKey),
  };
}
function inspect({ signedReceipt, currentSha, currentPolicy, pinnedReviewerKey }) {
  if (!signedReceipt?.receipt || !Buffer.isBuffer(signedReceipt.signature)) {
    return 'PENDING_MISSING_RECEIPT';
  }
  const { receipt, signature } = signedReceipt;
  if (!verify(null, signedBytes(receipt), pinnedReviewerKey, signature)) {
    return 'DENY_UNTRUSTED_SIGNER';
  }
  if (receipt.candidateSha !== currentSha) return 'DENY_STALE_CANDIDATE';
  if (receipt.policyId !== currentPolicy) return 'DENY_STALE_POLICY';
  if (receipt.verdict !== 'PASS') return 'DENY_REVIEW_NOT_PASS';
  return 'EVIDENCE_MATCHED_ONLY';
}
const receipt = {
  runId,
  candidateSha: shaA,
  policyId: policyV1,
  verdict: 'PASS',
};
const signedByReviewer = issue(receipt, reviewer.privateKey);
const signedByImplementer = issue(receipt, implementer.privateKey);
const cases = [
  ['matching reviewer receipt', signedByReviewer, shaA, policyV1, 'EVIDENCE_MATCHED_ONLY'],
  ['valid receipt replayed on newer commit', signedByReviewer, shaB, policyV1, 'DENY_STALE_CANDIDATE'],
  ['valid receipt after policy change', signedByReviewer, shaA, policyV2, 'DENY_STALE_POLICY'],
  ['implementer uses its own signing key', signedByImplementer, shaA, policyV1, 'DENY_UNTRUSTED_SIGNER'],
  ['receipt missing', null, shaA, policyV1, 'PENDING_MISSING_RECEIPT'],
];
for (const [label, input, currentSha, currentPolicy, expected] of cases) {
  const actual = inspect({
    signedReceipt: input,
    currentSha,
    currentPolicy,
    pinnedReviewerKey: reviewer.publicKey,
  });
  assert.equal(actual, expected, label);
  console.log(`PASS: ${label} -> ${actual}`);
}
console.log('5/5 fixture assertions passed. No merge or runtime execution was authorized.');
Enter fullscreen mode Exit fullscreen mode

We executed this fixture on November 17, 2026, using Node.js v22.16.0. The five local assertions passed:

PASS: matching reviewer receipt -> EVIDENCE_MATCHED_ONLY
PASS: valid receipt replayed on newer commit -> DENY_STALE_CANDIDATE
PASS: valid receipt after policy change -> DENY_STALE_POLICY
PASS: implementer uses its own signing key -> DENY_UNTRUSTED_SIGNER
PASS: receipt missing -> PENDING_MISSING_RECEIPT
5/5 fixture assertions passed. No merge or runtime execution was authorized.
Enter fullscreen mode Exit fullscreen mode

The negative cases are successful tests: the simulated gate rejects exactly what it should reject.

Why the key boundary matters

The important control here is not the claimedProducer text inside a JSON receipt. The verifier compares the signature against a pinned reviewer public key. A receipt signed with the implementer's separate key does not satisfy that trust condition.

In this lab both key pairs are created by one local process. That makes the exercise reproducible, but it does not demonstrate operational independence. A production system would need to establish who can use the reviewer's private key, how the key is registered or revoked, and whether the review actually occurred. Signature verification alone cannot prove those facts.

The serialized byte format in this toy is also fixed only for the demonstration. A real protocol must specify canonical encoding, key IDs, algorithm choices, policy transitions, and how the verifying authority obtains the trusted inputs.

Where an actual merge gate goes further

To rely on a review receipt, an integration gate should establish at least:

  1. Subject: the receipt covers the exact candidate revision and relevant base or merge result.
  2. Authority: the reviewer's identity and key were authorized for that task when the receipt was issued and remain acceptable under the current policy.
  3. Coverage: all required review and CI obligations are satisfied; missing evidence remains missing.
  4. Currentness: a new commit, policy revision, or invalidated assumption triggers the applicable re-verification rather than inheriting an old PASS.
  5. Acceptance: the protected merge and any production verification remain their own gates.

A reused signature is not inherently malicious. Reusing it for a different subject or authority state is the problem. The host must detect that difference.

One more failure to propose

Our five cases do not yet test concurrent admission of the same receipt or a lost response after a side-effecting action. Those require durable identity, deduplication, and external-effect reconciliation beyond a local signature check. We would treat them as separate follow-on tests.

What is the smallest fixture that would falsify your own review gate? A stale candidate, a forged producer, a changed policy, or something else?

We welcome public, synthetic counterexamples in ARC's GitHub repository. Please omit credentials, customer data, and private system paths.

Scope disclosure: the results above come from a self-contained local fixture authored by Netsujo. They are not third-party validation, a test of live reviewer key custody, or proof of ARC runtime enforcement.

Top comments (16)

Collapse
 
iliyaoblakov profile image
Iliya Oblakov •

The forged producer is the fixture that falsifies my gate. A verdict there is a plain file: review.sh reads the full HEAD hash at the start, saves the verdict under .ai/reviews/ named by the first 12 characters, and writes the full hash on a Head: line. merge-check.sh refuses a missing file or a Head: line that names another commit, which covers your stale candidate row. Nothing covers your different signer row, because anything with write access to the repo can write under .ai/. review.sh also voids a review if HEAD moved while it ran, so when does your fixture read the candidate SHA, before the review starts or at signing?

Collapse
 
suirindo profile image
asagiman Netsujo •

Thanks, Iliya. In the fixture, the candidate SHA should be pinned before review starts—not first discovered at signing.

A trusted dispatcher captures full commit A and binds the run to it. The reviewer evaluates an isolated checkout of A, verifies the source identity (including any uncommitted changes) at the start and again before signing, and signs a receipt bound to A, the run, policy, and verdict. Signing never silently rebinds the review to a newer HEAD.

The merge gate independently resolves the current candidate (and, where relevant, base/merge result) and compares it with the authenticated receipt.

If the reviewed checkout changes during the run, no PASS is issued. If the branch advances from A to B but A remains an intact reviewed snapshot, the A receipt can remain evidence for A; it must not authorize B.

Your start/end HEAD checks cover an important race. The separate issue is producer authority: a matching Head: line in a writable .ai/reviews/ file is not an authenticated reviewer verdict.

Our local lab tests the negative case with a different signing key and a pinned reviewer public key, but because both keys are created in one toy process, it does not prove real-world key custody.

The smallest additional test for your gate would keep HEAD=A, forge a PASS file with the correct full Head: A, and require merge-check.sh to reject it specifically for unauthenticated provenance. A separate race fixture would change the candidate during review and ensure no receipt is accepted for the changed candidate.

That gives us two independently falsifiable properties: exact subject binding and reviewer-only issuance. Thanks for specifying where your gate already succeeds and where it does not.

Collapse
 
iliyaoblakov profile image
Iliya Oblakov •

I haven't run your forged PASS test, so what follows is the script's logic, with no run behind it. merge-check.sh asks for three things: a test pass record for the full HEAD hash, a verdict file for HEAD whose Head: line matches, and an ACCEPT whose reviewer is a different engine from the builder. A hand-written file with Head: A, one Verdict: ACCEPT line and another engine's name as reviewer meets every check on the verdict, so I expect it to pass, because the reviewer is only a name in a file. Your second test is covered: if HEAD moves or a file outside .ai/ changes during the review, review.sh voids it and saves no verdict. Builder and reviewer both run on my machine, so where would you keep the reviewer's key so the builder can't sign with it?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

Thanks, Iliya. I checked merge-check.sh, and your reading is correct: the verdict fields are checked, but reviewer provenance isn't authenticated.

Your HEAD and working-tree checks already handle review-time drift.

On a shared machine with the same OS identity, I wouldn't claim the reviewer's private key is isolated from the builder.

For cryptographically independent approval, I'd use a separately controlled reviewer runtime or signing service, with the private key inaccessible to the builder. The merge gate would verify a signed receipt bound to the pre-pinned candidate SHA, policy, run identity, and verdict.

Without that trust boundary, the local gate remains a useful workflow guard, not independent authorization.

A forged ACCEPT fixture would be a useful next test.

Thread Thread
 
iliyaoblakov profile image
Iliya Oblakov •

Ran it. Throwaway repo, a real test pass for HEAD, then a verdict file written by hand: the full hash on the Head: line, Builder: claude, Reviewer: codex and one Verdict: ACCEPT line. No review ran, and merge-check.sh answered OK and named Codex as the reviewer. The same file with claude on both lines was refused, so that check compares two names and says nothing about who typed them. The script's header calls it a local guard against merging the wrong commit, not a security boundary, which is your reading. With a separate signing service, how does it know a review happened before it signs whatever the builder sends?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

Thanks, Iliya. That's a useful reproduction, and your question exposes the next trust boundary.

A signing service cannot know a review happened merely because the builder submits ACCEPT. If it signs that claim, we've only converted a forged verdict file into a signed forged verdict.

I'd separate the process into three parts:

  1. Trusted dispatch: A controller pins the repository, full candidate SHA, base revision, policy, and unique run ID. It launches the reviewer in an isolated environment with credentials the builder cannot access.

  2. Authenticated execution evidence: The reviewer runner records the actual review invocation, completion status, output digest, and verdict through a channel the builder cannot write to. The controller checks that the expected review job completed against the pinned candidate.

  3. Conditional signing: The signing service accepts only that authenticated run evidence, not a builder-supplied verdict. It verifies the reviewer assignment, candidate, policy, and run identity before issuing a receipt. The merge gate independently checks the current candidate and its remaining obligations.

There's an important limit: even authenticated execution evidence cannot prove the quality of a review. It can establish that a controlled reviewer process ran and produced the recorded result under defined conditions.

And if the builder can control the reviewer environment, evidence channel, or signing credentials, we cannot claim independent authorization.

Our published Failure Lab #2 demonstrates subject and signing-key binding, not review-execution attestation. Your experiment identifies exactly what that fixture doesn't yet cover.

The next negative test I'd propose is simple: the builder submits a perfectly formed ACCEPT for the correct SHA, but no authenticated reviewer run exists. The signing service must refuse it.

That would give us a concrete, falsifiable test for reviewer provenance rather than another claimed identity field.

Thread Thread
 
iliyaoblakov profile image
Iliya Oblakov •

On one machine I can't build your second part. Builder, reviewer and merge check all run as my OS user, so any file one of them writes, the others can rewrite, and there is no channel the builder can't reach. Your dispatch step needs a second machine or a CI job the builder holds no token for, and until I have one the script's header stays accurate: a local guard, not a security boundary. In your design, does a commit that edits the controller's own policy go through the controller it changes?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

That's exactly the self-modification boundary. My answer is no: the proposed controller must not authorize its own installation.

The intended design is:

  1. A commit changing controller code, approval policy, reviewer trust anchors, or merge rules is treated as untrusted candidate data. The currently trusted policy and verifier, not the proposed replacement, determine its admissibility.
  2. The admission gate must be protected independently of the candidate. Changes to the trust root itself require authorization outside that trust root. Review evidence must bind to the exact candidate, applicable policy generation, and relevant base or merge result.
  3. Activation of the new controller/policy generation happens only after the existing acceptance and protected integration gates have passed. The new policy cannot retroactively authorize its own admission.

And I agree with your single-machine assessment. If builder, reviewer, and gate share an OS identity with access to each other's credentials and files, that's a useful local workflow guard, not an independent security boundary. CI only improves that claim if the builder cannot control the verifier, its credentials, or the protections requiring it.

A useful next negative test would be:

  • Candidate B changes the policy to permit self-review and supplies a matching PASS.
  • The verifier pinned to policy A must reject B's attempt to use its proposed policy as the admission authority.
  • A variant that changes the verifier or CI definition itself must also fail without separate authorization.

Our published Failure Lab #2 does not establish this property yet. It tests receipt and subject binding, not secure controller self-upgrades.

Your question identifies a distinct failure mode worth testing. Thanks for pushing the boundary one level further.

Thread Thread
 
iliyaoblakov profile image
Iliya Oblakov •

My gate passes the first case of your test for a boring reason. The three scripts and the review prompt are installed outside the repo they check, so candidate B can't change the policy through a commit, with no verifier pinned to anything. The same user account can still edit those files, and B can still edit the tests the gate runs, where a test weakened in the same commit passes. I wrote the forged ACCEPT run up as a post today and credited your Failure Lab as the source of the test. Which variant will you publish first, the self-review policy change or the CI definition one?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

Thanks for running the forged ACCEPT experiment, publishing the results, and crediting Failure Lab #2. That's exactly the kind of counterexample we want to surface.

I'd publish the CI-definition mutation variant first.

Your setup makes an important distinction: keeping the gate scripts outside the candidate repository prevents a repository commit from directly changing those scripts, but it doesn't establish an independent security boundary when everything shares the same OS identity. And the candidate can still weaken the tests that produce its own PASS.

The next fixture should test whether a candidate can modify its CI workflow or test definition, produce a green result under the weakened rules, and have that result accepted as independent evidence.

The expected boundary is that a verifier anchored outside the candidate evaluates the change under the previously trusted policy. The candidate's proposed CI definition cannot authorize itself. Legitimate changes to the gate need separate authorization.

After that, I'd tackle the self-review policy mutation as a distinct trust-root upgrade test.

The underlying invariant is the same: a proposed authority must not approve its own activation.

Thanks for pushing this from a theoretical boundary into a reproducible failure case.

Thread Thread
 
iliyaoblakov profile image
Iliya Oblakov •

I ran a small version of the CI-definition case on my gate today. The test command is set outside the repo, but it was make test, and the Makefile belongs to the candidate. Candidate B broke the function and in the same commit rewrote the test target to print "Ran 2 tests in 0.001s": the gate recorded a PASS with the same Command: make test line as the commit before it, even with a minimum test count set, because the count is read from output B controls. Given the unittest command directly, the same commit failed. In your fixture, does the verifier pin only the workflow file, or every script that workflow calls?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

Thanks for actually running this, Iliya. The Makefile example makes the problem much clearer.

My answer is that pinning the workflow file alone is not enough. We need to protect the entire chain that determines how the verdict is produced, including the invoked scripts, test definitions, runner configuration, and result collection.

Calling unittest directly removes one layer of indirection, but it still leaves the question of who controls the tests themselves.

Our published Failure Lab #2 doesn't cover this yet. I'd like to use your Makefile example as a starting point for the next Failure Lab, with credit to you, if you're happy with that.

The interesting question is how small we can make the trusted verification boundary without sacrificing meaningful independent verification.

Thread Thread
 
iliyaoblakov profile image
Iliya Oblakov •

Use the Makefile example, with or without the credit. One more case for the same chain, measured that day: my gate runs the tests in the folder the agent edited, and when an edit landed in the same second with the same file size, Python reused its cached old code and a broken function passed. Deleting the cache made the same commit fail. For your boundary question: does the verifier in your fixture check the commit out fresh, or run in the candidate's working folder?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

Thanks, Iliya. I'll credit you for the Makefile example.

To answer your question directly: neither. The current Failure Lab #2 fixture uses synthetic commit SHAs and verifies signed receipt binding. It does not check out or execute the candidate code.

Your Python cache example exposes another important boundary: even a correctly bound commit SHA does not guarantee that the code actually executed corresponds to that commit.

A fresh, isolated checkout with controlled caches and dependencies would be a stronger baseline for independent verification.

I'd like to include this as another Failure Lab case, with credit to you. It connects the integrity of review evidence to the integrity of the execution environment.

Thread Thread
 
iliyaoblakov profile image
Iliya Oblakov •

Go ahead with the cache case too, with the same credit. For the fixture, these were the conditions that made it pass: in my run I pinned the edit to the same modification second with touch, the file size stayed the same, and the cache folder was gitignored, so the clean-tree check never saw it. When you credit both cases, a link to my write-up of the forged ACCEPT run would show readers where this thread started. Will the next lab check the code that ran against the commit, or rely on the fresh checkout alone?

Thread Thread
 
suirindo profile image
asagiman Netsujo •

Thanks, Iliya. I'll credit you for both the Makefile and cache cases, and link to your forged ACCEPT write-up.

The next lab should verify the relationship between the code actually executed and the reviewed commit, rather than rely on a fresh checkout alone.

A clean working tree establishes a useful starting condition, but it doesn't establish execution integrity. Cached artifacts and generated files introduce another trust boundary.

I'd like to turn both of your examples into reproducible negative tests that expose this distinction. Your contributions are helping us make the verification model more concrete.