Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9d2652c
security(cleanroom): isolate each compatibility vector from the trust…
ruvnet Oct 9, 2026
bafb700
security(cleanroom): require full TAP vector execution before issuing…
ruvnet Oct 9, 2026
213d0b6
test(cleanroom): reject exit-zero and forged TAP bypasses; enforce vo…
ruvnet Oct 9, 2026
39c28df
test(cleanroom): gate Docker success on full verified TAP vector acco…
ruvnet Oct 9, 2026
776fe77
test(cleanroom): close scoped TAP accounting test correctly
ruvnet Oct 9, 2026
ffde48d
test(cleanroom): isolate subprocess test environment from inherited N…
ruvnet Oct 9, 2026
81b48f2
feat(cleanroom): Ed25519 host-side evidence attestation and independe…
ruvnet Oct 9, 2026
23ef422
feat(cleanroom): bind policy and generated harness digests into v2 ev…
ruvnet Oct 9, 2026
61fbeef
feat(cleanroom): attest trusted evaluator results and verify worker s…
ruvnet Oct 9, 2026
3d60257
test(cleanroom): verify worker Ed25519 report attestation and tamper …
ruvnet Oct 9, 2026
6e1a7b9
test(cleanroom): exercise authenticated reports and exit-zero bypass …
ruvnet Oct 9, 2026
fcbe078
test(cleanroom): include signed evidence and harness bypass regressio…
ruvnet Oct 9, 2026
1125ecc
fix(cleanroom): distinguish wrong trust key type from fingerprint mis…
ruvnet Oct 9, 2026
e24d6f7
docs(cleanroom): explain vector bypass remediation, v2 migration and …
ruvnet Oct 9, 2026
25e7905
docs(adr): record clean room exit-zero bypass, v2 vector accounting a…
ruvnet Oct 9, 2026
d80777c
docs(cleanroom): supersede exit-code-only evidence with ADR 142
ruvnet Oct 9, 2026
47efe9f
docs: surface hardened clean room evaluation and worker signed evidence
ruvnet Oct 9, 2026
0ac8d4f
security(cleanroom): reject reuse of Room A reviewer key for worker e…
ruvnet Oct 9, 2026
da04850
test(cleanroom): enforce independent reviewer and evaluator key roles
ruvnet Oct 9, 2026
c838af8
fix(cleanroom): require explicit TAP reporter across Node versions
ruvnet Oct 9, 2026
5feeaa2
test(cleanroom): assert pinned TAP reporter in Docker arguments
ruvnet Oct 9, 2026
86387c3
test(cleanroom): pin TAP reporter for Node 20, 22 and 24
ruvnet Oct 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ npm run cleanroom -- validate examples/clean-room/calculator.spec.json
# See docs/clean-room/README.md for the separate-room approval and scaffold commands.
```

**Optional offline Room B execution:** `sandbox-test` revalidates a separately pinned reviewer, public key and immutable Docker image, stages only three allowlisted files, and runs independent compatibility tests in a constrained local Docker container. This constrains evaluation, not the authoring agent or upstream source access. See the [isolated runner guide](docs/clean-room/README.md#optional-room-b-isolated-evaluation).
**Optional offline Room B execution:** `sandbox-test` revalidates the signed contract and independently pinned policy, stages only three allowlisted files, and runs each approved vector in a separate subprocess inside a restricted local Docker container. It requires complete vector accounting, and can produce a separately signed worker evidence report. This constrains evaluation, not the authoring agent or upstream source access. See the [isolated runner guide](docs/clean-room/README.md#optional-room-b-isolated-evaluation) and [ADR 142](docs/adr/ADR-142-vector-evidence-attestation.md).

**Important boundary:** The CLI does not provision independent OS identities, prevent covert data encoded inside permitted scalars, attest a human reviewer, establish a license exception, or prove functional equivalence. Independent source access isolation, human evidence review, and legal authorization are required before describing a deployment as clean room.

Expand Down
24 changes: 14 additions & 10 deletions docs/adr/ADR-141-room-b-isolated-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Add an **optional Linux-only Room B evaluation command** which fails closed unle

1. A versioned Room B trust policy independently pins an Ed25519 SPKI fingerprint, signed reviewer, target, immutable container image digest, maximum approval age and expiry time.
2. The signed handoff is verified again against the trusted public key and matching policy before touching any implementation or creating any worker directory.
3. Room B's project contains **exactly four expected scaffold files**. The approved contract, compatibility runner and approval summary must match the verified scaffold byte for byte. Only \`implementation.mjs\` may change. Symlinks, hardlinks, extra files, changed tests, changed contracts and size violations fail.
4. A temporary staging directory contains exactly \`contract.json\`, \`compat.test.mjs\` and \`implementation.mjs\`. The original project directory, signed artifact, public key, reviewer receipt, Room A sources, logs and credentials are **not mounted** in the container.
3. Room B's project contains **exactly four expected scaffold files**. The approved contract, compatibility runner and approval summary must match the verified scaffold byte for byte. Only `implementation.mjs` may change. Symlinks, hardlinks, extra files, changed tests, changed contracts and size violations fail.
4. A temporary staging directory contains exactly `contract.json`, `compat.test.mjs` and `implementation.mjs`. The original project directory, signed artifact, public key, reviewer receipt, Room A sources, logs and credentials are **not mounted** in the container.
5. Docker runs on the **local Linux Unix socket** only, with no network, read-only root and input bind, all Linux capabilities dropped, no-new-privileges, UID 65534, 64 PID limit, 256 MiB memory limit, one CPU and a 60-second subprocess deadline. The chosen digest must be already installed. No automatic pull is permitted at evaluation time.
6. The test runner executes only the independent implementation against the signed, allowlisted compatibility vectors. CLI writes a small JSON report outside the implementation tree with approval/spec digests, public-key fingerprint, implementation hash, runtime digest, vector count, outcome and hashes of captured stdout/stderr, without exposing raw logs.
7. Timed-out runs trigger Docker container removal. Cleanup failure is an error, not a successful result. Temporary stage files are removed on completion.
Expand All @@ -26,7 +26,7 @@ No Docker socket, agent credentials, Room A analysis output, entire repository,

## Data flow

\`\`\`text
```text
Room A Room B (separate tenant / VM)
original source trusted reviewer key and policy
| |
Expand All @@ -47,7 +47,7 @@ No Docker socket, agent credentials, Room A analysis output, entire repository,
|
v
hashed evaluation report (Room B)
\`\`\`
```

## Threats and residual risks

Expand All @@ -57,9 +57,9 @@ No Docker socket, agent credentials, Room A analysis output, entire repository,
| Mutated interface contract or test harness | Signature verification and byte-for-byte scaffold regeneration | Legitimate reviewer can approve undesirable data; covert encoding in permitted scalar vectors still possible |
| Stolen reviewer key / forged claimed review | Out-of-band fingerprint, target/reviewer allowlist, expiry and age window | No online revocation, hardware-backed custody or proof a human reviewed |
| Malicious model-generated code | Offline, read-only, unprivileged container and bounded resources | Docker daemon access is privileged; kernel/container escape, runtime supply-chain compromise and local host compromise remain |
| Docker image substitution | Room B trust policy fixes image by SHA256 digest; \`--pull=never\` | Trusted image acquisition/scan and digest policy governance are external |
| Docker image substitution | Room B trust policy fixes image by SHA256 digest; `--pull=never` | Trusted image acquisition/scan and digest policy governance are external |
| Host secrets through mounts | Staged copy is the only bind mount | Full docker daemon control on a host containing Room A data would still be unsafe |
| Report manipulation | Exclusive output with digests and fixed fields | Unsigned local report can be edited later; remote attestation and signed ledger are separate future controls |
| Report manipulation | Exclusive v2 report with optional worker-key Ed25519 attestation (ADR 142) | Unsigned reports remain editable; signatures do not prove a trustworthy host or legal independence |
| Unsafe inference that passed fixtures prove equivalence | Report records only vector count and pass/fail | Unseen inputs, stateful protocols, asynchronous behavior and performance are not covered |

## Safety invariants
Expand All @@ -80,14 +80,18 @@ Unit tests inject a fake Docker client to inspect mount arguments and staged fil

Run:

\`\`\`bash
```bash
npm run test:cleanroom
\`\`\`
```

The real Docker test is enabled when \`RUDEVOLUTION_TEST_IMAGE\` references a locally available, pinned image digest. It is intentionally skipped without that environment variable; the CI job supplies it.
The real Docker test is enabled when `RUDEVOLUTION_TEST_IMAGE` references a locally available, pinned image digest. It is intentionally skipped without that environment variable; the CI job supplies it.

These checks establish a narrow, reproducible execution boundary **for the evaluation run**, not source independence of the implementer or formal noninterference. Production use still requires a separate Room B OS identity or VM, operator-reviewed legal permissions, image security patching, isolated model context, key lifecycle and an external evidence ledger.

## Rollback

Disable \`sandbox-test\` and revert this runner/CI suite; v1 \`validate\`, \`approve\`, \`verify\` and \`scaffold\` remain unaffected. Revoke any exposed reviewer keys through an external trust policy and prevent reuse of old worker images.
Disable `sandbox-test` and revert this runner/CI suite; v1 `validate`, `approve`, `verify` and `scaffold` remain unaffected. Revoke any exposed reviewer keys through an external trust policy and prevent reuse of old worker images.

## Security follow-up: vector execution and evidence

[ADR 142](ADR-142-vector-evidence-attestation.md) supersedes the original exit-code-only evaluation criterion. The hardened runner isolates every approved vector in its own subprocess, verifies the final TAP vector count, and supports optional independent Ed25519 signing of the v2 evaluation report. The implementation author still needs an actually separate Room B context and an independent review of test sufficiency.
57 changes: 57 additions & 0 deletions docs/adr/ADR-142-vector-evidence-attestation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# ADR 142: Vector execution accounting and signed Room B evidence

Status: Accepted for clean room developer preview
Date: 2026-10-08
Dependencies: ADR 139, ADR 140, ADR 141

## Problem and observed failure

The prior generated `compat.test.mjs` imported `implementation.mjs` before registering the `node:test` vectors. An implementation containing only `process.exit(0)` could cause `node --test` to exit successfully without executing any approved compatibility vector. The v1 Docker evaluator treated exit code zero as success, so a malformed or adversarial Room B implementation could receive a passing report with no test evidence.

The signed specification handoff was not compromised; the failure was **untrusted implementer code controlling the test-harness lifecycle**. It also demonstrated why an exit code, successful harness startup, or self-reported result is not sufficient provenance.

The evaluator report also consisted of unsigned JSON. An operator or downstream process could alter counts, implementation digest or outcome without cryptographic detection.

## Decision

1. **Isolated vector subprocesses.** The trusted test runner never directly imports independent code. It reads the approved contract, verifies the contract hash, registers one test for each approved vector, then launches an individual short-lived Node subprocess that imports and calls one implementation operation. The untrusted child has a bounded input payload, isolated environment, 2-second timeout and 4 KiB output limit. It must emit exactly one primitive JSON outcome.
2. **Fail closed on premature exit.** `process.exit(0)`, forged TAP output, missing exports, malformed JSON, unexpected output, signals and timeouts cannot short circuit the parent test runner. The parent fails the corresponding vector.
3. **Independent counter verification.** After Docker exits, the host requires a complete Node TAP footer with exact `tests == pass == approved-vector-count`, and `fail == cancelled == skipped == todo == 0`. A zero exit code with absent, duplicate or incomplete counters becomes a failed evaluation.
4. **Versioned report.** `rudevolution.cleanroom.sandbox-report/v2` includes `executedVectors`, `passedVectors`, `policySha256`, and `harnessSha256`. These complement the existing approval, specification, implementation, runtime image and output-log hashes. Old unverified v1 reports are not silently promoted to v2.
5. **Optional worker-signed attestation.** After verified isolated execution and Docker cleanup, a separate Room B private Ed25519 key signs a canonical, domain-separated report commitment. The associated `rudevolution.cleanroom.evaluation-attestation/v1` envelope binds worker ID, signing time, report digest and public-key fingerprint. Independent verification requires an out-of-band trusted worker public key and expected approval digest.
6. **No original-source transfer.** Neither original source, analyst receipts, signer keys nor Room A knowledge are mounted in the isolated test container. The additional signing key resides only on the operator-controlled Room B host.

## Invariants

* **CR-10:** Every passing evaluation must have a matching count of actually registered and successful approved vectors.
* **CR-11:** Untrusted implementation code cannot terminate the trusted test parent via `process.exit(0)` in its own evaluation subprocess.
* **CR-12:** Signed evidence rejects modification of measured outcome, vector counts, approved-spec identity, implementation hash, harness hash, policy hash, runtime image and signing metadata.
* **CR-13:** The Room B worker attestation key is distinct from the independent Room A reviewer key, and never crosses the Docker mount boundary.

## Evidence limits

* These tests cover declared primitive operations and approved vectors, **not** complete API compatibility. Implementations can hardcode public vectors and still pass.
* The child subprocess shares the container's PID/user isolation domain. A malicious implementation may send signals to sibling processes. The report requires a trusted vector footer to pass, but this is not equivalent to process isolation across users, virtual machines or TEE attestation.
* Every vector starts a fresh child process, so the harness does not model cross-call state, session semantics, persistent storage, concurrency or performance.
* An Ed25519 evidence signature authenticates the signing key and the stated report bytes, not the honesty or integrity of the host evaluator. Host compromise or misuse of the worker signing key can yield a signed false claim.
* The initial protocol accepts only small primitive vectors. The signed contract can still carry covertly encoded information, so human review, DLP and legal authorization remain mandatory.
* Existing Room B scaffold test runners must be regenerated from an already approved artifact before the v2 evaluator can accept them. Only independently authored implementation code should be retained.

## Tests and promotion gate

From a clean checkout:

```bash
npm run test:cleanroom
npm test
```

The suite includes negative tests for premature exit, forged TAP, incomplete reports, modified signatures, forged worker identifiers, changed implementation hashes and wrong signing keys. The dedicated CI job runs an actual Docker implementation and checks the v2 counts and host signature. Local runs without a pinned Docker image intentionally skip the container smoke test.

### Acceptance

A synthetic `process.exit(0)` implementation must fail with zero verified vectors, while an independently supplied synthetic implementation passes all approved vectors. A modified signed outcome must fail independent worker-key verification. Node 22/24, Rust, dashboard and the Docker worker must pass CI before merge.

### Rollback

If optional evidence signing fails, disable only the signing mode while preserving the v2 subprocess harness and vector-accounting gate. **Do not revert to pre-v2 direct implementation import or exit-code-only pass criteria.** Revoke an exposed worker key through the organization's external trust system.
Loading
Loading