Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-mv/patches/0eed459c296ce854 # interplane-mv INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/interplane-mv#81 (code only) closed derived `0eed459c296ce854` #81 Imported from GitHub aien-dev/interplane-mv#81 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `a14a1c356c62dfcf9b8e3f94ee30aed6a44f36c4` · Head `16561b0d3814f7d06fb32594acee213a279ef00d` ### Apply it ``` git checkout -b patch-0eed459c296ce854 a14a1c356c62dfcf9b8e3f94ee30aed6a44f36c4 curl -fsSL https://interplane.io/drakestapleton/interplane-mv/patches/0eed459c296ce854.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/interplane-mv 81 16561b0d3814f7d06fb32594acee213a279ef00d ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"interplane-mv","number":81,"url":"https://github.com/aien-dev/interplane-mv/pull/81","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:12Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/STATUS.md b/STATUS.md index efd59e6..654019c 100644 --- a/STATUS.md +++ b/STATUS.md @@ -26,7 +26,7 @@ byte-identical) · `qualified` (measured against a real model/backend). | Source-class coverage (0.3 cut P4) | conformant | conformant | cases 31-40 | one fixture per source class asserting every InputRecord field; mock gains `read_document`, `load_skill`, `call_provider`; skills and tool descriptions are `external_untrusted`; host registers model_generated input | | Conformance runner | implemented | implemented | 45/45 both (40 cases + 5 lifecycle, verdicts byte-identical) | `--dump` writes canonical results per case | | Interplane Probe | qualified | qualified | - | both run live against Qwen3.5-9B/Ollama 0.34.0 with identical verdicts (reports under qualification/reports) | -| AIEN adapter | tested (on the real EffectAuthority path; approved writes through the authenticated daemon ledger route; pinned sovereign-core 8bcd79b (#262, #260); was 10 pipeline tests in 0.1) | - | - | ADR 0003; real aien-mcp SpeculativeLane + aegis gate; aien-cli SafetyEngine not linkable (private); AGPL | +| AIEN adapter | tested (on the real EffectAuthority path; approved writes through the authenticated daemon ledger route; pinned sovereign-core 4d4dfd4 (#296 daemon-minted grants only, #295 signed requirements goal; #262, #260); was 10 pipeline tests in 0.1) | - | - | ADR 0003; real aien-mcp SpeculativeLane + aegis gate; aien-cli SafetyEngine not linkable (private); AGPL | | Odysseus adapter | - | tested (70 tests vs odysseus@2992bf6) | - | executes read_file/ls/glob/grep via Odysseus handlers; approval continuation unsupported, every continuation refused (cut A4); AGPL | | Before/after receipt (0.1 goal) | - | qualified | 2 runs, reproduced | examples/receipt | | CrossAxis gate, 0.2 pre-registered (37 pairs, qwen3.5:9b on Ollama) | - | qualified: FAIL | bench/runs/qual-20261004T2207Z | T 0.877 PASS, S PASS (B 0.730 vs A 0.676), O1 0.865 FAIL, O2 0/5 FAIL; model did not use the discovery tool. See docs/REPORT-0.2.md. 0.2x held-out campaign (bench/PROTOCOL-0.2x.md) not run: runner prepared; arm 3 negative controls N1 and N2 (denied and approval-pending calls cause no expansion and no execution) tested offline in bench/tools/test_runner_offline.py | diff --git a/adapters/aien/Cargo.lock b/adapters/aien/Cargo.lock index 334c0d8..f2d044b 100644 --- a/adapters/aien/Cargo.lock +++ b/adapters/aien/Cargo.lock @@ -83,7 +83,7 @@ dependencies = [ [[package]] name = "aien-capability" version = "0.1.0" -source = "git+https://github.com/aien-dev/aien-sovereign-core.git?rev=8bcd79b406077a5901197bff01a634aa3085cd4e#8bcd79b406077a5901197bff01a634aa3085cd4e" +source = "git+https://github.com/aien-dev/aien-sovereign-core.git?rev=4d4dfd459ae7e7c6c175edc5017816d079c621a9#4d4dfd459ae7e7c6c175edc5017816d079c621a9" dependencies = [ "sha2 0.10.9", ] @@ -134,7 +134,7 @@ dependencies = [ [[package]] name = "aien-mcp" version = "0.1.0" -source = "git+https://github.com/aien-dev/aien-sovereign-core.git?rev=8bcd79b406077a5901197bff01a634aa3085cd4e#8bcd79b406077a5901197bff01a634aa3085cd4e" +source = "git+https://github.com/aien-dev/aien-sovereign-core.git?rev=4d4dfd459ae7e7c6c175edc5017816d079c621a9#4d4dfd459ae7e7c6c175edc5017816d079c621a9" dependencies = [ "aien-capability", "async-trait", @@ -761,7 +761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1671,7 +1671,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1941,7 +1941,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2300,7 +2300,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] diff --git a/adapters/aien/Cargo.toml b/adapters/aien/Cargo.toml index c2a55df..40da0d6 100644 --- a/adapters/aien/Cargo.toml +++ b/adapters/aien/Cargo.toml @@ -21,9 +21,9 @@ interplane-crossveil = { path = "../../rust/crates/interplane-crossveil" } serde_json = "1" sha2 = "0.10" tokio = { version = "1", features = ["rt"] } -# Pinned AIEN sources: aien-dev/aien-sovereign-core main at 8bcd79b (#262 merged: the authenticated ComposeApprovedProposal daemon command this adapter hands approved writes to; aien-capability and aien-mcp are byte-identical to 7d37da1, #260 merged: two-phase approval spend, reserve/commit/release, EffectLane::with_clock). Before that, aien-capability and aien-mcp were unchanged since 0bdc97a (PR #208: idempotency ledger bound to effect identity, revocable unspent grants; #207 exposure-aware authority; #204 single-use approvals). -aien-capability = { git = "https://github.com/aien-dev/aien-sovereign-core.git", rev = "8bcd79b406077a5901197bff01a634aa3085cd4e" } -aien-mcp = { git = "https://github.com/aien-dev/aien-sovereign-core.git", rev = "8bcd79b406077a5901197bff01a634aa3085cd4e" } +# Pinned AIEN sources: aien-dev/aien-sovereign-core main at 4d4dfd4 (#296 merged: the daemon honours only grants it minted itself, sovereign-core #261; #295 merged: an approved proposal carries a signed requirements goal and a missing one is refused, #289). aien-capability and aien-mcp are byte-identical to 8bcd79b (#262 merged: the authenticated ComposeApprovedProposal daemon command this adapter hands approved writes to; aien-capability and aien-mcp are byte-identical to 7d37da1, #260 merged: two-phase approval spend, reserve/commit/release, EffectLane::with_clock). Before that, aien-capability and aien-mcp were unchanged since 0bdc97a (PR #208: idempotency ledger bound to effect identity, revocable unspent grants; #207 exposure-aware authority; #204 single-use approvals). +aien-capability = { git = "https://github.com/aien-dev/aien-sovereign-core.git", rev = "4d4dfd459ae7e7c6c175edc5017816d079c621a9" } +aien-mcp = { git = "https://github.com/aien-dev/aien-sovereign-core.git", rev = "4d4dfd459ae7e7c6c175edc5017816d079c621a9" } # aegis-runtime cannot be a git dependency: its own Cargo.toml reaches a sibling checkout # (`../aien-protocols/crates/*`). Layout required (see README): next to this repository, # `interplane-audit/aegis-runtime` at f4e870953a466bb1cf68f1d88285929024cf1ba9 and diff --git a/adapters/aien/PINS b/adapters/aien/PINS index 0b0fd5e..6de1b0d 100644 --- a/adapters/aien/PINS +++ b/adapters/aien/PINS @@ -5,4 +5,4 @@ AEGIS_RUNTIME_REV=f4e870953a466bb1cf68f1d88285929024cf1ba9 AIEN_PROTOCOLS_REPO=https://github.com/aien-dev/aien-protocols.git AIEN_PROTOCOLS_REV=3a4cdbe8d360a2e1ddb3e8b108684048b9d4ba10 # Pinned in Cargo.toml (git dependency); CI checks that Cargo.toml and this line agree. -SOVEREIGN_CORE_REV=8bcd79b406077a5901197bff01a634aa3085cd4e +SOVEREIGN_CORE_REV=4d4dfd459ae7e7c6c175edc5017816d079c621a9 diff --git a/adapters/aien/README.md b/adapters/aien/README.md index 5d28e2b..f91573d 100644 --- a/adapters/aien/README.md +++ b/adapters/aien/README.md @@ -14,7 +14,7 @@ spent only by AIEN. Nothing under `rust/`, `spec/`, `python/` or ## Pinned AIEN sources `aien-capability` and `aien-mcp` are git dependencies pinned to -`aien-dev/aien-sovereign-core@8bcd79b406077a5901197bff01a634aa3085cd4e` (main 2026-10-07, omega.lock c0369e67, after PR #262 merged: the authenticated `ComposeApprovedProposal` daemon command the ledger route uses; `crates/aien-capability` and `crates/aien-mcp` are byte-identical to 7d37da1, after PR #260 merged: two-phase approval spend, a grant is reserved at mint, committed when the effect runs, released if the effect is dropped, and `EffectLane::with_clock` re-checks expiry at commit; before #260 `crates/aien-capability` and `crates/aien-mcp` are byte-identical to 0bdc97a, main after PR #208 merged, which binds the idempotency ledger to effect identity and lets an approver revoke an unspent grant; before it, PR #207 merged, +`aien-dev/aien-sovereign-core@4d4dfd459ae7e7c6c175edc5017816d079c621a9` (main 2026-10-07, after PR #296 merged: the daemon honours only grants it minted itself and refuses every caller-written authorization note, sovereign-core #261; and PR #295: an approved proposal carries a signed requirements goal, a missing one is refused, #289. `crates/aien-capability` and `crates/aien-mcp` are byte-identical to 8bcd79b, main after PR #262 merged: the authenticated `ComposeApprovedProposal` daemon command the ledger route uses; `crates/aien-capability` and `crates/aien-mcp` are byte-identical to 7d37da1, after PR #260 merged: two-phase approval spend, a grant is reserved at mint, committed when the effect runs, released if the effect is dropped, and `EffectLane::with_clock` re-checks expiry at commit; before #260 `crates/aien-capability` and `crates/aien-mcp` are byte-identical to 0bdc97a, main after PR #208 merged, which binds the idempotency ledger to effect identity and lets an approver revoke an unspent grant; before it, PR #207 merged, which makes the authority exposure-aware, on top of PR #204 single-use approvals and the PR #203 authority seam). `aegis` (feature `aegis-gate`, on by default) cannot be a git dependency because `aegis-runtime`'s own `Cargo.toml` reaches a sibling checkout by relative path @@ -170,10 +170,18 @@ not WALDO provenance and not a full provenance chain: trace_id and request_id ar Evidence: `tests/compose_ledger.rs` rows 1-8 (approved write with both hash identities, forged approval id, stale target, replay including a re-presented approval id, operator stop/resume, adapter restart, the T4 injection subset, forged handoffs) need `AIEN_BIN` (an `aien-cli` binary -built from sovereign-core main 8bcd79b, where #262 merged) and `cargo test -- --ignored`; rows 10 and 11 (#260 expiry and re-mint) likewise; row 9 (desk key out of the model's +built from sovereign-core main 4d4dfd4) and `cargo test -- --ignored`; rows 10 and 11 (#260 expiry and re-mint) likewise; row 9 (desk key out of the model's reach, key file rules) always runs. -Since sovereign-core #260 (in the pinned 8bcd79b): the effect lane is built `with_clock(host_clock())` +Recorded run at this pin (CPU evidence only, 2026-10-08 00:52Z to 00:58Z): `aien-cli` built from +sovereign-core 4d4dfd4 with the compose engine linked and the GPU engine not linked (build shows +`has_omega_compose`, not `has_omega_gpu`; the daemon logs `Backend: NativeTransformerBackend/CPU-reference`), +sha256 `279d38992b72f7c3f888d9b02c5ac7b26e57f6a47746c4e8107b2a9081ae4056`, model Llama-3.2-1B-Instruct +on the CPU reference backend. `tests/compose_ledger.rs` rows 1-8, 10, 11: 10 passed; `tests/compose_ledger_attacks.rs` +x1-x4: 4 passed. This is not GPU evidence and not native-OS evidence. A daemon built with the GPU engine +linked selects the GB10 backend whenever the chip is present, so build without `AIEN_OMEGA_DIR` for CPU runs. + +Since sovereign-core #260 (in 8bcd79b and the pinned 4d4dfd4): the effect lane is built `with_clock(host_clock())` (epoch seconds; `AienAuthority::set_clock` for tests), a grant presented while reserved is refused as `Reserved`, and a dropped effect releases its grant. On the ledger route the adapter holds the minted effect (and its reservation) while the daemon runs, checks the grant's expiry @@ -183,6 +191,15 @@ ledger is what spends the approval. Row 11: the released grant re-minted with th id is answered by the daemon with the original result (ALREADY_COMMITTED, no second compose) and refused by the adapter, with no second write. +Since sovereign-core #295 (in the pinned 4d4dfd4): every approved proposal the adapter hands the +daemon carries `requirements` and `requirements_mac`. The host approves the exact bytes of a +`write_file`, so there is no natural-language goal whose requirements the daemon could check; the +adapter binds the explicit "none" (`BOUND_REQUIREMENTS`, the empty goal), MACed with the desk key +under tag `aien.requirements.v1` over the same approval binding. A proposal without it is refused +(`RequirementsUnbound`, #289). Since #296 (#261): the daemon honours only grants it minted itself; +`tests/compose_ledger_attacks.rs` x1 and x3 present a caller-written authorization note and assert +the daemon refuses it (`sovereign-core #261`), the ledger gains no record and no effect is written. + ## Reimplemented, and why - **The workspace read provider** (`read_file`, `list_dir`) behind `MemoryWire`. AIEN ships no diff --git a/adapters/aien/src/compose_ledger.rs b/adapters/aien/src/compose_ledger.rs index 531a8a6..504e117 100644 --- a/adapters/aien/src/compose_ledger.rs +++ b/adapters/aien/src/compose_ledger.rs @@ -47,6 +47,15 @@ use crate::{AienShared, RUNTIME_ID}; pub const LEDGER_BOUNDARY: &str = "boundary = authenticated daemon handoff (ComposeApprovedProposal: desk MAC, durable replay claim) -> compose verify + AEGIS -> J-Space branch -> World commit -> Cortex promotion/evidence -> daemon-written grant on compose_proposal_sha256 -> effect intent -> write -> ack; the production effect path, not WALDO provenance"; /// Version tag inside every approval binding (sovereign-core `approved_auth`). pub const APPROVAL_BINDING_VERSION: &str = "aien.approval.v2"; +/// Domain tag of the requirements MAC (sovereign-core #295, `approved_auth::requirements_bytes`; +/// tag v1 = no bound requirement depends on the file the bytes replace). +pub const REQUIREMENTS_TAG_V1: &[u8] = b"aien.requirements.v1\0"; +/// The requirement goal this authority binds: empty, and signed. The host approves the exact +/// bytes of a `write_file`, so there is no natural-language goal whose measurable requirements the +/// daemon could check; an empty goal is the explicit "none" (a missing one is refused, #289). +/// Tag v2 (a goal whose requirement depends on the replaced file, signed with a base) is +/// deliberately not implemented: an empty goal never needs a base. +pub const BOUND_REQUIREMENTS: &str = ""; /// Approver recorded in the grant when the host names none. pub const DEFAULT_APPROVER: &str = "interplane-host"; @@ -184,6 +193,20 @@ impl DeskKey { .map(|x| format!("{x:02x}")) .collect() } + + /// `requirements_mac` for `b` and the bound goal `goal` (tag v1, no base): HMAC-SHA256 over + /// the tag, the binding bytes, a zero byte, a one byte (goal present), the goal bytes. + pub fn requirements_mac(&self, b: &ApprovalBinding, goal: &str) -> String { + let mut m = REQUIREMENTS_TAG_V1.to_vec(); + m.extend(b.bytes()); + m.push(0); + m.push(1); + m.extend(goal.as_bytes()); + hmac_sha256(&self.key, &m) + .iter() + .map(|x| format!("{x:02x}")) + .collect() + } } impl Drop for DeskKey { @@ -559,7 +582,8 @@ impl ComposeLedgerAuthority { let proposal = json!({"request_id": rid, "trace_id": trace_id, "approval_id": approval_id, "approver": approver, "path": path, "content": content, "approved_proposal_sha256": approved_sha, "content_sha256": content_sha256, - "approval_mac": desk.mac(&binding)}); + "approval_mac": desk.mac(&binding), "requirements": BOUND_REQUIREMENTS, + "requirements_mac": desk.requirements_mac(&binding, BOUND_REQUIREMENTS)}); drop(desk); let client = self.client(); let mut rc = json!({"boundary": LEDGER_BOUNDARY, "trace_id": trace_id, "request_id": rid, @@ -977,4 +1001,43 @@ mod tests { assert_eq!(mode(&t), m, "mode of an existing {m:o} target"); } } + + /// Golden vectors, computed outside this crate (`openssl dgst -sha256 -mac HMAC`) over the + /// bytes sovereign-core `approved_auth` signs, so a change to a tag, a separator or the + /// binding's field order fails here and not only in the `--ignored` real-daemon run. + #[test] + fn desk_macs_match_fixed_vectors() { + let key: [u8; 32] = std::array::from_fn(|i| i as u8); + let desk = DeskKey { + key, + id: "0123456789abcdef".into(), + }; + let b = ApprovalBinding { + trace_id: "t-1".into(), + request_id: "r-1".into(), + approval_id: "A-1".into(), + approver: "host".into(), + path: "/ws/a.txt".into(), + content_sha256: "cc".into(), + approved_proposal_sha256: "bb".into(), + desk_key_id: "0123456789abcdef".into(), + workspace: "/ws".into(), + }; + assert_eq!( + String::from_utf8(b.bytes()).unwrap(), + r#"{"approval_id":"A-1","approved_proposal_sha256":"bb","approver":"host","content_sha256":"cc","desk_key_id":"0123456789abcdef","path":"/ws/a.txt","request_id":"r-1","trace_id":"t-1","v":"aien.approval.v2","workspace":"/ws"}"# + ); + assert_eq!( + desk.mac(&b), + "314669cd8b3848f7c92f8354cda5265b14051902e944e5ef464ed5bb216604d9" + ); + assert_eq!( + desk.requirements_mac(&b, BOUND_REQUIREMENTS), + "467f2dfe43034b856ec7e9ecb80643410eac39d4520f6c62bda55a17a12d248a" + ); + assert_eq!( + desk.requirements_mac(&b, "two lines"), + "d29340b1c0661149dcc337aebad1866fe71cdb33bd1718e9cfcdda55d1347bf1" + ); + } } diff --git a/adapters/aien/src/lib.rs b/adapters/aien/src/lib.rs index d257e54..1cdb780 100644 --- a/adapters/aien/src/lib.rs +++ b/adapters/aien/src/lib.rs @@ -32,7 +32,8 @@ use serde_json::{json, Map, Value}; pub mod compose_ledger; pub use compose_ledger::{ hmac_sha256, ApprovalBinding, ComposeLedgerAuthority, DeskKey, LedgerClient, - APPROVAL_BINDING_VERSION, DEFAULT_APPROVER, LEDGER_BOUNDARY, + APPROVAL_BINDING_VERSION, BOUND_REQUIREMENTS, DEFAULT_APPROVER, LEDGER_BOUNDARY, + REQUIREMENTS_TAG_V1, }; /// Runtime id carried in every decision, result and catalog. diff --git a/adapters/aien/tests/compose_ledger.rs b/adapters/aien/tests/compose_ledger.rs index 1ca0678..507f2cd 100644 --- a/adapters/aien/tests/compose_ledger.rs +++ b/adapters/aien/tests/compose_ledger.rs @@ -277,7 +277,8 @@ fn handoff(key: Option<&DeskKey>, b: &ApprovalBinding, content: &str) -> Value { json!({"request_id": b.request_id, "trace_id": b.trace_id, "approval_id": b.approval_id, "approver": b.approver, "path": b.path, "content": content, "approved_proposal_sha256": b.approved_proposal_sha256, "content_sha256": b.content_sha256, - "approval_mac": key.map(|k| k.mac(b)).unwrap_or_default()}) + "approval_mac": key.map(|k| k.mac(b)).unwrap_or_default(), "requirements": BOUND_REQUIREMENTS, + "requirements_mac": key.map(|k| k.requirements_mac(b, BOUND_REQUIREMENTS)).unwrap_or_default()}) } fn binding( diff --git a/adapters/aien/tests/compose_ledger_attacks.rs b/adapters/aien/tests/compose_ledger_attacks.rs index 38a57d4..c586e40 100644 --- a/adapters/aien/tests/compose_ledger_attacks.rs +++ b/adapters/aien/tests/compose_ledger_attacks.rs @@ -165,6 +165,22 @@ fn count(c: &LedgerClient) -> u64 { a } +/// Every `effect` record in the journal, whatever grant it names. +fn all_effects(c: &LedgerClient) -> usize { + // Effect phase records (intent, ack) on any grant. The daemon also writes + // effect-class bookkeeping (replay claims, compose-commit records), which + // carry no `phase` and are not effects. + let r = c.recall(&[], None).unwrap(); + r["host"] + .as_array() + .unwrap() + .iter() + .filter(|h| h["note"] == "effect") + .filter_map(|h| serde_json::from_str::(h["text"].as_str()?).ok()) + .filter(|t| t.get("phase").is_some()) + .count() +} + /// Host records of kind `effect` that name authorization `grant`. fn effects_for(c: &LedgerClient, grant: u64) -> Vec { let r = c.recall(&[], None).unwrap(); @@ -258,7 +274,8 @@ fn handoff(key: Option<&DeskKey>, b: &ApprovalBinding, content: &str) -> Value { json!({"request_id": b.request_id, "trace_id": b.trace_id, "approval_id": b.approval_id, "approver": b.approver, "path": b.path, "content": content, "approved_proposal_sha256": b.approved_proposal_sha256, "content_sha256": b.content_sha256, - "approval_mac": key.map(|k| k.mac(b)).unwrap_or_default()}) + "approval_mac": key.map(|k| k.mac(b)).unwrap_or_default(), "requirements": BOUND_REQUIREMENTS, + "requirements_mac": key.map(|k| k.requirements_mac(b, BOUND_REQUIREMENTS)).unwrap_or_default()}) } fn binding( @@ -344,16 +361,18 @@ fn lock() -> std::sync::MutexGuard<'static, ()> { } /// The old route: a caller notes its own `authorization` grant (workspace, path, confined -/// target, compose-form digest) for exactly the write the host will approve. Returns its id. -fn client_minted(c: &LedgerClient, ws: &str, path: &str, content: &str) -> u64 { +/// target, compose-form digest) for exactly the write the host will approve. Since +/// sovereign-core #261 (#296) the daemon refuses every caller-written `authorization` note; +/// returns the refusal text. +fn client_minted(c: &LedgerClient, ws: &str, path: &str, content: &str) -> String { let target = Path::new(ws).join(path).to_str().unwrap().to_string(); let text = json!({"proposal_sha256": compose_sha(path, content), "path": path, "content_sha256": hex(content.as_bytes()), "approver": "attacker", "workspace": ws, "target": target, "prior_sha256": null}); - let n = c - .note("authorization", &text.to_string(), &[]) - .expect("the daemon still accepts a client-minted grant note (sc#261)"); - n["id"].as_u64().unwrap() + match c.note("authorization", &text.to_string(), &[]) { + Ok(n) => panic!("ATTACK SUCCEEDED: the daemon accepted a client-minted grant note: {n}"), + Err(e) => e, + } } /// Host approves `id`; the outcome as (Ok?, error text). A pipeline refusal counts as not Ok. @@ -372,9 +391,10 @@ fn approve_outcome(p: &mut Pipeline<'_>, l: &ComposeLedgerAuthority, id: &str) - } } -/// Item (1): a client-minted grant for exactly the approved write is in the journal, and the -/// daemon refuses the handoff (the request id was already claimed). Nothing is written, no -/// intent opens on the client grant, the adapter does not fall back to it. +/// Item (1): a client-minted grant note for exactly the approved write is refused by the daemon +/// (sovereign-core #261), and the daemon refuses the handoff (the request id was already +/// claimed). Nothing is written, no intent opens on the client grant, the adapter does not +/// fall back to it. #[test] #[ignore = "NOT_RUN unless AIEN_BIN names an aien-cli binary: run with --ignored"] fn x1_client_minted_grant_unused_when_the_handoff_refuses() { @@ -383,7 +403,17 @@ fn x1_client_minted_grant_unused_when_the_handoff_refuses() { let c = d.client(); let ws = d.ws().to_str().unwrap().to_string(); let path = "minted.txt"; + let before_note = count(&c); let minted = client_minted(&c, &ws, path, EXPECTED); + assert!( + minted.contains("sovereign-core #261"), + "client-minted note refused for another reason: {minted}" + ); + assert_eq!( + count(&c), + before_note, + "a refused client-minted note appended records" + ); // Request id m1 is claimed first by a real, desk-signed handoff for other content. let k = DeskKey::load(&d.desk()).unwrap(); let b = binding( @@ -411,9 +441,10 @@ fn x1_client_minted_grant_unused_when_the_handoff_refuses() { !d.ws().join(path).exists(), "ATTACK SUCCEEDED: file written" ); - assert!( - effects_for(&c, minted).is_empty(), - "ATTACK SUCCEEDED: an effect names the client-minted grant" + assert_eq!( + all_effects(&c), + 0, + "ATTACK SUCCEEDED: an effect record exists" ); assert_eq!(l.grants_minted(), 0); assert_eq!(count(&c), before, "a refused handoff appended records"); @@ -451,8 +482,8 @@ fn x2_no_fallback_write_when_the_daemon_is_gone() { println!("x2: PASS refused: {err}"); } -/// The effect names the daemon's own grant and the compose-form digest, never a client-minted -/// grant for the same write that sits in the journal first. +/// The effect names the daemon's own grant and the compose-form digest; a client-minted grant +/// note for the same write is refused first (sovereign-core #261), so no other grant exists. #[test] #[ignore = "NOT_RUN unless AIEN_BIN names an aien-cli binary: run with --ignored"] fn x3_effect_uses_the_daemon_grant_not_a_client_one() { @@ -461,6 +492,7 @@ fn x3_effect_uses_the_daemon_grant_not_a_client_one() { let c = d.client(); let ws = d.ws().to_str().unwrap().to_string(); let minted = client_minted(&c, &ws, "summary.txt", EXPECTED); + assert!(minted.contains("sovereign-core #261"), "{minted}"); let l = ledger(&d); let mut rt = l.clone(); let mut p = pipe(&mut rt, &l); @@ -470,20 +502,23 @@ fn x3_effect_uses_the_daemon_grant_not_a_client_one() { let rc = l.receipts().last().cloned().unwrap(); let grant = rc["grant_id"].as_u64().unwrap(); assert_eq!(rc["handoff"]["approved_grant"], json!(grant)); - assert_ne!(grant, minted, "ATTACK SUCCEEDED: the client grant was used"); let g = &records(&c, &[grant])[0]; assert_eq!(g["text"]["approved_grant"], 1, "the daemon wrote the grant"); let csha = compose_sha("summary.txt", EXPECTED); assert_eq!(rc["proposal_sha256"], json!(csha)); assert_eq!(rc["handoff"]["state"], "COMMITTED"); - assert!(effects_for(&c, minted).is_empty()); assert_eq!( effects_for(&c, grant).len(), 2, "intent + ack on the daemon grant" ); + assert_eq!( + all_effects(&c), + 2, + "an effect names a grant other than the daemon's" + ); assert_eq!(rc["state"], "DONE"); - println!("x3: PASS grant #{grant} (client-minted #{minted} unused)"); + println!("x3: PASS grant #{grant} (client-minted note refused: {minted})"); } /// The write's temporary file has a predictable name in the target directory. Planted there as a ```