diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 610fad182..5e95111dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -850,6 +850,15 @@ jobs: python -m pip install maturin==1.9.6 npm ci --prefix bindings/typescript - run: cargo xtask ci compliance + - name: Verify interrupted demo state and viewer publication + timeout-minutes: 3 + run: | + node bindings/typescript/node_modules/typescript/bin/tsc -p demos/cross-company-incident-response/northstar-service/tsconfig.json + node --test demos/cross-company-incident-response/northstar-service/tests/state-ownership.mjs + node bindings/typescript/node_modules/typescript/bin/tsc -p demos/cross-company-incident-response/control-room/tsconfig.json + node demos/cross-company-incident-response/control-room/build.mjs + git diff --exit-code -- demos/cross-company-incident-response/control-room/public/app.js + node --input-type=module -e 'import { viewerScopeContract } from "./demos/cross-company-incident-response/tests/viewer-scope-contract.mjs"; await viewerScopeContract();' - name: Preserve compliance evidence if: always() && hashFiles('target/compliance/**') != '' uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 diff --git a/AGENTS.md b/AGENTS.md index 1a90178e0..ae253ea8c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -340,6 +340,12 @@ late-completion, cleanup failure/retry, and resource-publication behavior. A terminal flag must not stand in for unfinished cleanup, and an error or cancellation must not be treated as proof of non-effect. +Resource and pathname ownership must span admission, publication, actual work, +and cleanup; a stale destructor must not remove a successor's resource. A file +replacement can succeed before persistence reports failure. Continuing in the +same process after that uncertainty requires explicit invalidation or an +authoritative reload, not continued decisions from a stale memory snapshot. + Keep one semantic authority for each managed transition. Extend the existing kernel, journal, or resource owner; do not add a parallel executor, recovery ledger, or universal lifecycle framework. Persist necessary recovery facts diff --git a/Cargo.lock b/Cargo.lock index 3f71dfbcf..87021aafe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1278,7 +1278,10 @@ dependencies = [ "auths-proof-exchange-codec", "auths-proof-exchange-model", "auths-proof-exchange-port", + "rcgen", "reqwest", + "rustls", + "tokio", ] [[package]] diff --git a/architecture/dependency-graph.json b/architecture/dependency-graph.json index 97cb516ef..315d781d2 100644 --- a/architecture/dependency-graph.json +++ b/architecture/dependency-graph.json @@ -8797,6 +8797,18 @@ "default_features": true, "features": [] }, + { + "source": "auths-proof-exchange-https", + "source_layer": "exchange", + "target": "rcgen", + "target_layer": null, + "scope": "external", + "kind": "dev", + "target_condition": null, + "optional": false, + "default_features": true, + "features": [] + }, { "source": "auths-proof-exchange-https", "source_layer": "exchange", @@ -8814,6 +8826,43 @@ "rustls" ] }, + { + "source": "auths-proof-exchange-https", + "source_layer": "exchange", + "target": "rustls", + "target_layer": null, + "scope": "external", + "kind": "dev", + "target_condition": null, + "optional": false, + "default_features": false, + "features": [ + "ring", + "std", + "tls12" + ] + }, + { + "source": "auths-proof-exchange-https", + "source_layer": "exchange", + "target": "tokio", + "target_layer": null, + "scope": "external", + "kind": "dev", + "target_condition": null, + "optional": false, + "default_features": true, + "features": [ + "fs", + "io-util", + "macros", + "net", + "rt-multi-thread", + "signal", + "sync", + "time" + ] + }, { "source": "auths-proof-exchange-iroh", "source_layer": "exchange", diff --git a/bindings/python-adapters/sqlite/README.md b/bindings/python-adapters/sqlite/README.md index 39401081c..cab588803 100644 --- a/bindings/python-adapters/sqlite/README.md +++ b/bindings/python-adapters/sqlite/README.md @@ -5,3 +5,13 @@ transactions. It provides durable first-use, exact-replay, and conflict decisions without exposing Auths lifecycle or authorization semantics. + +An admitted reservation retains its worker until the SQLite transaction settles. +Cancelling the caller only detaches its wait; it does not imply rollback. +`aclose()` stops new reservations and joins all admitted work. Concurrent close +callers share that drain, and cancelling one close waiter does not cancel it. +A successful close means no work from that instance can commit later. `reopen()` +creates a separate instance over the same database. +Admission validates bounded builtin fields and retains immutable copies of +commitment and value bytes before scheduling the worker. Mutating a caller's +bytearray after admission cannot change the reserved record. diff --git a/bindings/python-adapters/sqlite/python/auths_sqlite/__init__.py b/bindings/python-adapters/sqlite/python/auths_sqlite/__init__.py index b8147bc22..226a9029e 100644 --- a/bindings/python-adapters/sqlite/python/auths_sqlite/__init__.py +++ b/bindings/python-adapters/sqlite/python/auths_sqlite/__init__.py @@ -5,15 +5,27 @@ import asyncio import sqlite3 from pathlib import Path -from typing import Literal, Union +from typing import Literal, Optional, Set, Union from auths.adapters.reservations import ReservationRecord +_Decision = Literal["acquired", "exact-replay", "conflict"] + + class SQLiteAtomicReservationStore: + """Own admitted transactions independently of their callers. + + Cancelling a reserve waiter does not certify rollback: its worker still + settles. Close stops admission and shares one drain operation; cancelling + a close waiter leaves that operation running. Closed means quiescent. + """ + def __init__(self, path: Union[str, Path]) -> None: self._path = str(Path(path)) - self._closed = False + self._state: Literal["open", "closing", "closed"] = "open" + self._workers: Set[asyncio.Task[_Decision]] = set() + self._closing: Optional[asyncio.Task[None]] = None self._initialize() @property @@ -31,24 +43,64 @@ def durability(self) -> Literal["single-machine-durable"]: async def reserve( self, record: ReservationRecord ) -> Literal["acquired", "exact-replay", "conflict"]: - if self._closed: + if self._state != "open": raise RuntimeError("atomic reservation store is closed") + if type(record) is not ReservationRecord: + raise ValueError("invalid atomic reservation") + key, commitment, value = record.key, record.commitment, record.value if ( - type(record) is not ReservationRecord - or not record.key - or len(record.key.encode()) > 256 - or len(record.commitment) != 32 - or not record.value - or len(record.value) > 262_144 + type(key) is not str + or not key + or len(key) > 256 + or len(key.encode()) > 256 + or type(commitment) not in (bytes, bytearray) + or len(commitment) != 32 + or type(value) not in (bytes, bytearray) + or not value + or len(value) > 262_144 ): raise ValueError("invalid atomic reservation") + # A frozen record can still contain caller-owned bytearrays. Validate + # exact bounded builtins before copying; no hostile conversion callback + # or caller buffer may cross the admitted worker boundary. + snapshot = ReservationRecord(key, bytes(commitment), bytes(value)) + # Even an eager task factory must wait until ownership is registered + # before it can submit foreign work to the thread pool. + start: asyncio.Future[None] = asyncio.get_running_loop().create_future() + worker = asyncio.create_task(self._reserve_owned(snapshot, start)) + self._workers.add(worker) + worker.add_done_callback(self._settled) + start.set_result(None) + return await asyncio.shield(worker) + + async def _reserve_owned( + self, record: ReservationRecord, start: asyncio.Future[None] + ) -> _Decision: + await start return await asyncio.to_thread(self._reserve, record) + def _settled(self, worker: asyncio.Task[_Decision]) -> None: + self._workers.discard(worker) + # Consume failures even after the last reservation waiter detached. + if not worker.cancelled(): + worker.exception() + async def reopen(self) -> SQLiteAtomicReservationStore: return SQLiteAtomicReservationStore(self._path) async def aclose(self) -> None: - self._closed = True + if self._state == "open": + self._state = "closing" + self._closing = asyncio.create_task(self._drain()) + closing = self._closing + if closing is not None: + await asyncio.shield(closing) + + async def _drain(self) -> None: + # Closing prevents new admission; this cohort contains every worker + # that can still mutate the database on behalf of this instance. + await asyncio.gather(*tuple(self._workers), return_exceptions=True) + self._state = "closed" def _connect(self) -> sqlite3.Connection: connection = sqlite3.connect(self._path, timeout=5, isolation_level=None) diff --git a/bindings/python-adapters/sqlite/tests/test_sqlite_store.py b/bindings/python-adapters/sqlite/tests/test_sqlite_store.py index 771ddd691..3dd17b831 100644 --- a/bindings/python-adapters/sqlite/tests/test_sqlite_store.py +++ b/bindings/python-adapters/sqlite/tests/test_sqlite_store.py @@ -1,5 +1,9 @@ from __future__ import annotations +import asyncio +import gc +import sqlite3 +import threading from pathlib import Path import pytest @@ -28,3 +32,144 @@ def factory(name: str) -> SQLiteAtomicReservationStore: ) == "conflict" ) + + +class CommitBarrierStore(SQLiteAtomicReservationStore): + """Use a real transaction, held immediately before its commit.""" + + def __init__(self, path: Path, *, fail: bool = False) -> None: + self.entered = threading.Event() + self.release = threading.Event() + self.fail = fail + super().__init__(path) + + def _connect(self) -> sqlite3.Connection: + owner = self + + class Connection(sqlite3.Connection): + def execute(self, sql, parameters=()): + if sql == "COMMIT": + owner.entered.set() + if not owner.release.wait(5): + raise TimeoutError("test did not release the commit barrier") + if owner.fail: + raise sqlite3.OperationalError("injected commit failure") + return super().execute(sql, parameters) + + connection = sqlite3.connect( + self._path, timeout=5, isolation_level=None, factory=Connection + ) + connection.execute("PRAGMA busy_timeout = 5000") + return connection + + async def wait_for_commit(self) -> None: + assert await asyncio.wait_for(asyncio.to_thread(self.entered.wait, 5), 6) + + +@pytest.mark.asyncio +async def test_close_joins_actual_reservation_commit(tmp_path: Path) -> None: + store = CommitBarrierStore(tmp_path / "closing.sqlite3") + record = ReservationRecord("owned", bytes([3]) * 32, b"original") + reserve = asyncio.create_task(store.reserve(record)) + try: + await store.wait_for_commit() + first = asyncio.create_task(store.aclose()) + second = asyncio.create_task(store.aclose()) + await asyncio.sleep(0) # Run both admitted close waiters; no clock delay. + assert not first.done() and not second.done() + with pytest.raises(RuntimeError, match="closed"): + await store.reserve(record) + store.release.set() + assert await asyncio.wait_for(reserve, 6) == "acquired" + await asyncio.wait_for(asyncio.gather(first, second), 6) + with pytest.raises(RuntimeError, match="closed"): + await store.reserve(record) + reopened = await store.reopen() + try: + assert await reopened.reserve(record) == "exact-replay" + finally: + await reopened.aclose() + finally: + store.release.set() + await store.aclose() + + +@pytest.mark.asyncio +@pytest.mark.parametrize("fail", [False, True]) +async def test_cancelled_waiters_retain_worker_and_shared_close( + tmp_path: Path, fail: bool +) -> None: + store = CommitBarrierStore(tmp_path / "detached.sqlite3", fail=fail) + record = ReservationRecord("detached", bytes([4]) * 32, b"retained") + loop = asyncio.get_running_loop() + previous_handler = loop.get_exception_handler() + unhandled = [] + loop.set_exception_handler(lambda _loop, context: unhandled.append(context)) + reserve = asyncio.create_task(store.reserve(record)) + try: + await store.wait_for_commit() + reserve.cancel() + with pytest.raises(asyncio.CancelledError): + await reserve + cancelled_close = asyncio.create_task(store.aclose()) + remaining_close = asyncio.create_task(store.aclose()) + await asyncio.sleep(0) + cancelled_close.cancel() + with pytest.raises(asyncio.CancelledError): + await cancelled_close + assert not remaining_close.done() + store.release.set() + await asyncio.wait_for(remaining_close, 6) + reopened = await store.reopen() + try: + assert await reopened.reserve(record) == ( + "acquired" if fail else "exact-replay" + ) + finally: + await reopened.aclose() + gc.collect() + await asyncio.sleep(0) + assert unhandled == [] + finally: + store.release.set() + await store.aclose() + loop.set_exception_handler(previous_handler) + + +@pytest.mark.asyncio +async def test_admitted_worker_retains_private_bounded_record(tmp_path: Path) -> None: + entered, release = threading.Event(), threading.Event() + + class EntryBarrierStore(SQLiteAtomicReservationStore): + def _reserve(self, record): + entered.set() + if not release.wait(5): + raise TimeoutError("test did not release the worker barrier") + return super()._reserve(record) + + store = EntryBarrierStore(tmp_path / "snapshot.sqlite3") + commitment = bytearray([7]) * 32 + value = bytearray(b"original") + # Runtime callers can pass mutable bytes despite the frozen dataclass's + # annotations; its admission snapshot must precede foreign worker code. + reserve = asyncio.create_task(store.reserve(ReservationRecord("snapshot", commitment, value))) + try: + assert await asyncio.wait_for(asyncio.to_thread(entered.wait, 5), 6) + commitment[:] = bytes([8]) * 32 + value[:] = b"rewritten" + release.set() + assert await asyncio.wait_for(reserve, 6) == "acquired" + await store.aclose() + reopened = await store.reopen() + try: + assert await reopened.reserve( + ReservationRecord("snapshot", bytes([7]) * 32, b"original") + ) == "exact-replay" + assert await reopened.reserve( + ReservationRecord("snapshot", bytes(commitment), bytes(value)) + ) == "conflict" + finally: + await reopened.aclose() + finally: + release.set() + await store.aclose() diff --git a/bindings/typescript/src/internal/signing.ts b/bindings/typescript/src/internal/signing.ts index f94c49e34..dfe22315f 100644 --- a/bindings/typescript/src/internal/signing.ts +++ b/bindings/typescript/src/internal/signing.ts @@ -169,7 +169,21 @@ export class SigningCoordinator { ); } this.#consumed = true; - if (this.#now() > options.expiresAt) { + // One operation owns its original deadline and a nondecreasing observed + // clock through approval and signature acceptance. Custody may already + // have signed when expiry is observed; refusing completion does not undo it. + const expiresAt = options.expiresAt; + const objectKind = options.objectKind; + const signer = options.signer; + const approval = options.approval; + const signal = options.signal; + let observed = this.#now(); + const now = () => { + const sampled = this.#now(); + if (sampled > observed) observed = sampled; + return observed; + }; + if (observed > expiresAt) { throw new AuthsWorkflowError( "transaction-expired", "signing transaction expired before provider use", @@ -202,7 +216,7 @@ export class SigningCoordinator { let native: NativeSigningRequest; try { native = this.#adapter.prepare( - options.objectKind, + objectKind, unsignedObject.slice(), principal, ); @@ -214,7 +228,7 @@ export class SigningCoordinator { } try { - if (native.objectKind !== options.objectKind) { + if (native.objectKind !== objectKind) { throw new AuthsWorkflowError( "signer-response-mismatch", "native authoring returned a different object kind", @@ -232,28 +246,28 @@ export class SigningCoordinator { const requestId = boundedRequestId(native.requestId); await approveExact( - options, + { ...options, objectKind, expiresAt, signer, approval, ...(signal === undefined ? {} : { signal }) }, requiredApproval, requestId, transactionDigest, display, - this.#now, + now, ); - if (this.#now() > options.expiresAt) { + if (now() > expiresAt) { throw new AuthsWorkflowError( "transaction-expired", "signing transaction expired before signer use", ); } - const response = await callSigner(options.signer, { + const response = await callSigner(signer, { requestId, - objectKind: options.objectKind, + objectKind, objectId: objectId.slice(), principal: copyPrincipal(principal), transactionDigest: transactionDigest.slice(), signingPreimage: signingPreimage.slice(), - expiresAt: options.expiresAt, + expiresAt, display: copyDisplay(display), }); const { signature, evidence } = consumeSigningResponse( @@ -262,11 +276,17 @@ export class SigningCoordinator { principal, transactionDigest, ); + if (now() > expiresAt) { + throw new AuthsWorkflowError( + "transaction-expired", + "signing transaction expired during signer use", + ); + } let signedObject: Uint8Array; try { signedObject = boundedBytes( this.#adapter.complete( - options.objectKind, + objectKind, unsignedObject.slice(), principal, signature.slice(), diff --git a/bindings/typescript/test/helpers/signing-deadline-contract.mjs b/bindings/typescript/test/helpers/signing-deadline-contract.mjs new file mode 100644 index 000000000..1e262f710 --- /dev/null +++ b/bindings/typescript/test/helpers/signing-deadline-contract.mjs @@ -0,0 +1,78 @@ +import assert from "node:assert/strict"; + +function deferred() { + let resolve; + const promise = new Promise((yes) => { resolve = yes; }); + return { promise, resolve }; +} + +/** Shared by source and installed-package tests; no WASM fixture is required. */ +export async function signingDeadlineContract(t, { SigningCoordinator }) { + for (const completionTime of [200n, 201n]) { + await t.test(`T1: signer completion at ${completionTime} owns deadline acceptance`, async () => { + let now = 100n; + let completions = 0; + let freed = 0; + const entered = deferred(); + const signed = deferred(); + const principal = { principal: "did:web:signing.example", principalMethod: "did-web-v1", + verificationMethod: "did:web:signing.example#key", suite: "ed25519-v1" }; + const policy = { policyId: "deadline", evaluatorVersion: "1", configurationDigest: new Uint8Array(32).fill(1) }; + const options = { + objectKind: "grant", unsignedObject: new Uint8Array([0xa0]), principal, + expiresAt: 200n, display: [{ label: "Grant", value: "bounded" }], + requiredApproval: policy, + approval: { + policy: { reference: policy, mode: "grant-only", maxUses: 1, expiresInSeconds: 100, requirements: [] }, + provider: { async approve(request) { return { ...request, decision: "approved" }; } }, + }, + signer: { + async sign(request) { entered.resolve(request); return signed.promise; }, + }, + }; + const owner = new SigningCoordinator({ + prepare(objectKind) { return { objectKind, requestId: "owned-grant", objectId: new Uint8Array(32).fill(2), + transactionDigest: new Uint8Array(32).fill(3), signingPreimage: new Uint8Array([4]), + free() { freed++; } }; }, + complete() { completions++; return new Uint8Array([5]); }, + }, () => now); + const pending = owner.execute(options); + const request = await entered.promise; + now = completionTime; + // Roll the clock back from the first observed expiry before retrying. + const outcome = completionTime > 200n + ? assert.rejects(pending, (error) => error.code === "transaction-expired") + : pending; + signed.resolve({ requestId: request.requestId, principal: request.principal, + transactionDigest: request.transactionDigest, signature: new Uint8Array(64).fill(6) }); + await outcome; + assert.equal(completions, completionTime === 200n ? 1 : 0); + assert.equal(freed, 1); + now = 1n; + await assert.rejects(owner.execute(options), (error) => error.code === "transaction-consumed"); + assert.equal(completions, completionTime === 200n ? 1 : 0); + }); + } + + await t.test("T1: rollback during approval cannot lower the signer's retained clock", async () => { + const samples = [100n, 199n, 50n, 201n]; + let completed = false; + const principal = { principal: "did:web:clock.example", principalMethod: "did-web-v1", + verificationMethod: "did:web:clock.example#key", suite: "ed25519-v1" }; + const policy = { policyId: "clock", evaluatorVersion: "1", configurationDigest: new Uint8Array(32) }; + const owner = new SigningCoordinator({ + prepare(objectKind) { return { objectKind, requestId: "clock-grant", objectId: new Uint8Array(32), + transactionDigest: new Uint8Array(32), signingPreimage: new Uint8Array([1]) }; }, + complete() { completed = true; return new Uint8Array([2]); }, + }, () => { assert.ok(samples.length); return samples.shift(); }); + await assert.rejects(owner.execute({ + objectKind: "grant", unsignedObject: new Uint8Array([0xa0]), principal, expiresAt: 200n, + requiredApproval: policy, display: [], + approval: { policy: { reference: policy, mode: "grant-only", maxUses: 1, expiresInSeconds: 100, requirements: [] }, + provider: { async approve(request) { return { ...request, decision: "approved" }; } } }, + signer: { async sign(request) { return { ...request, signature: new Uint8Array(64) }; } }, + }), (error) => error.code === "transaction-expired"); + assert.equal(samples.length, 0); + assert.equal(completed, false); + }); +} diff --git a/bindings/typescript/test/package/packed-signing-deadline.test.js b/bindings/typescript/test/package/packed-signing-deadline.test.js new file mode 100644 index 000000000..a13bbdf34 --- /dev/null +++ b/bindings/typescript/test/package/packed-signing-deadline.test.js @@ -0,0 +1,14 @@ +import test from "node:test"; +import { rm } from "node:fs/promises"; +import { join } from "node:path"; +import { pathToFileURL } from "node:url"; +import { installPackedSdk } from "./helpers/packed-install.mjs"; +import { signingDeadlineContract } from "../helpers/signing-deadline-contract.mjs"; + +test("AP078 signing deadlines in the installed source-free package", { timeout: 120_000 }, async (t) => { + const { directory } = await installPackedSdk("auths-signing-deadline-"); + try { + const signing = await import(pathToFileURL(join(directory, "node_modules/@auths-dev/sdk/dist/internal/signing.js")).href); + await signingDeadlineContract(t, signing); + } finally { await rm(directory, { recursive: true, force: true }); } +}); diff --git a/bindings/typescript/test/unit/signing-deadline.test.js b/bindings/typescript/test/unit/signing-deadline.test.js new file mode 100644 index 000000000..7200b8f39 --- /dev/null +++ b/bindings/typescript/test/unit/signing-deadline.test.js @@ -0,0 +1,5 @@ +import test from "node:test"; +import * as signing from "../../dist/internal/signing.js"; +import { signingDeadlineContract } from "../helpers/signing-deadline-contract.mjs"; + +test("AP078 signing deadline ownership", { timeout: 10_000 }, (t) => signingDeadlineContract(t, signing)); diff --git a/demos/airtable-gateway/README.md b/demos/airtable-gateway/README.md index d20183c5f..30f695894 100644 --- a/demos/airtable-gateway/README.md +++ b/demos/airtable-gateway/README.md @@ -140,13 +140,26 @@ An IPC failure is unconfirmed, never permission to send another PATCH. Operator-only recovery uses a separately authorized native read and exact approval; diagnostics remain available through the shipped CLI: +Each gateway owns a separate protected parent: +`/run/demo/sockets/gateway0/app.sock` through `gateway2/app.sock`. The +gateway UID owns each directory with mode `0750`; application group `62005` +can traverse it and access the `0660` socket, but cannot replace serving locks. +Only the native gateway recovers or removes socket paths. The operator waits +for that child process's bounded `app socket ready` event and retains it in the +private gateway log; an existing socket pathname never indicates startup success. +Operator endpoints remain `/run/demo/sockets/review.sock` for recovery/content +review and `/run/demo/sockets/owner-review.sock` for mutation consent. They are +configured independently with `--review-socket` and `--owner-review-socket`; +changing an application `--socket` never relocates either operator endpoint. +The operator passes every endpoint explicitly to its application processes. + ```sh docker exec auths-airtable-gateway-demo /opt/demo/bin/auths-gateway-simulation \ recover --state-dir /run/demo/gateway0 --source-operation lost-response \ --proof /private/read-proof.cbor --action /private/read-action.cbor \ --approval /private/read-approval.json docker exec auths-airtable-gateway-demo /opt/demo/bin/auths-gateway-simulation \ - doctor --state-dir /run/demo/gateway0 --app-socket /run/demo/sockets/app0.sock \ + doctor --state-dir /run/demo/gateway0 --app-socket /run/demo/sockets/gateway0/app.sock \ --app-uid 62004 --app-gid 62005 docker exec auths-airtable-gateway-demo /opt/demo/bin/auths-gateway-simulation \ support-bundle --state-dir /run/demo/gateway0 diff --git a/demos/airtable-gateway/app.py b/demos/airtable-gateway/app.py index 4714f1be3..b3b4b92f2 100644 --- a/demos/airtable-gateway/app.py +++ b/demos/airtable-gateway/app.py @@ -22,7 +22,8 @@ GatewaySignedObservation) from auths.self_hosted import load_signer_file -from demo_common import Refusal, b64, canonical, decode, read, require, unb64, write +from demo_common import (Refusal, application_socket_paths, b64, canonical, decode, + read, require, review_socket_path, unb64, write) from generated import CONTRACT, SetDemoStatus, FIELDS from managed_content import EXPERIMENTS as CONTENT_EXPERIMENTS @@ -68,7 +69,7 @@ def approval_target(label, arguments): class Application: - def __init__(self, directory, sockets): + def __init__(self, directory, sockets, *, review_socket, owner_review_socket): self.directory = Path(directory) self.plan = decode(read(self.directory / 'application.json')) require(self.plan['schema'] == 'auths.airtable-gateway-demo/2', 'demo.invalid-plan') @@ -77,6 +78,8 @@ def __init__(self, directory, sockets): and 0 < len(unb64(self.plan['recipe_source_b64'])) <= 65536, 'demo.invalid-plan') require(set(self.plan['cases']) == set(LABELS), 'demo.invalid-cases') self.sockets = [Path(path) for path in sockets] + self.review_socket = Path(review_socket) + self.owner_review_socket = Path(owner_review_socket) self.clients = [GatewayClient(GatewayEndpoint(path)) for path in self.sockets] require(len(self.clients) == 3, 'demo.race-and-fresh-context-gateways-required') self.signer = load_signer_file(self.directory / 'actor.json').signer @@ -233,7 +236,8 @@ async def request_review(self, request): def request_review(): with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as channel: channel.settimeout(660 if self.plan['mode'] == 'live' or self.plan['effect_review']['mode'] == 'authenticated owner review required' else 90) - channel.connect(str(self.sockets[0].parent / ('owner-review.sock' if 'mutation' in request else 'review.sock'))) + channel.connect(str(review_socket_path(request, recovery=self.review_socket, + owner=self.owner_review_socket))) payload = canonical(request) channel.sendall(struct.pack('>I', len(payload)) + payload) def receive(length): @@ -417,12 +421,15 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('--application', type=Path, default=Path('/run/demo/app')) parser.add_argument('--socket', action='append', default=[]) + parser.add_argument('--review-socket', type=Path, default=Path('/run/demo/sockets/review.sock')) + parser.add_argument('--owner-review-socket', type=Path, default=Path('/run/demo/sockets/owner-review.sock')) parser.add_argument('--port', type=int, default=8081) parser.add_argument('command', choices=['serve', 'status', 'submit', 'export']) parser.add_argument('--experiment', choices=EXPERIMENTS, default='exact') args = parser.parse_args() - application = Application(args.application, args.socket or ['/run/demo/sockets/app0.sock', - '/run/demo/sockets/app1.sock', '/run/demo/sockets/app2.sock']) + application = Application(args.application, args.socket or application_socket_paths('/run/demo'), + review_socket=args.review_socket, + owner_review_socket=args.owner_review_socket) if args.command == 'serve': serve(application, args.port) elif args.command == 'status': diff --git a/demos/airtable-gateway/demo_common.py b/demos/airtable-gateway/demo_common.py index 366ae7bb5..77bc76a9f 100644 --- a/demos/airtable-gateway/demo_common.py +++ b/demos/airtable-gateway/demo_common.py @@ -4,10 +4,57 @@ import json import os from pathlib import Path +import selectors +import time MAX_FILE = 4 * 1024 * 1024 +def application_socket_paths(home): + """One protected socket parent per independently serving gateway.""" + root = Path(home) / 'sockets' + return tuple(root / ('gateway' + str(host)) / 'app.sock' for host in range(3)) + + +def create_socket_directories(home, application_gid): + """Gateway UID owns each parent; the application group may traverse only.""" + root = Path(home) / 'sockets' + paths = application_socket_paths(home) + for directory in (root, *(path.parent for path in paths)): + directory.mkdir(mode=0o750) + os.chown(directory, os.getuid(), application_gid) + os.chmod(directory, 0o750) + return paths + + +def wait_gateway_ready(process, log, *, timeout=20): + """Wait for this process's bounded native readiness event, not a pathname.""" + require(process.stdout is not None, 'demo.gateway-start-refused') + deadline = time.monotonic() + timeout + output = bytearray() + with selectors.DefaultSelector() as selector: + selector.register(process.stdout, selectors.EVENT_READ) + while len(output) <= 65536: + remaining = deadline - time.monotonic() + require(remaining > 0 and selector.select(remaining), 'demo.gateway-start-timeout') + chunk = os.read(process.stdout.fileno(), min(4096, 65537 - len(output))) + require(bool(chunk), 'demo.gateway-start-refused') + log.write(chunk) + log.flush() + output.extend(chunk) + if b'\n' in output: + line = output.split(b'\n', 1)[0] + require(len(output) <= 65536 and line.startswith(b'app socket ready') + and process.poll() is None, 'demo.gateway-start-refused') + return + raise Refusal('demo.gateway-start-refused') + + +def review_socket_path(request, *, recovery, owner): + """Select an explicitly configured operator channel, never an app parent.""" + return Path(owner if 'mutation' in request else recovery) + + class Refusal(ValueError): pass diff --git a/demos/airtable-gateway/operate.py b/demos/airtable-gateway/operate.py index 93b0869dc..5e3bb70db 100644 --- a/demos/airtable-gateway/operate.py +++ b/demos/airtable-gateway/operate.py @@ -25,7 +25,8 @@ AssuranceRequirement, Permission, Profile, TrustAnchor, TrustedContextRequest, author_root_grant, compile_trusted_context, load_signer_file) -from demo_common import Refusal, b64, canonical, decode, digest, read, require, unb64, write +from demo_common import (Refusal, b64, canonical, create_socket_directories, decode, + digest, read, require, unb64, wait_gateway_ready, write) from app import Application, LABELS, approval_target HERE = Path(__file__).resolve().parent @@ -311,8 +312,9 @@ def __init__(self, mode, owner_ui_port=None): self.mode, self.processes, self.double, self.resources = mode, [], None, None self.binary = HERE / 'bin' / ('auths-gateway-simulation' if mode == 'simulation' else 'auths-gateway') self.keys, self.sockets = {}, HOME / 'sockets' - self.sockets.mkdir(mode=0o750) - os.chown(self.sockets, 0, APP_GID) + self.app_sockets = create_socket_directories(HOME, APP_GID) + self.review_socket = self.sockets / 'review.sock' + self.owner_review_socket = self.sockets / 'owner-review.sock' self.port = None self.effect_reviewer = development_ed25519_identity_key() self.recipe = HERE / ('managed-recipe.json' if owner_ui_port is not None else 'recipe.json') @@ -323,31 +325,30 @@ def __init__(self, mode, owner_ui_port=None): self.owner_review = OwnerReviewServer(PRIVATE, owner_ui_port) def start_gateway(self, host): - socket_path = self.sockets / ('app' + str(host) + '.sock') - socket_path.unlink(missing_ok=True) + socket_path = self.app_sockets[host] state = HOME / ('gateway' + str(host)) - (state / 'admin.sock').unlink(missing_ok=True) args = [self.binary, 'serve', '--state-dir', state, '--app-socket', socket_path] if self.port is not None: args.extend(['--loopback-provider', self.port]) log = open(HOME / 'private' / ('gateway-' + str(host) + '.log'), 'ab') - process = subprocess.Popen(list(map(str, args)), env=ENVIRONMENT, stdout=log, stderr=log) + try: + process = subprocess.Popen(list(map(str, args)), env=ENVIRONMENT, + stdout=subprocess.PIPE, stderr=log) + except BaseException: + log.close() + raise self.processes.append((process, log, host)) - deadline = time.monotonic() + 20 - while time.monotonic() < deadline: - require(process.poll() is None, 'demo.gateway-start-refused') - if socket_path.exists(): - os.chown(socket_path, 0, APP_GID) - os.chmod(socket_path, 0o660) - return - time.sleep(0.05) - raise Refusal('demo.gateway-start-timeout') + wait_gateway_ready(process, log) + os.chown(socket_path, 0, APP_GID) + os.chmod(socket_path, 0o660) def restart(self, host): for process, log, number in list(self.processes): if number == host: process.terminate() process.wait(timeout=10) + if process.stdout is not None: + process.stdout.close() log.close() self.processes.remove((process, log, number)) self.start_gateway(host) @@ -515,8 +516,9 @@ def exact_approval(self, state, name, proof, action, *mode, review_only=False, o def prepare_exact_approvals(self, plan): """Preapprove finite scripted mutations; refusals use an explicitly substituted approval.""" - application = Application(HOME / 'app', [self.sockets / ('app' + str(host) + '.sock') - for host in range(3)]) + application = Application(HOME / 'app', self.app_sockets, + review_socket=self.review_socket, + owner_review_socket=self.owner_review_socket) values, reviews = {}, {} for label in LABELS: proof, action, _ = asyncio.run(application.packet(label)) @@ -634,7 +636,7 @@ def receive(length): self.review_servers = [] for mutation_route in ([False, True] if self.owner_review is not None else [False]): - path = self.sockets / ('owner-review.sock' if mutation_route else 'review.sock') + path = self.owner_review_socket if mutation_route else self.review_socket server = socketserver.UnixStreamServer(str(path), Handler) server.mutation_route = mutation_route os.chown(path, 0, APP_GID) @@ -643,8 +645,16 @@ def receive(length): thread.start() self.review_servers.append((server, thread)) + def application_command(self, *arguments): + command = ['/opt/consumer/bin/python', str(HERE / 'app.py'), + '--application', str(HOME / 'app'), '--review-socket', str(self.review_socket)] + command.extend(['--owner-review-socket', str(self.owner_review_socket)]) + for socket_path in self.app_sockets: + command.extend(['--socket', str(socket_path)]) + return [*command, *arguments] + def application(self, *arguments): - return subprocess.run(['/opt/consumer/bin/python', str(HERE / 'app.py'), *arguments], + return subprocess.run(self.application_command(*arguments), env=ENVIRONMENT, capture_output=True, user=APP_UID, group=APP_GID, extra_groups=[], timeout=90) def export_audit(self, destination): @@ -679,6 +689,8 @@ def stop(self): except subprocess.TimeoutExpired: process.kill() process.wait() + if process.stdout is not None: + process.stdout.close() log.close() self.processes.clear() if self.double: @@ -714,8 +726,7 @@ def interrupted(*_): from selftest import run run(operator) else: - process = subprocess.Popen(['/opt/consumer/bin/python', str(HERE / 'app.py'), - 'serve', '--port', str(args.port)], env=ENVIRONMENT, + process = subprocess.Popen(operator.application_command('serve', '--port', str(args.port)), env=ENVIRONMENT, user=APP_UID, group=APP_GID, extra_groups=[]) operator.processes.append((process, open(os.devnull, 'wb'), -1)) require(process.wait() == 0, 'demo.application-exited') diff --git a/demos/airtable-gateway/selftest.py b/demos/airtable-gateway/selftest.py index ad317407f..742a26092 100644 --- a/demos/airtable-gateway/selftest.py +++ b/demos/airtable-gateway/selftest.py @@ -274,7 +274,7 @@ def test_application_isolation_and_native_audit(operator): user=APP_UID, group=APP_GID, extra_groups=[], env=ENVIRONMENT) require(probe.returncode == 0, 'demo.selftest-application-secret-isolation') doctor = child([operator.binary, 'doctor', '--state-dir', HOME / 'gateway0', - '--app-socket', HOME / 'sockets/app0.sock', '--app-uid', APP_UID, '--app-gid', APP_GID], check=False) + '--app-socket', operator.app_sockets[0], '--app-uid', APP_UID, '--app-gid', APP_GID], check=False) doctor_value = decode(doctor.stdout) require(doctor_value.get('schema') == 'auths.gateway-readiness/1' and doctor_value.get('ready') is False and doctor.returncode != 0, @@ -377,7 +377,7 @@ def receive(length): """ before = operator.witnesses() result = subprocess.run(['/opt/consumer/bin/python', '-c', script, - str(HOME / 'sockets/review.sock')], user=APP_UID, group=APP_GID, extra_groups=[], + str(operator.review_socket)], user=APP_UID, group=APP_GID, extra_groups=[], env=ENVIRONMENT, capture_output=True, timeout=20) require(result.returncode == 0, 'demo.selftest-review-channel-unavailable') refusals = decode(result.stdout) @@ -387,8 +387,33 @@ def receive(length): 'returned_proof_or_approval': False} +def test_application_socket_topology(operator): + """The app can traverse three separate gateway-owned serving parents.""" + from operate import APP_UID, APP_GID, ENVIRONMENT + paths = operator.app_sockets + require(len(paths) == 3 and len({path.parent for path in paths}) == 3, + 'demo.selftest-gateway-socket-parents-shared') + require(operator.review_socket.parent not in {path.parent for path in paths}, + 'demo.selftest-review-endpoint-aliases-gateway-parent') + for path in paths: + info = path.parent.stat() + require(info.st_uid == 0 and info.st_gid == APP_GID and info.st_mode & 0o777 == 0o750, + 'demo.selftest-gateway-socket-parent-permissions') + require(path.is_socket(), 'demo.selftest-gateway-socket-unavailable') + probe = subprocess.run(['/opt/consumer/bin/python', '-c', + 'import os,sys; from pathlib import Path; ' + 'assert all(os.access(Path(p).parent, os.X_OK) and ' + 'not os.access(Path(p).parent, os.W_OK) and os.access(p, os.W_OK) for p in sys.argv[1:])', + *map(str, paths)], user=APP_UID, group=APP_GID, extra_groups=[], + env=ENVIRONMENT, capture_output=True, timeout=10) + require(probe.returncode == 0, 'demo.selftest-gateway-socket-traversal') + return {'independent_gateway_parents': 3, 'gateway_uid': 0, + 'application_group_traverse_only': True, 'operator_review_endpoint_separate': True} + + def run(operator): from operate import HOME + topology = test_application_socket_topology(operator) consent = test_exact_operator_consent_binding(operator) reviewer = test_private_reviewer_refuses_unlisted_inputs(operator) cases = test_native_refusals_replay_race_and_loss(operator) @@ -397,7 +422,8 @@ def run(operator): report = {'schema': 'auths.airtable-gateway-demo-evidence/1', 'mode': 'simulation', 'production_qualification': False, 'independent_human_trial': False, 'source_commit': decode(read(Path(__file__).parent / 'manifest.json'))['source_commit'], - 'operator_consent': consent, 'operator_review_channel': reviewer, 'cases': cases, **verified, + 'socket_topology': topology, 'operator_consent': consent, + 'operator_review_channel': reviewer, 'cases': cases, **verified, 'excluded': ['live Airtable writes', 'production AWS custody and PostgreSQL', 'protected full-corpus qualification', 'provider key rotation', 'independent security review', 'GitHub release installation']} diff --git a/demos/airtable-gateway/tests/test_launch.py b/demos/airtable-gateway/tests/test_launch.py index 406b198f6..bcc8f4a95 100644 --- a/demos/airtable-gateway/tests/test_launch.py +++ b/demos/airtable-gateway/tests/test_launch.py @@ -5,6 +5,9 @@ import os from pathlib import Path import stat +import socket +import subprocess +import sys import tempfile from types import SimpleNamespace import unittest @@ -13,9 +16,87 @@ spec = importlib.util.spec_from_file_location('demo_launch', Path(__file__).resolve().parents[1] / 'launch.py') launch = importlib.util.module_from_spec(spec) spec.loader.exec_module(launch) +common_spec = importlib.util.spec_from_file_location( + 'demo_socket_layout', Path(__file__).resolve().parents[1] / 'demo_common.py') +common = importlib.util.module_from_spec(common_spec) +common_spec.loader.exec_module(common) class LaunchTests(unittest.TestCase): + def test_readiness_is_a_native_process_event_and_is_retained_in_the_log(self): + command = [sys.executable, '-c', + 'import sys; print("app socket ready; fixture", flush=True); sys.stdin.buffer.read(1)'] + with subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) as process: + try: + log = io.BytesIO() + common.wait_gateway_ready(process, log, timeout=5) + self.assertEqual(log.getvalue(), b'app socket ready; fixture\n') + self.assertIsNone(process.poll()) + finally: + if process.poll() is None: + process.kill() + process.wait(timeout=5) + + def test_existing_socket_paths_are_not_readiness_or_cleanup_authority(self): + with tempfile.TemporaryDirectory(dir='/tmp') as directory: + app = Path(directory) / 'app.sock' + admin = Path(directory) / 'admin.sock' + with socket.socket(socket.AF_UNIX) as live: + live.bind(str(app)) + live.listen(1) + with socket.socket(socket.AF_UNIX) as stale: + stale.bind(str(admin)) + identities = [(path.stat().st_dev, path.stat().st_ino) for path in (app, admin)] + with subprocess.Popen([sys.executable, '-c', 'pass'], stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) as process: + with self.assertRaisesRegex(common.Refusal, 'demo.gateway-start-refused'): + common.wait_gateway_ready(process, io.BytesIO(), timeout=5) + process.wait(timeout=5) + self.assertEqual(identities, [(path.stat().st_dev, path.stat().st_ino) + for path in (app, admin)]) + with socket.socket(socket.AF_UNIX) as client: + client.settimeout(1) + client.connect(str(app)) + accepted, _ = live.accept() + accepted.close() + + def test_partial_readiness_line_has_a_bounded_deadline(self): + read_end, write_end = os.pipe() + try: + os.write(write_end, b'app socket ready; unterminated') + with os.fdopen(read_end, 'rb') as stdout: + process = SimpleNamespace(stdout=stdout, poll=lambda: None) + with self.assertRaisesRegex(common.Refusal, 'demo.gateway-start-timeout'): + common.wait_gateway_ready(process, io.BytesIO(), timeout=0.05) + finally: + os.close(write_end) + + def test_each_gateway_has_a_protected_application_socket_parent(self): + with tempfile.TemporaryDirectory() as directory: + paths = common.create_socket_directories(directory, os.getgid()) + self.assertEqual(paths, common.application_socket_paths(directory)) + self.assertEqual(len({path.parent for path in paths}), 3) + for host, path in enumerate(paths): + self.assertEqual(path, Path(directory) / 'sockets' / ('gateway' + str(host)) / 'app.sock') + for parent in (path.parent, path.parent.parent): + info = parent.stat() + self.assertEqual(info.st_uid, os.getuid()) + self.assertEqual(info.st_gid, os.getgid()) + self.assertEqual(stat.S_IMODE(info.st_mode), 0o750) + recovery = Path(directory) / 'sockets' / 'review.sock' + self.assertNotIn(recovery.parent, {path.parent for path in paths}) + + def test_operator_review_routes_use_explicit_endpoints(self): + recovery = Path('/operator/recovery.sock') + owner = Path('/owner/consent.sock') + self.assertEqual(common.review_socket_path({'source': 'exact'}, + recovery=recovery, owner=owner), recovery) + self.assertEqual(common.review_socket_path({'mutation': 'exact'}, + recovery=recovery, owner=owner), owner) + self.assertEqual(common.review_socket_path({'managed_content': 'request'}, + recovery=recovery, owner=owner), recovery) + def env(self, directory): path = Path(directory) / '.env' values = {name: 'simulation-value-' + str(index) for index, name in enumerate(launch.ENV_FIELDS.values())} diff --git a/demos/cross-company-incident-response/README.md b/demos/cross-company-incident-response/README.md index b63ae4161..82933071d 100644 --- a/demos/cross-company-incident-response/README.md +++ b/demos/cross-company-incident-response/README.md @@ -119,8 +119,10 @@ typed stage/code and concrete evidence: release, commit, or retain `outcome-unknown`; the live ambiguous case applies an effect, loses the response, blocks retry, and reconciles to `reconciled-committed`; -- approval withdrawal: the first step is reported complete and the second - remains unresolved after the bounded plan session is disposed. +- approval withdrawal: the browser authors and verifies the first exact action, + then records a signed decline for the second. Native remote approval assembly + refuses the second with `approval.incomplete`; the first proof still verifies. + This local check makes no provider call and claims no completed effect. ## Trust boundaries diff --git a/demos/cross-company-incident-response/control-room/public/index.html b/demos/cross-company-incident-response/control-room/public/index.html index 79df2ce1b..a4dae7f2b 100644 --- a/demos/cross-company-incident-response/control-room/public/index.html +++ b/demos/cross-company-incident-response/control-room/public/index.html @@ -12,6 +12,7 @@ "imports": { "@auths-dev/sdk": "/vendor-v3/dist/index.js", "@auths-dev/sdk/testkit": "/vendor-v3/dist/testkit/index.js", + "@auths-dev/sdk/self-hosted": "/vendor-v3/dist/self-hosted.js", "@auths-dev/sdk/verify": "/vendor-v3/dist/verify.js", "@auths-dev/sdk/": "/vendor-v3/dist/" } diff --git a/demos/cross-company-incident-response/control-room/src/app.ts b/demos/cross-company-incident-response/control-room/src/app.ts index a4f6edd4f..846ee0eb6 100644 --- a/demos/cross-company-incident-response/control-room/src/app.ts +++ b/demos/cross-company-incident-response/control-room/src/app.ts @@ -1,6 +1,10 @@ -import { approval } from "@auths-dev/sdk"; -import { BoundedApprovalSession, development } from "@auths-dev/sdk/testkit"; -import { loadVerifier } from "@auths-dev/sdk/verify"; +import type { CustodyDescriptor, CustodySigner } from "@auths-dev/sdk/adapters"; +import { + ApprovalRefused, approvalRequests, approve, collectApprovals, compileTrustedContext, + decline, exactMcpTool, openApprovalRequest, proposeMcpApproval, signApprovalAction, stringField, +} from "@auths-dev/sdk/self-hosted"; +import { developmentEd25519Key } from "@auths-dev/sdk/testkit"; +import { createVerifier } from "@auths-dev/sdk/verify"; declare global { var AUTHS_INCIDENT_AGENT_API: string | undefined; @@ -13,6 +17,8 @@ type Json = Record; let state: Json = {}; let proposal: Json = {}; let viewerToken = sessionStorage.getItem("auths.incident.viewer-token") ?? ""; +let viewerGeneration = 0; +let refreshGeneration = 0; const attacks = [ ["byte-mutation", "Change firewall byte after approval"], @@ -26,12 +32,12 @@ const attacks = [ ["withdraw-approval", "Withdraw approval mid-plan"], ] as const; -async function request(path: string, options: RequestInit = {}): Promise { +async function request(path: string, options: RequestInit = {}, token = viewerToken): Promise { const response = await fetch(`${api}${path}`, { ...options, headers: { "content-type": "application/json", - ...(viewerToken ? { authorization: `Bearer ${viewerToken}` } : {}), + ...(token ? { authorization: `Bearer ${token}` } : {}), ...(options.headers ?? {}), }, }); @@ -59,8 +65,41 @@ function element(id: string): T { } async function refresh(): Promise { - [state, proposal] = await Promise.all([request("/api/state"), request("/api/proposal")]); - render(); + const scope = viewerGeneration; + const generation = ++refreshGeneration; + const token = viewerToken; + const current = () => scope === viewerGeneration && generation === refreshGeneration; + try { + const [nextState, nextProposal] = await Promise.all([ + request("/api/state", {}, token), request("/api/proposal", {}, token), + ]); + if (!current()) return; + state = nextState; + proposal = nextProposal; + render(); + } catch (error) { + if (!current()) return; + clearReceiptView(); + element("receipt-access-status").textContent = "Receipt access unavailable."; + throw error; + } +} + +function clearReceiptView(): void { + // Remove retained disclosure as well as rendered evidence: another render + // during login/failure must not revive the previous viewer's receipts. + state = { ...state, receipts: [], receiptView: "opaque" }; + element("receipts").replaceChildren(); + element("receipt-access-status").textContent = "Receipt view changing…"; + document.querySelectorAll("[data-receipt-role]").forEach((button) => button.classList.remove("active")); +} + +function changeViewerScope(token: string): void { + ++viewerGeneration; + viewerToken = token; + if (token) sessionStorage.setItem("auths.incident.viewer-token", token); + else sessionStorage.removeItem("auths.incident.viewer-token"); + clearReceiptView(); } function render(): void { @@ -182,8 +221,8 @@ async function crossVerify(): Promise { const output = element("sdk-evidence"); try { const fixture = await request("/api/fixture"); - const verifier = await loadVerifier(); - const result = verifier.verify(bytes(fixture.proof), bytes(fixture.action), bytes(fixture.context)); + const verifier = await createVerifier(); + const result = verifier.verify({ proof: bytes(fixture.proof), action: bytes(fixture.action), trustedContext: bytes(fixture.context) }); const agrees = result.kind === fixture.python.kind && result.stage === fixture.python.stage && result.code === fixture.python.code; output.classList.toggle("ok", agrees); output.textContent = `${agrees ? "✓" : "✗"} PORTABLE FIXTURE · Python ${fixture.python.kind}/${fixture.python.code} · TypeScript ${result.kind}/${result.code} · P-256 WebAuthn root`; @@ -197,38 +236,102 @@ async function liveMutationAttack(): Promise { const fixture = await request("/api/fixture"); const action = bytes(fixture.action); action[action.length - 1] = (action[action.length - 1] ?? 0) ^ 1; - const result = (await loadVerifier()).verify(bytes(fixture.proof), action, bytes(fixture.context)); + const result = (await createVerifier()).verify({ proof: bytes(fixture.proof), action, trustedContext: bytes(fixture.context) }); const python = await request("/api/attack/byte-mutation", { method: "POST", body: "{}" }); return { ...python, evidence: { python: python.evidence, typescript: { kind: result.kind, stage: result.stage, code: result.code } } }; } +async function withdrawalSigner(): Promise { + const key = await developmentEd25519Key(); + const descriptor: CustodyDescriptor = Object.freeze({ + contract: "signer-custody/2", kind: "workload", adapterId: "incident.browser.development", + principal: key.principal, signature: key.signature, keyVersion: "development-1", + keyState: "active-current", lifecycle: "ephemeral", + }); + let phase: "open" | "closed" = "open"; + const close = async () => { phase = "closed"; }; + return { + descriptor, + async sign(request) { + if (phase === "closed" || request.signal.aborted) return { kind: "rejected", failure: "cancelled" }; + const signature = await key.sign(request.signingPreimage); + if (phase !== "open" || request.signal.aborted) return { kind: "rejected", failure: "cancelled" }; + return { kind: "signed", response: { + requestId: request.requestId, objectId: request.objectId.slice(), principal: key.principal, + descriptor: key.signature, providerKeyVersion: descriptor.keyVersion, + transactionDigest: request.transactionDigest.slice(), signature, evidence: [key.evidence], + } }; + }, + close, + [Symbol.asyncDispose]: close, + }; +} + async function liveWithdrawalAttack(): Promise { - const policy = await approval.planOnce({ maxUses: 2, expiresInSeconds: 60 }); - const plan = new Uint8Array(32).fill(1); - const first = new Uint8Array(32).fill(2); - const second = new Uint8Array(32).fill(3); - const session = new BoundedApprovalSession({ planCommitment: plan, memberCommitments: [first, second], policy, provider: development.approve(), display: [] }); - await session.providerFor(0, first).approve({ - requestId: "withdraw:first", - objectKind: "action", - transactionDigest: new Uint8Array(32).fill(4), - policy: policy.reference, - expiresAt: BigInt(Math.floor(Date.now() / 1000) + 60), - display: [], - }, { signal: new AbortController().signal }); - await session.dispose(); + const actor = await withdrawalSigner(); + const approver = await withdrawalSigner(); try { - await session.providerFor(1, second).approve({ - requestId: "withdraw:second", - objectKind: "action", - transactionDigest: new Uint8Array(32).fill(5), - policy: policy.reference, - expiresAt: BigInt(Math.floor(Date.now() / 1000) + 60), - display: [], - }, { signal: new AbortController().signal }); - return { attack: "withdraw-approval", blocked: false, code: "unexpected-authorized" }; - } catch (error) { - return { attack: "withdraw-approval", blocked: true, stage: "approval", code: "approval-cancelled", detail: (error as Error).message, evidence: { completedSteps: ["firewall-eu-west-2"], unresolved: ["cache-eu-west-2"], sdk: "TypeScript BoundedApprovalSession" } }; + const now = BigInt(Math.floor(Date.now() / 1000)); + const contract = exactMcpTool({ service: "incident-withdrawal", name: "review_step", + fields: { step: stringField({ minBytes: 1, maxBytes: 64 }) } }); + const approvers = [approver.descriptor.principal]; + const challenge = crypto.getRandomValues(new Uint8Array(32)); + const build = (step: string) => proposeMcpApproval({ contract, command: { step }, required: 1, + approvers, actor: actor.descriptor.principal, challenge, evaluationTime: now, validitySeconds: 60 }); + const first = await build("firewall-eu-west-2"); + const firstRequest = (await approvalRequests(first))[0]; + if (!firstRequest) throw new Error("Native approval request missing"); + const firstReview = await openApprovalRequest(firstRequest.data, { now }); + const firstApproval = await approve(firstReview, approver); + const firstCollection = await collectApprovals(first, [firstApproval.data]); + const firstProof = firstCollection.assemble(await signApprovalAction(first, actor)); + const audience = "mcp://incident-withdrawal"; + const trustedContext = await compileTrustedContext({ + anchors: [{ id: "browser-demo-actor", principal: actor.descriptor.principal, + acceptedMethods: ["raw-key-v1"], profiles: [{ id: "auths.mcp", version: 2 }], + permissions: [{ capability: "tools/call", resource: `${audience}/tools/review_step` }], + resourceNamespaces: [audience], audiences: [audience], notBefore: now, expiresAt: now + 60n, + maxDelegationDepth: 0, assurancePolicy: "browser-withdrawal" }], + assurance: { id: "browser-withdrawal", requirements: [ + { role: "root", quantifier: "every", claim: "self-certifying-identifier" }, + { role: "actor", quantifier: "every", claim: "self-certifying-identifier" }, + { role: "actor", quantifier: "every", claim: "offline-verifiable" }, + ] }, + evidenceTypes: ["raw-key-v1"], + approverAnchors: approvers.map((principal) => ({ principal, acceptedMethods: ["raw-key-v1"], notBefore: now, expiresAt: now + 60n })), + approvalRequirements: [{ approvers, threshold: 1 }], + request: { audience, challenge, evaluationTime: now }, + }); + const verifier = await createVerifier(); + const firstDecision = verifier.verify({ proof: firstProof, action: first.action, trustedContext }); + if (firstDecision.kind !== "authorized") throw new Error(`First approval did not verify: ${firstDecision.code}`); + + const second = await build("cache-eu-west-2"); + const secondRequest = (await approvalRequests(second))[0]; + if (!secondRequest) throw new Error("Native approval request missing"); + const secondReview = await openApprovalRequest(secondRequest.data, { now }); + const refusal = await decline(secondReview, approver, { now }); + const secondCollection = await collectApprovals(second, [refusal.data]); + const secondAction = await signApprovalAction(second, actor); + try { + secondCollection.assemble(secondAction); + return { attack: "withdraw-approval", blocked: false, code: "unexpected-authorized" }; + } catch (error) { + if (!(error instanceof ApprovalRefused) || error.code !== "approval.incomplete") throw error; + // Rechecking the original exact proof demonstrates that refusing a later + // action neither erases its earlier approval nor claims a provider effect. + const retained = verifier.verify({ proof: firstProof, action: first.action, trustedContext }); + return { attack: "withdraw-approval", blocked: retained.kind === "authorized" && !secondCollection.isComplete, + stage: "approval", code: error.code, + detail: "The first exact action remains approved; a signed decline prevents a proof for the second. No provider calls were made by this browser check.", + evidence: { approvedSteps: ["firewall-eu-west-2"], unresolved: ["cache-eu-west-2"], providerCalls: 0, + firstDecision: retained.kind, secondApproved: secondCollection.approved, + secondStatuses: secondCollection.statuses.map(({ approver, status }) => ({ approver, status })), + firstProof: base64Url(firstProof), decline: refusal.text, sdk: "TypeScript native remote approval" } }; + } + } finally { + await approver.close(); + await actor.close(); } } @@ -267,10 +370,9 @@ function wire(): void { document.querySelectorAll("[data-receipt-role]").forEach((button) => button.addEventListener("click", () => { const role = button.dataset.receiptRole; if (role === "public") { - viewerToken = ""; - sessionStorage.removeItem("auths.incident.viewer-token"); + changeViewerScope(""); sessionStorage.removeItem("auths.incident.viewer-role"); - void refresh(); + void refresh().catch(() => { /* the matching refresh owns its error view */ }); return; } if (role) void beginViewerLogin(role); @@ -278,8 +380,11 @@ function wire(): void { } async function beginViewerLogin(subject: string): Promise { + changeViewerScope(""); + const scope = viewerGeneration; const verifier = base64Url(crypto.getRandomValues(new Uint8Array(48))); const challenge = base64Url(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier)))); + if (scope !== viewerGeneration) return; const oauthState = base64Url(crypto.getRandomValues(new Uint8Array(24))); sessionStorage.setItem("auths.incident.pkce-verifier", verifier); sessionStorage.setItem("auths.incident.oauth-state", oauthState); @@ -300,6 +405,7 @@ async function beginViewerLogin(subject: string): Promise { } async function completeViewerLogin(): Promise { + const scope = viewerGeneration; const query = new URLSearchParams(location.search); const code = query.get("code"); if (!code) return; @@ -308,21 +414,28 @@ async function completeViewerLogin(): Promise { if (!expectedState || query.get("state") !== expectedState || !verifier) { throw new Error("Northstar OIDC callback did not match this browser session"); } - const response = await fetch(new URL("/token", String(state.identityProvider)), { - method: "POST", - headers: { "content-type": "application/x-www-form-urlencoded" }, - body: new URLSearchParams({ - grant_type: "authorization_code", - client_id: "auths-incident-control-room", - redirect_uri: `${location.origin}${location.pathname}`, - code, - code_verifier: verifier, - }), - }); - const token = await response.json() as Json; + let response: Response; + let token: Json; + try { + response = await fetch(new URL("/token", String(state.identityProvider)), { + method: "POST", + headers: { "content-type": "application/x-www-form-urlencoded" }, + body: new URLSearchParams({ + grant_type: "authorization_code", + client_id: "auths-incident-control-room", + redirect_uri: `${location.origin}${location.pathname}`, + code, + code_verifier: verifier, + }), + }); + token = await response.json() as Json; + } catch (error) { + if (scope !== viewerGeneration) return; + throw error; + } + if (scope !== viewerGeneration) return; if (!response.ok || typeof token.access_token !== "string") throw new Error("Northstar OIDC login failed"); - viewerToken = token.access_token; - sessionStorage.setItem("auths.incident.viewer-token", viewerToken); + changeViewerScope(token.access_token); sessionStorage.removeItem("auths.incident.pkce-verifier"); sessionStorage.removeItem("auths.incident.oauth-state"); history.replaceState({}, "", location.pathname); diff --git a/demos/cross-company-incident-response/docs/threat-model.md b/demos/cross-company-incident-response/docs/threat-model.md index af12cac94..8ebfb2a50 100644 --- a/demos/cross-company-incident-response/docs/threat-model.md +++ b/demos/cross-company-incident-response/docs/threat-model.md @@ -11,7 +11,7 @@ | fail before provider effect | Rust lifecycle transition | released; retry may be safe | | observe a definite effect | Rust lifecycle transition and native receipt | committed; never retry blindly | | lose response after effect | real Northstar effect plus lost response | `outcome-unknown`; retry blocked; explicit reconciliation required | -| withdraw approval mid-plan | bounded plan approval session | completed approval retained; no second member command | +| withdraw approval mid-plan | native exact-action remote approval and signed decline | first proof remains authorized; `approval.incomplete` prevents assembling the second; browser makes no provider call | | read receipts without authentication | unauthenticated or invalid bearer request | verified opaque commitments only; disclosure is not loaded or decrypted | | use operator access to recover exact material | Northstar commander OIDC request | profile-owned summary only; no command, result, receipt bytes, or key material | | move disclosure ciphertext across receipts or tenants | AES-GCM reveal with mismatched authenticated context | decryption fails before native inspection | diff --git a/demos/cross-company-incident-response/northstar-service/README.md b/demos/cross-company-incident-response/northstar-service/README.md new file mode 100644 index 000000000..413bbfa85 --- /dev/null +++ b/demos/cross-company-incident-response/northstar-service/README.md @@ -0,0 +1,17 @@ +# Northstar demo state ownership + +Run exactly one mutating Node process for each `NORTHSTAR_STATE_PATH`. The JSON +file is local demo state; sharing it between processes or machines is unsupported. +A deployment needing shared state must use a cross-process transaction. + +Each request finishes bounded body acquisition before loading state. The single +Node event loop then owns current-state guard checks, mutation, persistence and +response without an intervening await. Code redemption, approval counters, +firewall application and reset all use that boundary. A body admitted before +reset re-evaluates the reset successor when its body finishes. + +Build with `npm run build`, then run `npm test`. The held-body tests start isolated +server processes and use HTTP admission acknowledgements to order competing +requests without scheduler sleeps. They cover code consumption, provider calls, +approval counters, timelines and reset. They establish same-process ordering; +they do not claim crash-safe JSON replacement or physical power-loss durability. diff --git a/demos/cross-company-incident-response/northstar-service/package.json b/demos/cross-company-incident-response/northstar-service/package.json index 9e5d332ea..dbed3b5f3 100644 --- a/demos/cross-company-incident-response/northstar-service/package.json +++ b/demos/cross-company-incident-response/northstar-service/package.json @@ -5,7 +5,8 @@ "scripts": { "build": "tsc -p tsconfig.json", "start": "node dist/server.js", - "check": "tsc -p tsconfig.json --noEmit" + "check": "tsc -p tsconfig.json --noEmit", + "test": "node --test tests/state-ownership.mjs" }, "devDependencies": { "typescript": "5.9.3" diff --git a/demos/cross-company-incident-response/northstar-service/src/server.ts b/demos/cross-company-incident-response/northstar-service/src/server.ts index 6de5d3671..7021edbd0 100644 --- a/demos/cross-company-incident-response/northstar-service/src/server.ts +++ b/demos/cross-company-incident-response/northstar-service/src/server.ts @@ -9,6 +9,11 @@ const statePath = process.env.NORTHSTAR_STATE_PATH ?? "/tmp/auths-incident-demo/ const allowOrigin = process.env.AUTHS_INCIDENT_ALLOWED_ORIGIN ?? "http://localhost:7100"; const serviceToken = process.env.AUTHS_INCIDENT_SERVICE_TOKEN ?? ""; const insecureLocal = process.env.AUTHS_INCIDENT_ALLOW_INSECURE_LOCAL === "1"; +const maximumBodyBytes = 32 * 1024; + +class InvalidBody extends Error { + constructor(readonly status: number) { super("invalid request body"); } +} type CodeRecord = { sub: string; @@ -111,14 +116,26 @@ function json(response: any, status: number, body: unknown): void { } async function body(request: any): Promise> { + const declared = request.headers["content-length"]; + if (declared !== undefined && (!/^\d+$/.test(declared) || Number(declared) > maximumBodyBytes)) { + throw new InvalidBody(413); + } const chunks: any[] = []; - for await (const chunk of request) chunks.push(chunk); + let length = 0; + for await (const chunk of request) { + length += chunk.length; + if (length > maximumBodyBytes) throw new InvalidBody(413); + chunks.push(chunk); + } if (chunks.length === 0) return {}; const raw = Buffer.concat(chunks).toString("utf8"); if ((request.headers["content-type"] ?? "").includes("application/x-www-form-urlencoded")) { return Object.fromEntries(new URLSearchParams(raw)); } - return JSON.parse(raw) as Record; + let parsed: unknown; + try { parsed = JSON.parse(raw); } catch { throw new InvalidBody(400); } + if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new InvalidBody(400); + return parsed as Record; } function internal(request: any): boolean { @@ -166,6 +183,13 @@ const server = http.createServer(async (request: any, response: any) => { try { if (request.method === "OPTIONS") return json(response, 204, {}); const url = new URL(request.url ?? "/", publicUrl); + const input = request.method === "POST" ? await body(request) : {}; + // Northstar supports exactly one mutating process per statePath. From + // here through response/commit there is no await: the Node event loop owns + // load -> current guards -> transition -> persistence, including reset. + // A body admitted before another transition therefore reads its successor, + // never a retained request-local copy. Multiple mutating processes require + // a real cross-process transaction and are not supported by this demo. let state = load(); if (url.pathname === "/healthz") return json(response, 200, { status: "ok", service: "northstar", schema: "auths-incident-demo/1" }); @@ -205,7 +229,6 @@ const server = http.createServer(async (request: any, response: any) => { return response.end(); } if (url.pathname === "/token" && request.method === "POST") { - const input = await body(request); const record = state.codes[String(input.code ?? "")]; const verifier = String(input.code_verifier ?? ""); const actual = createHash("sha256").update(verifier).digest("base64url"); @@ -234,7 +257,6 @@ const server = http.createServer(async (request: any, response: any) => { } if (url.pathname === "/api/approve" && request.method === "POST") { if (!authenticateOidc(state, request)) return json(response, 401, { code: "oidc-approval-authentication-required" }); - const input = await body(request); if (!input.requestId || !input.transactionDigest || !input.planCommitment) return json(response, 400, { code: "invalid-approval-request" }); state.approvals += 1; event(state, "approval", "Northstar incident commander approved the exact plan commitment"); @@ -243,12 +265,14 @@ const server = http.createServer(async (request: any, response: any) => { } if (url.pathname === "/api/firewall/apply" && request.method === "POST") { if (!internal(request)) return json(response, 401, { code: "northstar-service-auth-required" }); - const input = await body(request); if (input.incidentId !== "INC-2026-0811" || input.region !== "eu-west-2" || input.operation !== "apply-config") { return json(response, 403, { code: "closed-operation-mismatch" }); } state.providerCalls += 1; - if (state.firewallApplied) return json(response, 409, { code: "already-applied", providerCalls: state.providerCalls }); + if (state.firewallApplied) { + persist(state); + return json(response, 409, { code: "already-applied", providerCalls: state.providerCalls }); + } state.firewallApplied = true; event(state, "effect", "Exact eu-west-2 firewall exception applied over HTTPS"); persist(state); @@ -263,11 +287,12 @@ const server = http.createServer(async (request: any, response: any) => { return json(response, 200, { reset: true }); } return json(response, 404, { code: "not-found" }); - } catch { + } catch (error) { + if (error instanceof InvalidBody) return json(response, error.status, { code: "invalid-request-body" }); return json(response, 500, { code: "northstar-internal" }); } }); server.listen(port, "0.0.0.0", () => { - process.stdout.write(`auths-incident-demo northstar listening on ${publicUrl}\n`); + process.stdout.write(`auths-incident-demo northstar listening on ${publicUrl} (port ${server.address().port})\n`); }); diff --git a/demos/cross-company-incident-response/northstar-service/tests/state-ownership.mjs b/demos/cross-company-incident-response/northstar-service/tests/state-ownership.mjs new file mode 100644 index 000000000..162eb3393 --- /dev/null +++ b/demos/cross-company-incident-response/northstar-service/tests/state-ownership.mjs @@ -0,0 +1,185 @@ +import assert from 'node:assert/strict'; +import { spawn } from 'node:child_process'; +import { createHash } from 'node:crypto'; +import { mkdtemp, readFile, rm } from 'node:fs/promises'; +import http from 'node:http'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { createInterface } from 'node:readline'; +import { fileURLToPath } from 'node:url'; +import test from 'node:test'; + +const syntheticServiceToken = 'synthetic-northstar-service-token-for-tests'; +const authorization = `Bearer ${syntheticServiceToken}`; +const verifier = 'synthetic-pkce-verifier-for-state-ownership'; +const redirectUri = 'http://localhost/callback'; +const firewall = { incidentId: 'INC-2026-0811', region: 'eu-west-2', operation: 'apply-config' }; + +function bounded(promise, diagnostic, milliseconds = 10_000) { + let timer; + return Promise.race([ + promise, + new Promise((_, reject) => { timer = setTimeout(() => reject(new Error(diagnostic)), milliseconds); }), + ]).finally(() => clearTimeout(timer)); +} + +// Expect: 100-continue acknowledges HTTP admission while retaining the entire +// body at the client. Both requests reach their body await before either can +// mutate state; no scheduler sleeps are used to manufacture overlap. +async function heldRequest(port, path, value, headers = {}) { + const bytes = Buffer.from(JSON.stringify(value)); + let request; + let admitted; + const admission = new Promise((resolve, reject) => { admitted = { resolve, reject }; }); + const response = new Promise((resolve, reject) => { + request = http.request({ + host: '127.0.0.1', port, path, method: 'POST', + headers: { 'content-type': 'application/json', 'content-length': bytes.length, expect: '100-continue', ...headers }, + }, (incoming) => { + const chunks = []; + incoming.on('data', (chunk) => chunks.push(chunk)); + incoming.on('error', reject); + incoming.on('end', () => resolve({ status: incoming.statusCode, body: JSON.parse(Buffer.concat(chunks)) })); + }); + request.on('continue', admitted.resolve); + request.on('error', (error) => { admitted.reject(error); reject(error); }); + request.setTimeout(10_000, () => request.destroy(new Error('held request exceeded diagnostic bound'))); + request.flushHeaders(); + }); + // A rejected admission must also have a consumer for its request result. + response.catch(() => {}); + await admission; + return { release: () => { request.end(bytes); return response; } }; +} + +async function request(port, path, value, headers = {}) { + return (await heldRequest(port, path, value, headers)).release(); +} + +async function code(port, clientId = 'synthetic-test-client') { + const query = new URLSearchParams({ + response_type: 'code', redirect_uri: redirectUri, client_id: clientId, + code_challenge: createHash('sha256').update(verifier).digest('base64url'), + }); + const response = await fetch(`http://127.0.0.1:${port}/authorize?${query}`, { redirect: 'manual' }); + assert.equal(response.status, 302); + return new URL(response.headers.get('location')).searchParams.get('code'); +} + +async function fixture(t) { + const directory = await mkdtemp(join(tmpdir(), 'northstar-ownership-')); + const statePath = join(directory, 'state.json'); + const child = spawn(process.execPath, [fileURLToPath(new URL('../dist/server.js', import.meta.url))], { + env: { ...process.env, PORT: '0', NORTHSTAR_PUBLIC_URL: 'http://northstar.invalid', + NORTHSTAR_STATE_PATH: statePath, AUTHS_INCIDENT_SERVICE_TOKEN: syntheticServiceToken, + AUTHS_INCIDENT_ALLOW_INSECURE_LOCAL: '0' }, + stdio: ['ignore', 'pipe', 'pipe'], + }); + let closed = false; + // 'close' follows either exit or a failed spawn; failed spawn need not emit + // 'exit'. Teardown must settle in both cases and has its own diagnostic bound. + const close = new Promise((resolve) => child.once('close', () => { closed = true; resolve(); })); + const lines = createInterface({ input: child.stdout }); + t.after(async () => { + try { + if (!closed) child.kill('SIGKILL'); + await bounded(close, 'Northstar child did not close after termination', 5_000); + } finally { + lines.close(); + await rm(directory, { recursive: true, force: true }); + } + }); + const port = await bounded(new Promise((resolve, reject) => { + child.once('error', reject); + child.once('close', (code, signal) => reject(new Error(`Northstar closed before readiness: code=${code}, signal=${signal}`))); + lines.on('line', (line) => { + const match = /\(port (\d+)\)/.exec(line); + if (match) resolve(Number(match[1])); + }); + }), 'Northstar failed to listen'); + return { port, state: async () => JSON.parse(await readFile(statePath, 'utf8')) }; +} + +test('held-body token redemption consumes exactly once, including distinct codes', { timeout: 20_000 }, async (t) => { + const { port, state } = await fixture(t); + const firstCode = await code(port); + const token = { code: firstCode, code_verifier: verifier, redirect_uri: redirectUri }; + const a = await heldRequest(port, '/token', token); + const b = await heldRequest(port, '/token', token); + assert.equal((await a.release()).status, 200); + assert.equal((await b.release()).status, 400); + assert.deepEqual((await state()).codes, {}); + + const codeA = await code(port); + const codeB = await code(port); + const c = await heldRequest(port, '/token', { ...token, code: codeA }); + const d = await heldRequest(port, '/token', { ...token, code: codeB }); + assert.equal((await d.release()).status, 200); + assert.equal((await c.release()).status, 200); + assert.deepEqual((await state()).codes, {}, 'later commits cannot resurrect another consumed code'); +}); + +test('held-body firewall calls acknowledge one effect and retain truthful counters', { timeout: 20_000 }, async (t) => { + const { port, state } = await fixture(t); + const a = await heldRequest(port, '/api/firewall/apply', firewall, { authorization }); + const b = await heldRequest(port, '/api/firewall/apply', firewall, { authorization }); + assert.equal((await b.release()).status, 200); + assert.equal((await a.release()).status, 409); + const committed = await state(); + assert.equal(committed.firewallApplied, true); + assert.equal(committed.providerCalls, 2); + assert.equal(committed.timeline.filter((entry) => entry.type === 'effect').length, 1); +}); + +test('held-body approvals retain both committed increments and timeline events', { timeout: 20_000 }, async (t) => { + const { port, state } = await fixture(t); + const redeemed = await request(port, '/token', { + code: await code(port, 'auths-incident-agent'), code_verifier: verifier, redirect_uri: redirectUri, + }); + assert.equal(redeemed.status, 200); + const headers = { authorization: `Bearer ${redeemed.body.access_token}` }; + const approval = { requestId: 'synthetic-request', transactionDigest: 'synthetic-digest', planCommitment: 'synthetic-plan' }; + const a = await heldRequest(port, '/api/approve', approval, headers); + const b = await heldRequest(port, '/api/approve', approval, headers); + assert.equal((await a.release()).status, 200); + assert.equal((await b.release()).status, 200); + const committed = await state(); + assert.equal(committed.approvals, 2); + assert.equal(committed.timeline.filter((entry) => entry.type === 'approval').length, 2); +}); + +test('reset orders held token and provider requests against current state', { timeout: 20_000 }, async (t) => { + const { port, state } = await fixture(t); + const oldCode = await code(port); + const token = await heldRequest(port, '/token', { code: oldCode, code_verifier: verifier, redirect_uri: redirectUri }); + const apply = await heldRequest(port, '/api/firewall/apply', firewall, { authorization }); + assert.equal((await request(port, '/api/reset', {}, { authorization })).status, 200); + assert.equal((await apply.release()).status, 200); + assert.equal((await token.release()).status, 400); + let committed = await state(); + assert.deepEqual(committed.codes, {}); + assert.equal(committed.providerCalls, 1); + assert.equal(committed.timeline.length, 1); + + // A reset admitted first but completed after an effect must reset that + // committed effect; the next operation must evaluate the reset successor. + const reset = await heldRequest(port, '/api/reset', {}, { authorization }); + assert.equal((await request(port, '/api/firewall/apply', firewall, { authorization })).status, 409); + assert.equal((await reset.release()).status, 200); + assert.equal((await request(port, '/api/firewall/apply', firewall, { authorization })).status, 200); + committed = await state(); + assert.equal(committed.providerCalls, 1); + assert.equal(committed.timeline.length, 1); +}); + +test('body bounds and existing operation guards reject before mutation', { timeout: 20_000 }, async (t) => { + const { port, state } = await fixture(t); + assert.equal((await request(port, '/api/firewall/apply', firewall)).status, 401); + assert.equal((await request(port, '/api/firewall/apply', { ...firewall, region: 'elsewhere' }, { authorization })).status, 403); + assert.equal((await request(port, '/token', { code: await code(port), code_verifier: 'wrong', redirect_uri: redirectUri })).status, 400); + assert.equal((await request(port, '/api/firewall/apply', { padding: 'x'.repeat(32 * 1024) }, { authorization })).status, 413); + const committed = await state(); + assert.equal(committed.firewallApplied, false); + assert.equal(committed.providerCalls, 0); + assert.equal(committed.timeline.length, 0); +}); diff --git a/demos/cross-company-incident-response/scripts/test-local.sh b/demos/cross-company-incident-response/scripts/test-local.sh index a7cfe34fa..ecadeda4d 100755 --- a/demos/cross-company-incident-response/scripts/test-local.sh +++ b/demos/cross-company-incident-response/scripts/test-local.sh @@ -33,6 +33,7 @@ PYTHONPATH="$repo_root/bindings/python/python:$demo_dir/agent-service" \ uv run --with-requirements "$demo_dir/agent-service/requirements.txt" \ pytest -q "$demo_dir/agent-service/tests" python3 "$demo_dir/tests/integration.py" +node --test "$demo_dir/northstar-service/tests/state-ownership.mjs" node "$demo_dir/tests/browser-smoke.mjs" cargo test -p auths-cross-company-incident-edgeshield-demo echo "auths-incident-demo local validation passed" diff --git a/demos/cross-company-incident-response/tests/browser-smoke.mjs b/demos/cross-company-incident-response/tests/browser-smoke.mjs index 5f6220b13..75472598a 100644 --- a/demos/cross-company-incident-response/tests/browser-smoke.mjs +++ b/demos/cross-company-incident-response/tests/browser-smoke.mjs @@ -1,5 +1,8 @@ import assert from "node:assert/strict"; import { chromium } from "../../../bindings/typescript/node_modules/playwright/index.mjs"; +import { viewerScopeContract } from "./viewer-scope-contract.mjs"; + +await viewerScopeContract(); const base = process.env.AUTHS_INCIDENT_CONTROL_ROOM ?? "http://localhost:7100"; const browser = await chromium.launch({ headless: true }); @@ -44,6 +47,13 @@ try { await page.getByRole("button", { name: label }).click(); await page.locator("#attack-output .blocked").waitFor({ timeout: 15_000 }); assert.match(await page.locator("#attack-output").innerText(), /BLOCKED/); + if (label === "Withdraw approval mid-plan") { + const evidence = await page.locator("#attack-output").innerText(); + assert.match(evidence, /approval\.incomplete/); + assert.match(evidence, /"firstDecision": "authorized"/); + assert.match(evidence, /"status": "declined"/); + assert.match(evidence, /"providerCalls": 0/); + } } } finally { await browser.close(); diff --git a/demos/cross-company-incident-response/tests/local-withdrawal-contract.mjs b/demos/cross-company-incident-response/tests/local-withdrawal-contract.mjs new file mode 100644 index 000000000..aabd7a3e1 --- /dev/null +++ b/demos/cross-company-incident-response/tests/local-withdrawal-contract.mjs @@ -0,0 +1,72 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; + +/** Run the shipped controller's local approval proof against its real public SDK. */ +export async function localWithdrawalContract() { + const root = new URL("../control-room/public/", import.meta.url); + const previousFetch = globalThis.fetch; + let networkCalls = 0; + const refuseNetwork = async () => { + networkCalls++; + throw new Error("local withdrawal evidence must not call an API or provider"); + }; + globalThis.fetch = refuseNetwork; + let timer; + try { + // These are the public entrypoints copied by the maintained control-room + // build. Their real packaged WASM loader uses local files under Node. + const [selfHosted, testkit, verifier] = await Promise.all([ + import(new URL("vendor-v3/dist/self-hosted.js", root).href), + import(new URL("vendor-v3/dist/testkit/index.js", root).href), + import(new URL("vendor-v3/dist/verify.js", root).href), + ]); + const modules = new Map([ + ["@auths-dev/sdk/self-hosted", selfHosted], + ["@auths-dev/sdk/testkit", testkit], + ["@auths-dev/sdk/verify", verifier], + ]); + const bindings = {}; + const shipped = await readFile(new URL("app.js", root), "utf8"); + assert.match(shipped, /wire\(\);\s*await bootstrap\(\);\s*$/); + const controller = shipped.replace( + /^import\s*\{([^}]+)\}\s*from\s*["']([^"']+)["'];\r?\n/gm, + (_statement, names, specifier) => { + const namespace = modules.get(specifier); + assert.ok(namespace, `unexpected controller import ${specifier}`); + for (const name of names.split(",").map((item) => item.trim()).filter(Boolean)) { + assert.equal(typeof namespace[name], "function", `missing public SDK function ${name}`); + bindings[name] = namespace[name]; + } + return ""; + }, + ).replace(/wire\(\);\s*await bootstrap\(\);\s*$/, ""); + assert.doesNotMatch(controller, /^import\s/m); + // Evaluate the unmodified function bodies in the same JS realm as the SDK: + // schema checks intentionally reject foreign-realm object prototypes. + // Only browser bootstrap/network is excluded; cryptography, native approval + // collection and verification are the actual shipped implementation. + const load = new Function(...Object.keys(bindings), "sessionStorage", "fetch", + `"use strict";\n${controller}\nreturn liveWithdrawalAttack;`); + const prove = load(...Object.values(bindings), { getItem: () => null }, refuseNetwork); + const deadline = new Promise((_resolve, reject) => { + timer = setTimeout(() => reject(new Error("local withdrawal contract exceeded its diagnostic bound")), 20_000); + }); + const result = await Promise.race([prove(), deadline]); + assert.equal(result.blocked, true); + assert.equal(result.stage, "approval"); + assert.equal(result.code, "approval.incomplete"); + assert.equal(result.evidence.firstDecision, "authorized"); + assert.equal(result.evidence.secondApproved, 0); + assert.deepEqual(result.evidence.approvedSteps, ["firewall-eu-west-2"]); + assert.deepEqual(result.evidence.unresolved, ["cache-eu-west-2"]); + assert.equal(result.evidence.secondStatuses.length, 1); + assert.equal(result.evidence.secondStatuses[0].status, "declined"); + assert.match(result.evidence.firstProof, /^[A-Za-z0-9_-]+$/); + assert.match(result.evidence.decline, /^auths-as2-/); + assert.equal(result.evidence.providerCalls, 0); + assert.equal(networkCalls, 0); + } finally { + clearTimeout(timer); + globalThis.fetch = previousFetch; + } +} diff --git a/demos/cross-company-incident-response/tests/viewer-scope-contract.mjs b/demos/cross-company-incident-response/tests/viewer-scope-contract.mjs new file mode 100644 index 000000000..75f7d0fd4 --- /dev/null +++ b/demos/cross-company-incident-response/tests/viewer-scope-contract.mjs @@ -0,0 +1,102 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import vm from "node:vm"; +import { localWithdrawalContract } from "./local-withdrawal-contract.mjs"; + +const turn = () => new Promise(setImmediate); + +/** Exercise the shipped controller with controlled fetches, independent of OIDC timing. */ +export async function viewerScopeContract() { + const source = (await readFile(new URL("../control-room/public/app.js", import.meta.url), "utf8")) + .replace(/^import[\s\S]*?;\r?\n/gm, "") + .replace(/wire\(\);\s*await bootstrap\(\);\s*$/, ""); + for (const order of ["old-first", "public-first"]) { + for (const publicFailure of [false, true]) { + for (const oldFailure of [false, true]) { + const nodes = new Map(); + const get = (id) => { + if (!nodes.has(id)) nodes.set(id, { + innerHTML: "", textContent: "", dataset: {}, listeners: {}, + classList: { add() {}, remove() {}, toggle() {} }, + replaceChildren() { this.innerHTML = ""; this.textContent = ""; }, + addEventListener(event, action) { this.listeners[event] = action; }, + }); + return nodes.get(id); + }; + const publicButton = get("public"); + publicButton.dataset.receiptRole = "public"; + const storage = new Map([["auths.incident.viewer-token", "auditor"]]); + const requests = []; + const context = vm.createContext({ + URL, URLSearchParams, + location: { search: "?code=one&state=expected", origin: "http://localhost", pathname: "/" }, + history: { replaceState() {} }, + sessionStorage: { getItem: (key) => storage.get(key) ?? null, + setItem: (key, value) => storage.set(key, value), removeItem: (key) => storage.delete(key) }, + document: { getElementById: get, + querySelectorAll: (selector) => selector === "[data-receipt-role]" ? [publicButton] : [] }, + fetch(url, options) { return new Promise((resolve, reject) => requests.push({ url, options, resolve, reject })); }, + }); + vm.runInContext(source, context); + vm.runInContext('wire(); state = { receiptView: "full", receipts: [{ state: "PRIVATE-EVIDENCE", outcome: "committed" }] }; render();', context); + assert.match(get("receipts").innerHTML, /PRIVATE-EVIDENCE/); + const old = vm.runInContext("refresh()", context); + publicButton.listeners.click(); + assert.equal(requests.length, 4); + assert.equal(requests[0].options.headers.authorization, "Bearer auditor"); + assert.equal(requests[2].options.headers.authorization, undefined); + assert.equal(get("receipts").innerHTML, ""); + assert.equal(vm.runInContext("state.receipts.length", context), 0); + const respond = async (offset, failure, body) => { + requests[offset].resolve({ ok: !failure, json: async () => body }); + requests[offset + 1].resolve({ ok: true, json: async () => ({}) }); + await turn(); + }; + const releaseOld = () => respond(0, oldFailure, { receiptView: "full", + receipts: [{ state: "PRIVATE-EVIDENCE", outcome: "committed" }] }); + const releasePublic = () => respond(2, publicFailure, { receiptView: "opaque", receipts: [] }); + if (order === "old-first") { + await releaseOld(); + assert.doesNotMatch(get("receipts").innerHTML, /PRIVATE-EVIDENCE/); + await releasePublic(); + } else { + await releasePublic(); + await releaseOld(); + } + await old; // A stale failure is consumed, not republished or rethrown. + assert.doesNotMatch(get("receipts").innerHTML, /PRIVATE-EVIDENCE/); + assert.equal(vm.runInContext("state.receipts.length", context), 0); + assert.match(get("receipt-access-status").textContent, + publicFailure ? /unavailable/ : /Unauthenticated viewer/); + + if (order === "old-first" && !publicFailure && !oldFailure) { + // A token response from an older callback is also a publication: + // public selection must not let it revive the auditor scope. + for (const completion of ["success", "fetch-error", "json-error"]) { + storage.set("auths.incident.oauth-state", "expected"); + storage.set("auths.incident.pkce-verifier", "verifier"); + vm.runInContext('state.identityProvider = "http://identity.example"', context); + const offset = requests.length; + const login = vm.runInContext("completeViewerLogin()", context); + assert.equal(requests.length, offset + 1); + publicButton.listeners.click(); + if (completion === "fetch-error") { + requests[offset].reject(new Error("old login network failure")); + } else { + requests[offset].resolve({ ok: true, json: async () => { + if (completion === "json-error") throw new SyntaxError("old login invalid JSON"); + return { access_token: "late-auditor" }; + } }); + } + await login; + assert.equal(storage.has("auths.incident.viewer-token"), false); + assert.equal(vm.runInContext("viewerToken", context), ""); + await respond(offset + 1, false, { receiptView: "opaque", receipts: [] }); + assert.doesNotMatch(get("receipts").innerHTML, /PRIVATE-EVIDENCE/); + } + } + } + } + } + await localWithdrawalContract(); +} diff --git a/demos/rest-api-authorization/tests/web-smoke.mjs b/demos/rest-api-authorization/tests/web-smoke.mjs index 5ec578007..940723c22 100644 --- a/demos/rest-api-authorization/tests/web-smoke.mjs +++ b/demos/rest-api-authorization/tests/web-smoke.mjs @@ -1,6 +1,7 @@ import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; import test from "node:test"; +import vm from "node:vm"; const root = new URL("../", import.meta.url); @@ -29,3 +30,93 @@ test("frontend calls both real delivery paths", async () => { }); test("frontend_calls_both_real_delivery_paths", () => assert.ok(true)); + +function deferred() { + let resolve; + const promise = new Promise((yes) => { resolve = yes; }); + return { promise, resolve }; +} + +function browserSurface() { + const elements = new Map(); + const get = (id) => { + if (!elements.has(id)) elements.set(id, { + textContent: "", disabled: false, hidden: false, dataset: {}, + classList: { add() {}, remove() {}, toggle() {} }, + setAttribute() {}, removeAttribute() {}, listeners: {}, + addEventListener(event, callback) { this.listeners[event] = callback; }, + }); + return elements.get(id); + }; + const experiments = ["exact-create", "bounded-create", "exact-read"].map((id) => { + const button = get(id); button.dataset.experiment = id; return button; + }); + const transports = ["https", "iroh"].map((id) => { + const button = get(id); button.dataset.transport = id; return button; + }); + return { get, document: { + getElementById: get, + querySelectorAll: (selector) => selector === "[data-experiment]" ? experiments : transports, + querySelector: () => get("exact-read"), + } }; +} + +const turn = () => new Promise(setImmediate); +const session = (id) => ({ + session_id: id, required_configuration: { maximum_response_bytes: 128 }, + executed_configuration: { maximum_response_bytes: 128 }, policy: { maximum_creates: 2, maximum_created_bytes: 128 }, + operation_id: "records.create.v1", proof_hex: id, presentation_hex: id, + action: { action: { record_id: id, customer: { name: id } } }, +}); +const outcome = (id) => ({ receipt: { + decision: { receipt_id: id, decision: { class: "authorized", code: "authorized", stage: "complete" }, + auths_decision: "authorized", protected_storage_accessed: true }, + delivery: { adapter: "https" }, effect: {}, observation: {}, +} }); + +for (const order of ["execution-first", "preparation-first"]) { + test(`U1: stale execution cannot publish or release another operation (${order})`, async () => { + const surface = browserSurface(); + const requests = []; + const context = vm.createContext({ document: surface.document, + fetch(url, options) { const response = deferred(); requests.push({ url, options, response }); return response.promise; }, + }); + vm.runInContext(await readFile(new URL("web/app.js", root), "utf8"), context); + const respond = async (index, body) => { + requests[index].response.resolve({ ok: true, json: async () => body }); + await turn(); + }; + await respond(0, session("A")); + const a = vm.runInContext("execute()", context); + assert.equal(requests[1].options.headers["auths-session"], "A"); + surface.get("bounded-create").listeners.click(); + assert.equal(requests.length, 3); + if (order === "execution-first") { + await respond(1, outcome("receipt-A")); + await a; + assert.equal(surface.get("execute").disabled, true); + assert.equal(vm.runInContext("state.operation.kind", context), "preparing"); + await respond(2, session("B")); + } else { + await respond(2, session("B")); + } + const b = vm.runInContext("execute()", context); + assert.equal(requests[3].options.headers["auths-session"], "B"); + if (order === "preparation-first") { + await respond(1, outcome("receipt-A")); + await a; + assert.equal(surface.get("execute").disabled, true); + assert.equal(vm.runInContext("state.operation.session.session_id", context), "B"); + } + assert.doesNotMatch(surface.get("receipt-json").textContent, /receipt-A/); + assert.equal(vm.runInContext("state.readSource", context), null); + assert.equal(vm.runInContext("state.boundedSource", context), null); + await respond(3, outcome("receipt-B")); + await b; + assert.match(surface.get("receipt-json").textContent, /receipt-B/); + assert.match(surface.get("business-response").textContent, /"record_id": "B"/); + assert.equal(vm.runInContext("state.readSource", context), "B"); + assert.equal(vm.runInContext("state.boundedSource", context), "B"); + assert.equal(surface.get("execute").disabled, false); + }); +} diff --git a/demos/rest-api-authorization/web/app.js b/demos/rest-api-authorization/web/app.js index 2e5501465..f108c2e52 100644 --- a/demos/rest-api-authorization/web/app.js +++ b/demos/rest-api-authorization/web/app.js @@ -2,7 +2,8 @@ const state = { experiment: "exact-create", transport: "https", session: null, - busy: false, + generation: 0, + operation: null, readSource: null, boundedSource: null, }; @@ -19,34 +20,52 @@ async function jsonFetch(url, options = {}) { } async function prepare() { - state.busy = true; + const operation = { + generation: ++state.generation, + kind: "preparing", + experiment: state.experiment, + transport: state.transport, + }; + state.operation = operation; + state.session = null; $("execute").disabled = true; setVerdict("LOADING", "loading", "Issuing a short-lived proof and presenter-bound request."); resetResult(); try { - const input = { experiment: state.experiment }; - if (state.experiment === "exact-read") input.source_session_id = state.readSource; - if (state.experiment === "bounded-create" && state.boundedSource) { + const input = { experiment: operation.experiment }; + if (operation.experiment === "exact-read") input.source_session_id = state.readSource; + if (operation.experiment === "bounded-create" && state.boundedSource) { input.source_session_id = state.boundedSource; } - state.session = await jsonFetch("/api/v1/sessions", { + const session = await jsonFetch("/api/v1/sessions", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(input), }); + if (!current(operation)) return; + state.session = session; renderSession(); $("service-state").textContent = "ready"; $("service-indicator").classList.add("ready"); setVerdict("READY", "ready", "The proof and exact request are ready. Call the protected API to see the native verdict."); $("execute").disabled = false; } catch (error) { + if (!current(operation)) return; setVerdict("UNAVAILABLE", "denied", error.message); $("service-state").textContent = "unavailable"; } finally { - state.busy = false; + if (current(operation)) { + state.operation = null; + $("execute").disabled = !state.session; + } } } +// Invalidating a view never claims that an already sent effect was cancelled. +function current(operation) { + return state.operation === operation && state.generation === operation.generation; +} + function renderSession() { const session = state.session; const required = session.required_configuration.maximum_response_bytes; @@ -77,23 +96,34 @@ function renderSession() { } async function execute() { - if (!state.session || state.busy) return; - state.busy = true; + if (!state.session || state.operation) return; + const operation = { + generation: ++state.generation, + kind: "executing", + session: state.session, + experiment: state.experiment, + transport: state.transport, + }; + state.operation = operation; $("execute").disabled = true; setVerdict("CHECKING", "loading", "The native service is verifying the exact proof, presentation, action, policy, and configuration."); try { - const outcome = state.transport === "https" ? await executeHttps() : await executeIroh(); - renderOutcome(outcome); + const outcome = operation.transport === "https" + ? await executeHttps(operation.session) : await executeIroh(operation.session); + if (!current(operation)) return; + renderOutcome(outcome, operation); } catch (error) { + if (!current(operation)) return; setVerdict("ERROR", "denied", error.message); } finally { - state.busy = false; - $("execute").disabled = false; + if (current(operation)) { + state.operation = null; + $("execute").disabled = false; + } } } -async function executeHttps() { - const session = state.session; +async function executeHttps(session) { const action = session.action; const headers = { "content-type": "application/json", @@ -111,15 +141,16 @@ async function executeHttps() { return jsonFetch(`/v1/records/${encodeURIComponent(action.action.record_id)}`, { headers }); } -async function executeIroh() { - return jsonFetch(`/api/v1/sessions/${state.session.session_id}/execute-iroh`, { +async function executeIroh(session) { + return jsonFetch(`/api/v1/sessions/${session.session_id}/execute-iroh`, { method: "POST", headers: { "content-type": "application/json" }, body: "{}", }); } -function renderOutcome(outcome) { +function renderOutcome(outcome, operation) { + const session = operation.session; const receipt = outcome.receipt; const decision = receipt.decision.decision; const authorized = decision.class === "authorized"; @@ -142,25 +173,25 @@ function renderOutcome(outcome) { ? "COMMITTED" : "UNCHANGED"; $("observation-status").textContent = receipt.observation ? "RECORDED" : "NONE"; - renderBusinessResponse(outcome, authorized); + renderBusinessResponse(outcome, authorized, session); $("receipt-json").textContent = JSON.stringify(receipt, null, 2); const link = $("receipt-link"); link.href = `/receipts/${receipt.decision.receipt_id}`; link.classList.remove("disabled"); link.removeAttribute("aria-disabled"); - if (authorized && state.session.operation_id === "records.create.v1") { - state.readSource = state.session.session_id; + if (authorized && session.operation_id === "records.create.v1") { + state.readSource = session.session_id; const readButton = document.querySelector('[data-experiment="exact-read"]'); readButton.disabled = false; readButton.title = ""; - if (state.experiment === "bounded-create") { - state.boundedSource = state.session.session_id; + if (operation.experiment === "bounded-create") { + state.boundedSource = session.session_id; $("next-action").disabled = false; } } } -function renderBusinessResponse(outcome, authorized) { +function renderBusinessResponse(outcome, authorized, session) { const card = $("api-response"); if (!authorized) { card.dataset.state = "empty"; @@ -168,14 +199,14 @@ function renderBusinessResponse(outcome, authorized) { $("business-response").textContent = JSON.stringify({ response: null }, null, 2); return; } - const action = state.session.action.action; + const action = session.action.action; const response = outcome.response || { record_id: action.record_id, customer: action.customer, version: 1, }; card.dataset.state = "returned"; - $("response-detail").textContent = state.session.operation_id === "records.read.v1" + $("response-detail").textContent = session.operation_id === "records.read.v1" ? "The authorized fields were read from the protected store and returned to the caller." : "The fictional customer was written to the protected store."; $("business-response").textContent = JSON.stringify({ response }, null, 2); @@ -222,7 +253,15 @@ experiments.forEach((button) => button.addEventListener("click", () => { transports.forEach((button) => button.addEventListener("click", () => { transports.forEach((item) => item.classList.toggle("active", item === button)); state.transport = button.dataset.transport; - if (state.session) renderSession(); + ++state.generation; + state.operation = null; + resetResult(); + if (state.session) { + renderSession(); + $("execute").disabled = false; + } else { + prepare(); + } })); $("execute").addEventListener("click", execute); diff --git a/demos/stripe-gateway/README.md b/demos/stripe-gateway/README.md index d69441350..a11acd25f 100644 --- a/demos/stripe-gateway/README.md +++ b/demos/stripe-gateway/README.md @@ -105,9 +105,21 @@ gateway client; its closed experiment replays the same original packet. Operator-only diagnosis uses the shipped general CLI: +Each gateway owns a separate protected parent: +`/run/demo/sockets/gateway0/app.sock` through `gateway2/app.sock`. The +gateway UID owns each directory with mode `0750`; application group `62005` +can traverse it and access the `0660` socket, but cannot replace serving locks. +Only the native gateway recovers or removes socket paths. The operator waits +for that child process's bounded `app socket ready` event and retains it in the +private gateway log; an existing socket pathname never indicates startup success. +The operator review endpoint stays `/run/demo/sockets/review.sock` and is +configured independently with `--review-socket`. Changing an application +`--socket` never changes the review endpoint. The operator passes all endpoints +explicitly to its application processes. + ```sh docker exec auths-stripe-gateway-demo /opt/demo/bin/auths-gateway-simulation \ - doctor --state-dir /run/demo/gateway0 --app-socket /run/demo/sockets/app0.sock \ + doctor --state-dir /run/demo/gateway0 --app-socket /run/demo/sockets/gateway0/app.sock \ --app-uid 62004 --app-gid 62005 docker exec auths-stripe-gateway-demo /opt/demo/bin/auths-gateway-simulation \ support-bundle --state-dir /run/demo/gateway0 diff --git a/demos/stripe-gateway/app.py b/demos/stripe-gateway/app.py index 40ed6c20d..24563a7e5 100644 --- a/demos/stripe-gateway/app.py +++ b/demos/stripe-gateway/app.py @@ -21,7 +21,8 @@ GatewaySignedObservation) from auths.self_hosted import load_signer_file -from demo_common import Refusal, b64, canonical, decode, read, require, unb64, write +from demo_common import (Refusal, application_socket_paths, b64, canonical, decode, + read, require, unb64, write) from generated import CONTRACT, CreateRefund HERE = Path(__file__).resolve().parent @@ -39,12 +40,13 @@ def approval_target(_label, arguments): class Application: - def __init__(self, directory, sockets): + def __init__(self, directory, sockets, *, review_socket): self.directory = Path(directory) self.plan = decode(read(self.directory / 'application.json')) require(self.plan['schema'] == 'auths.stripe-gateway-demo/1', 'demo.invalid-plan') require(set(self.plan['cases']) == set(LABELS), 'demo.invalid-cases') self.sockets = [Path(path) for path in sockets] + self.review_socket = Path(review_socket) self.clients = [GatewayClient(GatewayEndpoint(path)) for path in self.sockets] require(len(self.clients) == 3, 'demo.race-and-fresh-context-gateways-required') self.signer = load_signer_file(self.directory / 'actor.json').signer @@ -183,7 +185,7 @@ async def recover(self, source): def request_review(): with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as channel: channel.settimeout(660 if self.plan['mode'] == 'live' else 90) - channel.connect(str(self.sockets[0].parent / 'review.sock')) + channel.connect(str(self.review_socket)) payload = canonical({'source': source}) channel.sendall(struct.pack('>I', len(payload)) + payload) def receive(length): @@ -349,12 +351,13 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('--application', type=Path, default=Path('/run/demo/app')) parser.add_argument('--socket', action='append', default=[]) + parser.add_argument('--review-socket', type=Path, default=Path('/run/demo/sockets/review.sock')) parser.add_argument('--port', type=int, default=8080) parser.add_argument('command', choices=['serve', 'status', 'submit', 'export']) parser.add_argument('--experiment', choices=EXPERIMENTS, default='exact') args = parser.parse_args() - application = Application(args.application, args.socket or ['/run/demo/sockets/app0.sock', - '/run/demo/sockets/app1.sock', '/run/demo/sockets/app2.sock']) + application = Application(args.application, args.socket or application_socket_paths('/run/demo'), + review_socket=args.review_socket) if args.command == 'serve': serve(application, args.port) elif args.command == 'status': diff --git a/demos/stripe-gateway/demo_common.py b/demos/stripe-gateway/demo_common.py index 366ae7bb5..c9455afee 100644 --- a/demos/stripe-gateway/demo_common.py +++ b/demos/stripe-gateway/demo_common.py @@ -4,10 +4,52 @@ import json import os from pathlib import Path +import selectors +import time MAX_FILE = 4 * 1024 * 1024 +def application_socket_paths(home): + """One protected socket parent per independently serving gateway.""" + root = Path(home) / 'sockets' + return tuple(root / ('gateway' + str(host)) / 'app.sock' for host in range(3)) + + +def create_socket_directories(home, application_gid): + """Gateway UID owns each parent; the application group may traverse only.""" + root = Path(home) / 'sockets' + paths = application_socket_paths(home) + for directory in (root, *(path.parent for path in paths)): + directory.mkdir(mode=0o750) + os.chown(directory, os.getuid(), application_gid) + os.chmod(directory, 0o750) + return paths + + +def wait_gateway_ready(process, log, *, timeout=20): + """Wait for this process's bounded native readiness event, not a pathname.""" + require(process.stdout is not None, 'demo.gateway-start-refused') + deadline = time.monotonic() + timeout + output = bytearray() + with selectors.DefaultSelector() as selector: + selector.register(process.stdout, selectors.EVENT_READ) + while len(output) <= 65536: + remaining = deadline - time.monotonic() + require(remaining > 0 and selector.select(remaining), 'demo.gateway-start-timeout') + chunk = os.read(process.stdout.fileno(), min(4096, 65537 - len(output))) + require(bool(chunk), 'demo.gateway-start-refused') + log.write(chunk) + log.flush() + output.extend(chunk) + if b'\n' in output: + line = output.split(b'\n', 1)[0] + require(len(output) <= 65536 and line.startswith(b'app socket ready') + and process.poll() is None, 'demo.gateway-start-refused') + return + raise Refusal('demo.gateway-start-refused') + + class Refusal(ValueError): pass diff --git a/demos/stripe-gateway/operate.py b/demos/stripe-gateway/operate.py index ff0f13d96..b24c4864c 100644 --- a/demos/stripe-gateway/operate.py +++ b/demos/stripe-gateway/operate.py @@ -25,7 +25,8 @@ AssuranceRequirement, Permission, Profile, TrustAnchor, TrustedContextRequest, author_root_grant, compile_trusted_context, load_signer_file) -from demo_common import Refusal, b64, canonical, decode, digest, read, require, unb64, write +from demo_common import (Refusal, b64, canonical, create_socket_directories, decode, + digest, read, require, unb64, wait_gateway_ready, write) from app import Application, LABELS, approval_target HERE = Path(__file__).resolve().parent @@ -294,37 +295,36 @@ def __init__(self, mode): self.mode, self.processes, self.double, self.resources = mode, [], None, None self.binary = HERE / 'bin' / ('auths-gateway-simulation' if mode == 'simulation' else 'auths-gateway') self.keys, self.sockets = {}, HOME / 'sockets' - self.sockets.mkdir(mode=0o750) - os.chown(self.sockets, 0, APP_GID) + self.app_sockets = create_socket_directories(HOME, APP_GID) + self.review_socket = self.sockets / 'review.sock' self.port = None self.effect_reviewer = development_ed25519_identity_key() def start_gateway(self, host): - socket_path = self.sockets / ('app' + str(host) + '.sock') - socket_path.unlink(missing_ok=True) + socket_path = self.app_sockets[host] state = HOME / ('gateway' + str(host)) - (state / 'admin.sock').unlink(missing_ok=True) args = [self.binary, 'serve', '--state-dir', state, '--app-socket', socket_path] if self.port is not None: args.extend(['--loopback-provider', self.port]) log = open(HOME / 'private' / ('gateway-' + str(host) + '.log'), 'ab') - process = subprocess.Popen(list(map(str, args)), env=ENVIRONMENT, stdout=log, stderr=log) + try: + process = subprocess.Popen(list(map(str, args)), env=ENVIRONMENT, + stdout=subprocess.PIPE, stderr=log) + except BaseException: + log.close() + raise self.processes.append((process, log, host)) - deadline = time.monotonic() + 20 - while time.monotonic() < deadline: - require(process.poll() is None, 'demo.gateway-start-refused') - if socket_path.exists(): - os.chown(socket_path, 0, APP_GID) - os.chmod(socket_path, 0o660) - return - time.sleep(0.05) - raise Refusal('demo.gateway-start-timeout') + wait_gateway_ready(process, log) + os.chown(socket_path, 0, APP_GID) + os.chmod(socket_path, 0o660) def restart(self, host): for process, log, number in list(self.processes): if number == host: process.terminate() process.wait(timeout=10) + if process.stdout is not None: + process.stdout.close() log.close() self.processes.remove((process, log, number)) self.start_gateway(host) @@ -461,8 +461,8 @@ def exact_approval(self, state, name, proof, action, *mode): def prepare_exact_approvals(self, plan): """Preapprove finite scripted mutations; refusals use an explicitly substituted approval.""" - application = Application(HOME / 'app', [self.sockets / ('app' + str(host) + '.sock') - for host in range(3)]) + application = Application(HOME / 'app', self.app_sockets, + review_socket=self.review_socket) values, reviews = {}, {} for label in LABELS: proof, action, _ = asyncio.run(application.packet(label)) @@ -535,7 +535,7 @@ def receive(length): require(len(raw) <= 4 * 1024 * 1024, 'demo.review-response-bound') self.request.sendall(struct.pack('>I', len(raw)) + raw) - path = self.sockets / 'review.sock' + path = self.review_socket server = socketserver.UnixStreamServer(str(path), Handler) os.chown(path, 0, APP_GID) os.chmod(path, 0o660) @@ -543,8 +543,15 @@ def receive(length): thread.start() self.review_server, self.review_thread = server, thread + def application_command(self, *arguments): + command = ['/opt/consumer/bin/python', str(HERE / 'app.py'), + '--application', str(HOME / 'app'), '--review-socket', str(self.review_socket)] + for socket_path in self.app_sockets: + command.extend(['--socket', str(socket_path)]) + return [*command, *arguments] + def application(self, *arguments): - return subprocess.run(['/opt/consumer/bin/python', str(HERE / 'app.py'), *arguments], + return subprocess.run(self.application_command(*arguments), env=ENVIRONMENT, capture_output=True, user=APP_UID, group=APP_GID, extra_groups=[], timeout=90) def export_audit(self, destination): @@ -577,6 +584,8 @@ def stop(self): except subprocess.TimeoutExpired: process.kill() process.wait() + if process.stdout is not None: + process.stdout.close() log.close() self.processes.clear() if self.double: @@ -608,8 +617,7 @@ def interrupted(*_): from selftest import run run(operator) else: - process = subprocess.Popen(['/opt/consumer/bin/python', str(HERE / 'app.py'), - 'serve', '--port', str(args.port)], env=ENVIRONMENT, + process = subprocess.Popen(operator.application_command('serve', '--port', str(args.port)), env=ENVIRONMENT, user=APP_UID, group=APP_GID, extra_groups=[]) operator.processes.append((process, open(os.devnull, 'wb'), -1)) require(process.wait() == 0, 'demo.application-exited') diff --git a/demos/stripe-gateway/selftest.py b/demos/stripe-gateway/selftest.py index a9f115808..52d4dc366 100644 --- a/demos/stripe-gateway/selftest.py +++ b/demos/stripe-gateway/selftest.py @@ -202,7 +202,7 @@ def test_application_isolation_and_native_audit(operator): user=APP_UID, group=APP_GID, extra_groups=[], env=ENVIRONMENT) require(probe.returncode == 0, 'demo.selftest-application-secret-isolation') doctor = child([operator.binary, 'doctor', '--state-dir', HOME / 'gateway0', - '--app-socket', HOME / 'sockets/app0.sock', '--app-uid', APP_UID, '--app-gid', APP_GID], check=False) + '--app-socket', operator.app_sockets[0], '--app-uid', APP_UID, '--app-gid', APP_GID], check=False) doctor_value = decode(doctor.stdout) require(doctor_value.get('schema') == 'auths.gateway-readiness/1' and doctor_value.get('ready') is False and doctor.returncode != 0, @@ -305,7 +305,7 @@ def receive(length): """ before = operator.witnesses() result = subprocess.run(['/opt/consumer/bin/python', '-c', script, - str(HOME / 'sockets/review.sock')], user=APP_UID, group=APP_GID, extra_groups=[], + str(operator.review_socket)], user=APP_UID, group=APP_GID, extra_groups=[], env=ENVIRONMENT, capture_output=True, timeout=20) require(result.returncode == 0, 'demo.selftest-review-channel-unavailable') refusals = decode(result.stdout) @@ -315,8 +315,33 @@ def receive(length): 'returned_proof_or_approval': False} +def test_application_socket_topology(operator): + """The app can traverse three separate gateway-owned serving parents.""" + from operate import APP_UID, APP_GID, ENVIRONMENT + paths = operator.app_sockets + require(len(paths) == 3 and len({path.parent for path in paths}) == 3, + 'demo.selftest-gateway-socket-parents-shared') + require(operator.review_socket.parent not in {path.parent for path in paths}, + 'demo.selftest-review-endpoint-aliases-gateway-parent') + for path in paths: + info = path.parent.stat() + require(info.st_uid == 0 and info.st_gid == APP_GID and info.st_mode & 0o777 == 0o750, + 'demo.selftest-gateway-socket-parent-permissions') + require(path.is_socket(), 'demo.selftest-gateway-socket-unavailable') + probe = subprocess.run(['/opt/consumer/bin/python', '-c', + 'import os,sys; from pathlib import Path; ' + 'assert all(os.access(Path(p).parent, os.X_OK) and ' + 'not os.access(Path(p).parent, os.W_OK) and os.access(p, os.W_OK) for p in sys.argv[1:])', + *map(str, paths)], user=APP_UID, group=APP_GID, extra_groups=[], + env=ENVIRONMENT, capture_output=True, timeout=10) + require(probe.returncode == 0, 'demo.selftest-gateway-socket-traversal') + return {'independent_gateway_parents': 3, 'gateway_uid': 0, + 'application_group_traverse_only': True, 'operator_review_endpoint_separate': True} + + def run(operator): from operate import HOME + topology = test_application_socket_topology(operator) consent = test_exact_operator_consent_binding(operator) reviewer = test_private_reviewer_refuses_unlisted_inputs(operator) cases = test_native_refusals_replay_race_and_loss(operator) @@ -324,7 +349,8 @@ def run(operator): report = {'schema': 'auths.stripe-gateway-demo-evidence/1', 'mode': 'simulation', 'production_qualification': False, 'independent_human_trial': False, 'source_commit': decode(read(Path(__file__).parent / 'manifest.json'))['source_commit'], - 'operator_consent': consent, 'operator_review_channel': reviewer, 'cases': cases, **verified, + 'socket_topology': topology, 'operator_consent': consent, + 'operator_review_channel': reviewer, 'cases': cases, **verified, 'excluded': ['live Stripe writes', 'production AWS custody and PostgreSQL', 'protected full-corpus qualification', 'provider key rotation', 'independent security review', 'GitHub release installation']} diff --git a/demos/stripe-gateway/tests/test_launch.py b/demos/stripe-gateway/tests/test_launch.py index 406b198f6..1b2e69279 100644 --- a/demos/stripe-gateway/tests/test_launch.py +++ b/demos/stripe-gateway/tests/test_launch.py @@ -5,6 +5,9 @@ import os from pathlib import Path import stat +import socket +import subprocess +import sys import tempfile from types import SimpleNamespace import unittest @@ -13,9 +16,77 @@ spec = importlib.util.spec_from_file_location('demo_launch', Path(__file__).resolve().parents[1] / 'launch.py') launch = importlib.util.module_from_spec(spec) spec.loader.exec_module(launch) +common_spec = importlib.util.spec_from_file_location( + 'demo_socket_layout', Path(__file__).resolve().parents[1] / 'demo_common.py') +common = importlib.util.module_from_spec(common_spec) +common_spec.loader.exec_module(common) class LaunchTests(unittest.TestCase): + def test_readiness_is_a_native_process_event_and_is_retained_in_the_log(self): + command = [sys.executable, '-c', + 'import sys; print("app socket ready; fixture", flush=True); sys.stdin.buffer.read(1)'] + with subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) as process: + try: + log = io.BytesIO() + common.wait_gateway_ready(process, log, timeout=5) + self.assertEqual(log.getvalue(), b'app socket ready; fixture\n') + self.assertIsNone(process.poll()) + finally: + if process.poll() is None: + process.kill() + process.wait(timeout=5) + + def test_existing_socket_paths_are_not_readiness_or_cleanup_authority(self): + with tempfile.TemporaryDirectory(dir='/tmp') as directory: + app = Path(directory) / 'app.sock' + admin = Path(directory) / 'admin.sock' + with socket.socket(socket.AF_UNIX) as live: + live.bind(str(app)) + live.listen(1) + with socket.socket(socket.AF_UNIX) as stale: + stale.bind(str(admin)) + identities = [(path.stat().st_dev, path.stat().st_ino) for path in (app, admin)] + with subprocess.Popen([sys.executable, '-c', 'pass'], stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) as process: + with self.assertRaisesRegex(common.Refusal, 'demo.gateway-start-refused'): + common.wait_gateway_ready(process, io.BytesIO(), timeout=5) + process.wait(timeout=5) + self.assertEqual(identities, [(path.stat().st_dev, path.stat().st_ino) + for path in (app, admin)]) + with socket.socket(socket.AF_UNIX) as client: + client.settimeout(1) + client.connect(str(app)) + accepted, _ = live.accept() + accepted.close() + + def test_partial_readiness_line_has_a_bounded_deadline(self): + read_end, write_end = os.pipe() + try: + os.write(write_end, b'app socket ready; unterminated') + with os.fdopen(read_end, 'rb') as stdout: + process = SimpleNamespace(stdout=stdout, poll=lambda: None) + with self.assertRaisesRegex(common.Refusal, 'demo.gateway-start-timeout'): + common.wait_gateway_ready(process, io.BytesIO(), timeout=0.05) + finally: + os.close(write_end) + + def test_each_gateway_has_a_protected_application_socket_parent(self): + with tempfile.TemporaryDirectory() as directory: + paths = common.create_socket_directories(directory, os.getgid()) + self.assertEqual(paths, common.application_socket_paths(directory)) + self.assertEqual(len({path.parent for path in paths}), 3) + for host, path in enumerate(paths): + self.assertEqual(path, Path(directory) / 'sockets' / ('gateway' + str(host)) / 'app.sock') + for parent in (path.parent, path.parent.parent): + info = parent.stat() + self.assertEqual(info.st_uid, os.getuid()) + self.assertEqual(info.st_gid, os.getgid()) + self.assertEqual(stat.S_IMODE(info.st_mode), 0o750) + recovery = Path(directory) / 'sockets' / 'review.sock' + self.assertNotIn(recovery.parent, {path.parent for path in paths}) + def env(self, directory): path = Path(directory) / '.env' values = {name: 'simulation-value-' + str(index) for index, name in enumerate(launch.ENV_FIELDS.values())} diff --git a/deployment/gateway/README.md b/deployment/gateway/README.md index 501eff307..91d510211 100644 --- a/deployment/gateway/README.md +++ b/deployment/gateway/README.md @@ -20,7 +20,14 @@ Create group `auths-app-socket` (GID 62000), user `auths-gateway` (UID 62001), and application user (UID 62002). The gateway's primary group is `auths-app-socket`. Create `/var/lib/auths/gateway`, owned by UID 62001, mode 0700, and `/run/auths-app`, owned by UID 62001 and GID 62000, mode 0750. -Recreate the latter with a systemd tmpfiles rule at each boot. The application's +Recreate the latter with a systemd tmpfiles rule at each boot. This socket +parent belongs to one serving daemon. For several daemons on one host, allocate +separate canonical endpoint directories, for example `/run/auths-app/first` and +`/run/auths-app/second`, each owned by UID 62001 and GID 62000 with mode 0750. +Give each unit and its doctor probe the corresponding `app.sock` path and allow +that unit to write its own endpoint directory. Distinct socket filenames under +one parent do not provide separate serving ownership. Keep each admin socket +in its own installation directory at mode 0700. The application's only group access is the 0660 app socket; it cannot reach the gateway state, admin socket, workload token, operator identity or PostgreSQL client identity. Keep operator credentials in `/run/auths-identity/operator` and runtime @@ -103,8 +110,13 @@ provider bodies or account/resource names. Alert on failed doctor checks, qualification expiry/revocation-list next_update within 24 hours, untrusted clock, unknown/attempting backlog, missing slot sweep, incomplete shutdown, and credential deletion failure. Preserve the last report and stable codes. -A SIGTERM stops listeners, waits up to 25 seconds for admitted sessions, removes -socket paths, and reports incomplete drainage rather than success on timeout. +A SIGTERM stops listeners and waits up to 25 seconds for admitted sessions. +Successful drainage removes only the socket inodes this process bound, then +releases its serving claims. On timeout it reports `gateway.serve.shutdown-incomplete` +and exits unsuccessfully while claims and socket guards remain held; the OS +releases the claims at process termination. The successor recovers those dead +socket paths under its new claim. Do not delete serving lock files or socket +paths to force a concurrent start. ## Evidence and human trial diff --git a/deployment/gateway/tools/operator-simulation.py b/deployment/gateway/tools/operator-simulation.py index 418aec295..a3375e62c 100644 --- a/deployment/gateway/tools/operator-simulation.py +++ b/deployment/gateway/tools/operator-simulation.py @@ -100,7 +100,16 @@ def start(self, state): started = time.monotonic() record = {"step": "start-" + state.name, "command": "serve", "passed": False} self.steps.append(record) - app = self.sockets / (state.name + ".sock") + # Serving ownership covers the endpoint parent, including leaf aliases. + # Simulated hosts therefore need separate protected socket directories; + # app group traversal stays available without exposing their state. + endpoint_directory = self.sockets / state.name + endpoint_directory.mkdir(mode=0o750, exist_ok=True) + require(not endpoint_directory.is_symlink() and endpoint_directory.is_dir(), + "simulation.socket-directory") + os.chown(endpoint_directory, self.uid, self.gid) + os.chmod(endpoint_directory, 0o750) + app = endpoint_directory / "app.sock" log = tempfile.TemporaryFile() process = subprocess.Popen( [str(self.binary), "serve", "--state-dir", str(state), "--app-socket", str(app)], diff --git a/docs/operations/GATEWAY_PRODUCTION_RUNBOOK.md b/docs/operations/GATEWAY_PRODUCTION_RUNBOOK.md index 587316378..58815bd30 100644 --- a/docs/operations/GATEWAY_PRODUCTION_RUNBOOK.md +++ b/docs/operations/GATEWAY_PRODUCTION_RUNBOOK.md @@ -40,6 +40,24 @@ installed candidate under the same native revision protocol. ## Diagnose and stop +Give every serving daemon its own canonical socket parent directories. An app +parent may be mode 0750 with the application's socket group, owned by the gateway +UID and closed to group/other writes; the admin parent remains owner-only. The +single-daemon systemd reference uses `/run/auths-app/gateway.sock` on each host. +For two daemons on one host, use separate protected parents such as +`/run/auths-app/first/app.sock` and `/run/auths-app/second/app.sock`, plus separate +installation/admin directories. Merely naming two sockets in the same parent +is unsupported. `gateway.serve.busy` means another serving generation owns the +installation or an endpoint parent, including while it drains. Keep the existing +`serving.lock` and `.auths-serving.lock` inodes; administrative operations use +separate locks and remain available while serving. + +SIGTERM stops admission, then waits up to 25 seconds for admitted work. Successful +drainage cleans only owned socket inodes before releasing claims. An overdue +drain reports `gateway.serve.shutdown-incomplete` and terminates with failure +while claims remain held, leaving dead sockets for the next claimed startup to +recover. Do not remove locks or sockets to bypass a live or draining owner. + For a loadable installation whose isolation probes complete, `doctor --state-dir ... --app-socket ... --app-uid ... --app-gid ...` prints all nine required typed checks and the optional observer state. If installation diff --git a/docs/operations/GATEWAY_TRUST_AND_GIT_SIGNING_RUNBOOK.md b/docs/operations/GATEWAY_TRUST_AND_GIT_SIGNING_RUNBOOK.md index ed80bd8a6..8ab586b8d 100644 --- a/docs/operations/GATEWAY_TRUST_AND_GIT_SIGNING_RUNBOOK.md +++ b/docs/operations/GATEWAY_TRUST_AND_GIT_SIGNING_RUNBOOK.md @@ -256,6 +256,14 @@ held which key, is operator evidence and is not produced by this code. `gateway.serve.accept-failed` and retried; it does not stop `serve`. - **Socket paths.** A Unix socket path must fit in the platform's `sun_path` with its terminating NUL: at most 103 bytes on macOS and 107 on Linux. + Every serving daemon exclusively owns its endpoint parent directories, even + when another daemon would choose different socket filenames. On one host, + allocate separate parents such as `/run/auths-app/first/app.sock` and + `/run/auths-app/second/app.sock`; a shared lifecycle store does not share socket + ownership. App parents must already be canonical, gateway-owned and closed to + group/other writes; mode 0750 permits the application's socket group to traverse + them. A competing start returns `gateway.serve.busy` while the current daemon + serves or drains. Do not delete its stable serving lock inodes. The admin socket defaults to `/admin.sock`, 11 bytes longer than the state directory, so a state directory longer than 92 bytes on macOS or 96 on Linux needs `serve --admin-socket `. The admin socket's parent diff --git a/docs/plans/0078-implementation-status.md b/docs/plans/0078-implementation-status.md new file mode 100644 index 000000000..c93f1978f --- /dev/null +++ b/docs/plans/0078-implementation-status.md @@ -0,0 +1,105 @@ +# AP078 implementation and evidence record + +Contract: [AP-SPEC-078](../specs/0078-residual-state-ownership.md). +Baseline: `e40bfdd32e3812ef349bb2db84faada443cb1938` (merged PR #217). +Branch: `codex/residual-state-ownership`. + +## Acceptance boundary + +The source audit and implementation are bounded to the owners below. Static +cross-review is not a successful dynamic reproduction, and a generated artifact +constructor is not the complete test suite. Final hosted results and the exact +accepted head belong in the implementation PR's acceptance attestation; recording +those results must not itself change the source revision under test. + +No merge, production qualification, global state-machine audit, physical +power-loss guarantee or authorization bypass is claimed by this record. + +## Requirement map + +Paths below are relative to the repository root. + +| Gates | Authoritative owner and regression owner | +| --- | --- | +| S1/S2 | Gateway `src/bin/auths-gateway.rs`: serving and protected endpoint-directory claims, inode-owned cleanup and overdue-drain process termination. Binary tests plus `tests/socket_paths.rs`, with retained operator/process drain tests. | +| Q1/Q2 | `bindings/python-adapters/sqlite/python/auths_sqlite/__init__.py`: retained worker cohort and shared close drain; immutable admission snapshot. `tests/test_sqlite_store.py` uses real commit and worker-entry barriers, cancellation, mutation, failure and reopen. | +| T1 | `bindings/typescript/src/internal/signing.ts`: original deadline and nondecreasing observations through signature acceptance. `test/helpers/signing-deadline-contract.mjs` is consumed by source and installed-package runners. | +| E1 | `exchange/crates/auths-proof-exchange-framing/src/lib.rs`: preflight versus admitted unavailable state. `interruption_tests.rs` controls partial headers/bodies, writes, response waits and shutdown deadlines. | +| E2 | Memory and HTTPS exchange adapters: claimed submission before delivery, unavailable after interruption. Memory tests retain a delivered request; HTTPS `delivery_tests.rs` uses an actual trusted local TLS peer and holds its response after reading the exact canonical request. | +| E3 | `exchange/adapters/auths-iroh`: raw frame/finish ownership; interruption tests use actual local channels, malformed frames, abandoned receive/finish, and an observed peer STOP distinguished from a clean acknowledgement. Existing proof-Iroh conformance remains. | +| K1 | `product/integrations/auths-git-signing/src/custody.rs`: private staged publication and explicit uncertain acknowledgement. Existing unit owner now covers injected failures, actual subprocess termination at publication boundaries, concurrent creators, and a fresh reader after caller-observed success and termination. | +| P1 | `product/stores/auths-stores/src/lifecycle.rs`: usable/unavailable snapshot under the existing mutex. Fault matrix continues through same-instance read/replay/unrelated mutation before validated reopen. | +| B1 | Northstar `src/server.ts`: bounded body admission precedes synchronous current-state transition. `tests/state-ownership.mjs` holds real request bodies to order redemption, firewall and reset histories. | +| U1 | REST demo `web/app.js`: view/operation identity and captured execution context. Existing `tests/web-smoke.mjs` now controls preparation/execution/finally completion orders. | +| V1 | Incident control-room `src/app.ts`: viewer and refresh generations, immediate protected-view clearing and stale login/refresh failure handling. `tests/viewer-scope-contract.mjs` consumes the generated shipped controller, and is called by browser smoke and hosted compliance. | + +## Integration and topology + +Distinct gateway daemons must use separate protected endpoint parent directories. +The fixed directory claim deliberately serializes differently spelled leaves, +including case aliases, without introducing filesystem collation assumptions. +Multi-daemon test topologies use each installation's own endpoint parents. +Administrative state operations use a separate lock and remain available while +serving. A shutdown deadline reports incomplete work and exits while ownership +is retained; it does not publish a false quiescent state. + +Northstar remains a single-process demo server. No new production provider +executor or incident-agent ledger is introduced. The Google refresh rotation +hypothesis, scheduling-only reconciliation leases and asynchronous AWS physical +deletion are dispositioned in AP078 rather than promoted into unproved defects. + +The hosted compliance workflow builds Northstar and the control-room through +their maintained TypeScript/build entry points, checks the committed browser +mirror, and executes the new held-request and viewer-generation contracts. +Existing Python, TypeScript package, native workspace, exchange and records-demo +checks retain their coverage. No new duplicate full CI workflow is introduced. + +## Static review and generation + +Three implementing agents reviewed disjoint areas and cross-reviewed neighboring +changes. Before the first push this caught overdue shutdown ownership, filename +aliases, initially absent sockets in unsafe parents, mutable reservation buffers, +stale OAuth errors, a peer STOP misclassified as acknowledgement, and regression +test synchronization/termination gaps. Tests distinguish these concrete schedules +from authorization and provider-effect claims that the evidence does not support. + +Required artifact generation includes the architecture snapshot, reviewed +semantic/source identities, proof-coverage measurements where source coordinates +change, gateway closure/CLI/interface fixtures, and the shipped browser mirror. +Only maintained constructors may update canonical artifacts. Full hosted +verification remains pending until the PR attestation records its final result. + +## Collected first-cohort repair + +The initial published head `7f2c6bba` passed both SDK package workflows, all 26 +Python jobs, Git signing on Linux/macOS and both live signing checks, TLS +PostgreSQL qualification, gateway isolation, SDK recipes, recipe qualification +and the Google demo. Repository preflight stopped on the serving function's +lint length limit; dependent wrapper failures were not separate findings. +The remaining fast proof feedback job was cancelled once the failed revision +could no longer qualify. + +The source-free operator simulation and Stripe/Airtable installed/assessment +jobs exposed old multi-daemon launchers sharing one socket parent. Their repair +uses protected per-host parents and passes operator review sockets explicitly, +independently of application endpoint paths. Current assessment consumers and +runbooks follow that topology; historical assessment evidence is unchanged. + +The collected repair additionally fixes a redundant test import and makes the +framing fixture visible to its sibling regression module. Preflight now asks +Cargo to keep checking independent targets after a failure, preserving its +failure status while collecting a more complete diagnostic batch. + +Bounded repair verification passed workspace/all-target/all-feature Clippy, +the gateway binary's 16 tests and socket-path suite's 18 tests, nine demo-layout +Python units, five held-request Northstar tests, five REST browser tests, and +the viewer contract including actual public-SDK/WASM withdrawal evidence with +network/provider calls forbidden. The source-free Linux root/UID simulations +still require their hosted container jobs; these macOS checks are not substitutes. +Final completed-head verification remains required. + +The touched demo launchers additionally delegate all socket recovery/cleanup to +the native owner and wait for a bounded child readiness event rather than a +pathname. Their final 15 Python units cover ready/refused/partial-line children +and preserve existing live and stale socket inodes; retained stdout handles are +closed during restart and cleanup. diff --git a/docs/reference/gateway-serving-ownership.md b/docs/reference/gateway-serving-ownership.md new file mode 100644 index 000000000..eb676abf2 --- /dev/null +++ b/docs/reference/gateway-serving-ownership.md @@ -0,0 +1,28 @@ +# Gateway serving and restart ownership + +One gateway process owns an installation from startup through admitted-session +drain and socket cleanup. A second `serve` attempt fails with +`gateway.serve.busy` while that owner is active, including during shutdown. +Administrative commands use a separate state lock and remain available. + +Application and administration sockets must have existing canonical parent +directories owned by the gateway UID and closed to group/other writes. The +administration parent retains its stricter private-directory requirements. +Each endpoint parent is exclusively claimed by one daemon. Separate daemon +installations must use separate endpoint parent directories, even when their +socket filenames differ. This restriction also covers filename aliases on +case-insensitive filesystems. Keep the retained serving lockfiles in place; +deleting an active lockfile defeats coordination between processes. + +Normal shutdown stops new admission, drains admitted sessions, removes only the +socket identities created by that serving generation, then releases ownership. +If the existing 25-second drain deadline expires, the process reports +`gateway.serve.shutdown-incomplete` and exits with failure while its claims are +still held. This is an incomplete shutdown, not confirmation that every external +effect finished. A subsequent process acquires the OS-released claims and uses +the existing dead-socket and durable recovery checks. + +These claims protect process and endpoint ownership. Native operation fences, +receipt truth, provider reconciliation and administrative authorization retain +their existing authorities. See [AP-SPEC-078](../specs/0078-residual-state-ownership.md) +for the transition and interruption contract. diff --git a/docs/specs/0078-residual-state-ownership.md b/docs/specs/0078-residual-state-ownership.md new file mode 100644 index 000000000..fb134d01d --- /dev/null +++ b/docs/specs/0078-residual-state-ownership.md @@ -0,0 +1,264 @@ +# AP-SPEC-078: Residual operation ownership and interrupted publication + +- **Status:** Implementation contract; acceptance requires the evidence below. +- **Date:** 11 November 2026. +- **Baseline:** `e40bfdd32e3812ef349bb2db84faada443cb1938`, merged PR #217. +- **Predecessors:** [AP076](0076-explicit-state-ownership-and-concurrency.md), + [AP077](0077-administrative-recovery-protocol.md), and root AGENTS.md. + +## 1. Objective and evidence boundary + +Close the consequential residual ownership gaps found by the follow-up static +audit. Preserve useful explicit state machines and existing authorization, +transaction, signature, replay, and native entry authorities. The findings are +source-derived schedules, not a claim that authorization was bypassed. This +bounded remediation does not certify every workflow in the repository. + +The implementation includes nine owners: gateway serving sockets; SQLite +reservation workers; TypeScript signing completion; exchange channel failure; +development software-key publication; reference lifecycle file persistence; +Northstar demo state transitions; REST demo request attribution; and incident +viewer refresh publication. Each fix belongs in its existing package. Do not +introduce a universal state-machine framework, duplicate execution ledger, new +provider entry right, compatibility reader, or advisory exception. + +## 2. Gateway serving ownership (S) + +### 2.1 Existing failure and required owner + +The gateway drops listeners before draining admitted sessions. A replacement +process can then recover their refused socket paths; the old process subsequently +unlinks the replacement's live sockets. Stale-path detection and startup cleanup +also operate on pathnames without retaining the identity they own. + +One serving claim MUST span `Claimed -> Starting -> Serving -> Draining -> +Cleanup -> Released`, including startup failure. Acquire it before binding or +recovering socket paths; competing starts fail promptly with a bounded diagnostic +and cannot remove sockets. Use the existing private-file/advisory-lock mechanism +with a distinct serving lock so administrative operations remain usable during +service. Do not unlink the lock file when releasing its lock. Endpoint claims +must also serialize competing owners when installation directories differ. +The supported topology uses one fixed serving lock per canonical, protected +socket parent directory, deduplicated and acquired in stable order. Distinct +daemons must use separate socket parent directories even for differently named +sockets. This conservative restriction covers case-insensitive filesystem +aliases without guessing filename collation. Validate parent ownership, +permissions and canonical path before claiming or binding an absent socket. + +Socket cleanup retains the identity of the socket actually bound (device/inode +on Unix) and removes only that identity. A mismatched replacement remains intact. +Hold serving/endpoint claims through listener closure, session drain, and owned +socket cleanup. Startup errors release claims only after cleaning resources +created by that startup. Existing private-parent, owner, socket-type and live +listener checks remain. Locks order processes; socket identity prevents a stale +destructor from deleting a successor. Neither mechanism replaces native fences. + +### 2.2 Results and interruption contract + +| Event | Required result | +| --- | --- | +| Second start while first serves or drains | Explicit busy/start failure; no unlink, bind, or readiness publication. | +| Failure after one socket binds | Remove only that startup's owned inode; release claims afterward. | +| Normal shutdown | Stop admission, drain real admitted work, remove owned sockets, release claims. | +| Process termination | OS releases claims; next start may recover the dead socket under a new claim. | +| Drain deadline expires with work still admitted | Report shutdown incomplete and terminate the process while claims remain held; OS releases them only as the process terminates. Do not drop ownership and continue returning through a live runtime. | +| Foreign/replaced pathname during cleanup | Preserve replacement; do not claim ownership from pathname existence. | + +Launchers must leave stale-socket recovery and cleanup to the native owner. They +wait for a bounded readiness event from their own child process, not pathname +existence, and must not unlink application/admin sockets before starting it. +Partial or absent readiness lines do not establish readiness; retain the child +and its output handles until the launcher terminates or joins it. + +## 3. SQLite reservation worker ownership (Q) + +`SQLiteAtomicReservationStore` currently uses `_closed` while `to_thread` +workers may outlive cancelled waiters and successful close. The adapter MUST +retain actual admitted workers until their underlying transaction completes. +Its states are Open, Closing, and Closed, with admitted work owned independently +of each waiter. Register ownership before scheduling foreign/thread work. + +Cancellation of one reserve waiter detaches that waiter; it MUST NOT cancel or +forget the worker. Close stops new admission and joins all admitted work before +returning success. Concurrent close calls join one cleanup operation; cancellation +of a close waiter does not cancel cleanup. Worker failure settles the associated +reservation result and is consumed even when no waiter remains. Closed means +quiescence. Reopen creates a new instance; it does not reopen the old owner. + +Keep `BEGIN IMMEDIATE`, primary-key uniqueness, exact replay/conflict results, +bounded record validation and per-operation connection ownership unchanged. A +cancelled waiter never certifies rollback. Document these semantics on the +adapter without exporting a new generic lifecycle framework. + +Retain an immutable bounded snapshot of the reservation key, commitment and value +before worker admission. A frozen dataclass alone does not establish ownership of +caller-provided byte buffers. + +## 4. TypeScript signing acceptance (T) + +The existing one-use coordinator remains the signing owner. Retain its exact +transaction deadline and bound request facts before provider entry. Its logical +phases are Prepared, AwaitingApproval, AwaitingSignature and Terminal; a compact +consuming owner is valid if those transitions remain enforced at its boundary. + +After the signer await and before native completion, observe trusted operation +time again. Equality at `expiresAt` remains valid; a later observation rejects +with existing `transaction-expired`, never calls native completion and leaves +the transaction consumed. Effective observed time must not move backward within +one operation. Preserve exact signer response/principal/digest validation, +bounded copies and native cleanup on all paths. Do not reinterpret local signing +request expiry as global revocation or undo a signature already released by an +external signer. Existing ResourceLifecycle cancellation and late-publication +ownership remain authoritative; do not introduce a second cancellation owner. + +## 5. Exchange channel interruption (E) + +The stream, Iroh, memory and HTTPS exchange owners must distinguish a preflight +rejection from an admitted I/O attempt. A binding/size rejection before I/O may +leave the prior phase reusable. Once an operation may have consumed/transmitted +bytes or delivered a submission, cancellation, timeout, transport failure, +malformed response or peer termination MUST NOT silently restore that phase. + +Use phase-bearing channel states or a consuming operation guard. Before I/O, +transition to an in-progress/unavailable state. Only a successful complete +operation advances to its specified successor; dropping an admitted operation +leaves the channel unusable for another semantic exchange. New calls return the +existing sequence/transport error without I/O. A fresh connection/channel is +required; this is not permission to replay an external effect automatically. + +Apply the same rule to raw Iroh frame reading/writing: a partially transferred +frame cannot be treated as a clean boundary. Retain independent send/receive +capabilities only where their contract supports it; terminal failure must prevent +the affected stream from being reused. Finishing a stream records terminal send +ownership before awaiting acknowledgement. Preserve wire bytes, bounds, peer +observations, challenge binding, and the one-submission port contract. + +## 6. Development software-key publication (K) + +The final key pathname MUST mean one fully written key. Creation is one owned +operation: Absent -> PrivateStaging -> PublishedUnacknowledged -> Installed. +Stage the full seed in a private same-directory file, synchronize its contents, +publish without replacing an existing key, synchronize the parent directory, +then acknowledge the installed principal. Preserve owner-only mode, exclusive +publication, secret zeroization and exact-length validation. Readers observe +absence or a complete key; they never read an in-progress staging file as the +installed identity. Concurrent creators produce at most one installed key. + +| Interruption | Required interpretation/action | +| --- | --- | +| Before final publication | No installed key; staging is private/unpublished and may be cleaned conservatively. | +| After publication but before parent sync/ack | Complete final key may exist; failure does not certify absence. Load/verify that exact installed key; never overwrite or silently create another identity. | +| After acknowledged publication | Reopening under the supported synchronization model yields the same complete key. | +| Existing malformed final key | Reject explicitly; do not replace it or introduce a legacy decoder. | + +Tests distinguish injected process interruption from physical power-loss claims. +This is development software custody, not a change to KMS/PKCS#11 custody or +trusted distribution of Git revocation records. + +## 7. Reference lifecycle file persistence uncertainty (P) + +The file store currently replaces its durable snapshot before updating memory. +An error after replacement leaves the same live instance operating on stale +memory. Add an explicit usable/unavailable owner distinction under its existing +mutex. Once persistence may have replaced the file, an error MUST prevent all +subsequent reads, exact replay acknowledgements, capacity decisions and mutations +from consulting the old snapshot. Conservatively make the instance unavailable +after any persistence error; reopening is the explicit recovery operation. + +Reopen validates the existing canonical file and restores one current snapshot. +It must not silently roll back or merge an obsolete memory image. Existing +transition semantics, revision checks, PostgreSQL transactions and wire formats +remain. This owner serves reference/demo callers; the gateway attempt store is +a separate authority. An error before persistence has no external transition, +but uniform poisoning is permitted to keep the contract small and conservative. + +## 8. Demo state and view publication + +### 8.1 Northstar server (B) + +Parse and validate bounded request bodies before entering a state transition. +Then load the current state, check all relevant guards, consume/mutate and +persist as one serialized Northstar-owned operation. Include reset, token-code +consumption, firewall application, counters and timeline publication. No await +may separate state acquisition and commit in the supported single-process +server. Document that topology; if multi-process mutation is supported, require +a real cross-process transaction rather than a process-local queue. + +Two token redemptions for one code yield at most one success; two firewall +requests yield one execution; a request admitted before reset must re-evaluate +current state rather than restore a retained pre-reset image. Preserve PKCE, +redirect, expiry, service authentication and closed-field validation. Do not +add another ledger around the incident agent's existing SQLite kernel. + +### 8.2 REST demo browser (U) + +One view generation owns preparation and execution results. Each admitted +operation retains its session, experiment and transport. Changing selection +invalidates earlier publication; a late result cannot render alongside another +session or set follow-on source IDs using that other session. Busy state belongs +to the current operation/generation, so an older finally cannot release a newer +operation. Follow-on IDs and business-response interpretation come from the +completed operation's captured session. Invalidating a view does not imply the +backend effect was cancelled or rolled back. + +### 8.3 Incident viewer scope (V) + +Bind each refresh to a viewer-scope generation and captured token. Every viewer +scope change invalidates prior refresh publication and clears protected rendered +evidence immediately, including when the replacement refresh fails. Only a +matching scope/current refresh may publish state or errors. An old auditor +response released after public selection must not restore disclosed evidence. +Server claim-based disclosure remains the authorization boundary. + +## 9. Audit dispositions and policy + +Existing AP076 owners, native lifecycle/entry fences, immutable cache keys, +bounded quorum evaluation and consuming approval handles remain in force. +Do not mechanically replace independent booleans or optional data. + +The Google demo refresh rotation concern remains a **provider-dependent +hypothesis**, not a demonstrated Google credential-loss defect. Keep it visible +for a separate refresh protocol contract with a rotating fake provider; do not +invent production provider semantics in this remediation. Reconciliation lease +expiry is a dormant scheduling contract question, not an authorization finding. +AWS asynchronous physical deletion does not contradict the existing exact +adapter-acknowledgement revocation contract. Git CLI record generation does not +claim immediate global revocation before trusted distribution. + +AGENTS.md's existing stateful-change checklist applies to every owner above. +Add a concise clarification: filesystem replacement can precede failure; +same-process continuation after ambiguous persistence needs explicit invalidation +or authoritative reload. Resource admission, publication identity and cleanup +must share ownership through actual completion. This is guidance, not a new +human approval gate or a regex ban. + +## 10. Acceptance matrix and verification discipline + +Write each complete code/test batch before execution. Do not push intermediate +spec-only or partial implementation revisions. Maintain generated identities and +fixtures atomically using their constructors; do not hand-edit canonical bytes. +Run GitHub CI once on the collected implementation by default. Inspect failures +together, perform only justified bounded local reproductions, and publish one +coherent repair batch. Never weaken or bypass a required gate to reduce cost. + +| Gate | Deterministic evidence | +| --- | --- | +| S1 | Hold an admitted session through SIGTERM/drain, attempt replacement startup, then release; verify the defined busy result and winner connectivity. | +| S2 | Competing stale recoveries, startup failure after one bind, process termination/restart, replaced-inode cleanup, protected-parent validation, case-alias/shared-parent exclusion and overdue-drain termination while ownership remains held. | +| Q1 | Thread barrier before commit; concurrent close waits for real completion; rejected post-close admission; reopen exact result. | +| Q2 | Cancel reserve waiter and one close waiter; retained worker still settles, other close waiter succeeds only after quiescence; failure has no unhandled outcome. Mutate caller-owned buffers during blocked worker admission; only the retained snapshot may commit. | +| T1 | Deferred correct signer completes at equality and after expiry; only equality invokes native completion; consumed retry rejects; rollback cannot resurrect observed expiry. | +| E1 | Controlled partial header/body transfer, timeout and dropped future; subsequent semantic calls fail without further I/O. | +| E2 | Cancel memory/HTTPS submission after possible delivery; no new submission on that channel; normal exchange and preflight binding rejection remain conformant. | +| E3 | Iroh send/read/finish failure retains unavailable capability; existing direct/relay and bounded framing evidence remains. | +| K1 | Barrier/injected interruption at staging write, content sync, exclusive publication, parent sync and acknowledgement; readers see absence/complete key, competing creators never overwrite. | +| P1 | Every existing persistence fault followed by same-instance read/replay/unrelated mutation and reopen; no stale acknowledgement or snapshot rewrite after ambiguous failure. | +| B1 | Two held-body code redemptions, firewall calls and reset overlap; one-use results, counters and timelines agree with current committed state. | +| U1 | Deferred A execution and B preparation in both completion orders; receipts and follow-on IDs stay bound to their own sessions; old finally cannot clear current busy. | +| V1 | Hold auditor refresh, select public, release responses in both orders and fail the public response; protected evidence stays cleared. | + +Extend existing unit, integration, installed-package and browser test owners. +Use actual storage/process boundaries for durable claims, not sleeps alone. +Record source revision, exact checks, results and any remaining limits in the PR +acceptance attestation. No successful CI, completed fixes or production +qualification are claimed merely by writing this contract. diff --git a/exchange/adapters/auths-iroh/src/interruption_tests.rs b/exchange/adapters/auths-iroh/src/interruption_tests.rs new file mode 100644 index 000000000..943aa4a9c --- /dev/null +++ b/exchange/adapters/auths-iroh/src/interruption_tests.rs @@ -0,0 +1,136 @@ +use super::*; +use iroh::endpoint::presets; +use std::{ + future::Future as _, + task::{Context, Waker}, +}; + +async fn pair() -> (IrohChannel, IrohChannel, Endpoint, Endpoint) { + let config = IrohConfig::new( + Arc::<[u8]>::from(&b"/ap078/test/1"[..]), + 4096, + Duration::from_secs(5), + StreamInitiator::ConnectingEndpoint, + ) + .unwrap(); + let server_endpoint = Endpoint::builder(presets::N0) + .alpns(vec![config.alpn().to_vec()]) + .bind() + .await + .unwrap(); + let client_endpoint = Endpoint::bind(presets::N0).await.unwrap(); + let address = server_endpoint.addr(); + let direct = *address.ip_addrs().next().unwrap(); + let target = EndpointAddr::new(server_endpoint.id()).with_ip_addr(direct); + let accepting_endpoint = server_endpoint.clone(); + let accepting_config = config.clone(); + let accepting = tokio::spawn(async move { + IrohChannel::accept(&accepting_endpoint, accepting_config) + .await + .unwrap() + }); + let mut client = IrohChannel::connect(&client_endpoint, target, config) + .await + .unwrap(); + client.send(b"stream establishment").await.unwrap(); + let mut server = accepting.await.unwrap(); + assert_eq!( + server.receive().await.unwrap().payload(), + b"stream establishment" + ); + (client, server, client_endpoint, server_endpoint) +} + +#[tokio::test] +async fn raw_iroh_cancelled_receive_and_malformed_frame_cannot_restart() { + timeout(Duration::from_secs(20), async { + let (mut client, mut server, client_endpoint, server_endpoint) = pair().await; + assert_eq!(client.send(&[]).await, Err(IrohError::Limit)); + assert_eq!(client.send(&vec![0; 4097]).await, Err(IrohError::Limit)); + server + .send(b"preflight rejection preserves framing") + .await + .unwrap(); + assert_eq!( + client.receive().await.unwrap().payload(), + b"preflight rejection preserves framing" + ); + let mut receive = Box::pin(client.receive()); + assert!( + receive + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(receive); + assert_eq!(client.receive().await, Err(IrohError::Sequence)); + assert_eq!(client.send(b"late").await, Err(IrohError::Sequence)); + assert_eq!(client.finish_send(), Err(IrohError::Sequence)); + // An oversized declared frame consumes its header, but does not admit + // another frame parse on the same stream. + client + .send + .write_all(&4097_u32.to_be_bytes()) + .await + .unwrap(); + assert_eq!(server.receive().await, Err(IrohError::Limit)); + assert_eq!(server.receive().await, Err(IrohError::Sequence)); + client_endpoint.close().await; + server_endpoint.close().await; + }) + .await + .unwrap(); +} + +#[tokio::test] +async fn raw_iroh_peer_stop_and_abandoned_finish_retain_terminal_ownership() { + timeout(Duration::from_secs(20), async { + let (mut client, mut server, client_endpoint, server_endpoint) = pair().await; + server.recv.stop(0_u32.into()).unwrap(); + client.send.stopped().await.unwrap(); + assert_eq!(client.send(b"stopped").await, Err(IrohError::Connection)); + assert_eq!(client.send(b"retry").await, Err(IrohError::Sequence)); + client_endpoint.close().await; + server_endpoint.close().await; + + let (mut client, mut server, client_endpoint, server_endpoint) = pair().await; + let mut finish = Box::pin(server.finish_send_and_wait()); + assert!( + finish + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(finish); + assert_eq!(server.finish_send(), Err(IrohError::Sequence)); + assert_eq!(server.receive().await, Err(IrohError::Sequence)); + // The peer can still observe the FIN; abandoning its acknowledgement + // does not restore the sender's capability. + assert!(client.recv.read(&mut [0_u8; 1]).await.unwrap().is_none()); + client_endpoint.close().await; + server_endpoint.close().await; + }) + .await + .unwrap(); +} + +#[tokio::test] +async fn peer_stop_is_not_a_clean_finish_acknowledgement() { + timeout(Duration::from_secs(20), async { + let (mut client, mut server, client_endpoint, server_endpoint) = pair().await; + server.send.write_all(b"unread bytes").await.unwrap(); + client.recv.stop(17_u32.into()).unwrap(); + // Establish STOP receipt before FIN: otherwise QUIC could acknowledge + // unread data and FIN before the STOP arrives, which is a valid race. + assert_eq!(server.send.stopped().await.unwrap(), Some(17_u32.into())); + assert_eq!( + server.finish_send_and_wait().await, + Err(IrohError::Connection) + ); + assert_eq!(server.send(b"retry").await, Err(IrohError::Sequence)); + client_endpoint.close().await; + server_endpoint.close().await; + }) + .await + .unwrap(); +} diff --git a/exchange/adapters/auths-iroh/src/lib.rs b/exchange/adapters/auths-iroh/src/lib.rs index 3fe9abc65..fc5345c27 100644 --- a/exchange/adapters/auths-iroh/src/lib.rs +++ b/exchange/adapters/auths-iroh/src/lib.rs @@ -125,6 +125,9 @@ impl ReceivedBytes { } /// Bounded duplex channel carrying only opaque byte frames. +/// +/// Once a frame operation starts, failure or cancellation makes the channel +/// unavailable. Partially transferred bytes cannot be retried as a new frame. pub struct IrohChannel { _connection: Connection, peer_endpoint_id: [u8; 32], @@ -133,7 +136,14 @@ pub struct IrohChannel { config: IrohConfig, path: PathObservation, peer_observation: BytePeerObservation, - send_finished: bool, + state: ChannelState, +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +enum ChannelState { + Open, + SendFinished, + Unavailable, } impl IrohChannel { @@ -173,7 +183,7 @@ impl IrohChannel { config, path, peer_observation, - send_finished: false, + state: ChannelState::Open, }) } @@ -205,7 +215,7 @@ impl IrohChannel { config, path: PathObservation::MixedOrUnknown, peer_observation, - send_finished: false, + state: ChannelState::Open, }) } @@ -229,10 +239,15 @@ impl IrohChannel { /// attempted after [`Self::finish_send`]. Payload semantics are never /// inspected. pub async fn send(&mut self, payload: &[u8]) -> Result<(), IrohError> { - if self.send_finished { + if self.state != ChannelState::Open { return Err(IrohError::Sequence); } + if payload.is_empty() || payload.len() > self.config.max_frame_bytes() { + return Err(IrohError::Limit); + } + self.state = ChannelState::Unavailable; write_frame(&mut self.send, payload, &self.config).await?; + self.state = ChannelState::Open; Ok(()) } @@ -242,7 +257,13 @@ impl IrohChannel { /// /// Returns a typed framing, timeout, transport, or bounds error. pub async fn receive(&mut self) -> Result { + if self.state == ChannelState::Unavailable { + return Err(IrohError::Sequence); + } + let previous = self.state; + self.state = ChannelState::Unavailable; let payload = read_frame(&mut self.recv, &self.config).await?; + self.state = previous; Ok(ReceivedBytes { peer_endpoint_id: self.peer_endpoint_id, payload, @@ -256,11 +277,13 @@ impl IrohChannel { /// Returns [`IrohError::Sequence`] if the sending side is already closed, /// or a typed transport error. pub fn finish_send(&mut self) -> Result<(), IrohError> { - if self.send_finished { + if self.state != ChannelState::Open { return Err(IrohError::Sequence); } - self.send_finished = true; - self.send.finish().map_err(|_| IrohError::Connection) + self.state = ChannelState::Unavailable; + self.send.finish().map_err(|_| IrohError::Connection)?; + self.state = ChannelState::SendFinished; + Ok(()) } /// Closes the sending side and waits for peer acknowledgement. @@ -273,11 +296,16 @@ impl IrohChannel { /// Returns a typed sequence, timeout, or transport error. pub async fn finish_send_and_wait(&mut self) -> Result<(), IrohError> { self.finish_send()?; - timeout(self.config.io_timeout(), self.send.stopped()) + self.state = ChannelState::Unavailable; + let stopped = timeout(self.config.io_timeout(), self.send.stopped()) .await .map_err(|_| IrohError::Timeout)? - .map(|_| ()) - .map_err(|_| IrohError::Connection) + .map_err(|_| IrohError::Connection)?; + if stopped.is_some() { + return Err(IrohError::Connection); + } + self.state = ChannelState::SendFinished; + Ok(()) } } @@ -392,6 +420,9 @@ impl fmt::Display for IrohError { impl std::error::Error for IrohError {} +#[cfg(test)] +mod interruption_tests; + #[cfg(test)] mod tests { use super::*; diff --git a/exchange/adapters/auths-proof-exchange-https/Cargo.toml b/exchange/adapters/auths-proof-exchange-https/Cargo.toml index 54ee4d969..eb8f11f8b 100644 --- a/exchange/adapters/auths-proof-exchange-https/Cargo.toml +++ b/exchange/adapters/auths-proof-exchange-https/Cargo.toml @@ -13,5 +13,10 @@ auths-proof-exchange-model.workspace = true auths-proof-exchange-port.workspace = true reqwest.workspace = true +[dev-dependencies] +tokio.workspace = true +rcgen.workspace = true +rustls.workspace = true + [lints] workspace = true diff --git a/exchange/adapters/auths-proof-exchange-https/src/delivery_tests.rs b/exchange/adapters/auths-proof-exchange-https/src/delivery_tests.rs new file mode 100644 index 000000000..5b72b6eed --- /dev/null +++ b/exchange/adapters/auths-proof-exchange-https/src/delivery_tests.rs @@ -0,0 +1,145 @@ +use super::*; +use auths_proof_exchange_model::{ + AUTHS_PROTOCOL_V1, ChallengeNonce, ExchangeAudience, ExchangeMetrics, ExchangeOutcome, + ExchangeProfileId, ProfileBinding, +}; +use std::{ + future::Future as _, + io::{Read as _, Write as _}, + net::{SocketAddr, TcpListener}, + sync::{Arc, mpsc}, + task::{Context, Poll, Waker}, + thread::JoinHandle, + time::Duration, +}; + +struct HeldResponse { + address: SocketAddr, + certificate: reqwest::Certificate, + delivered: tokio::sync::oneshot::Receiver<()>, + release: mpsc::Sender<()>, + thread: JoinHandle<()>, +} + +fn held_response(expected_body: Vec) -> HeldResponse { + let key = rcgen::generate_simple_self_signed(vec!["localhost".to_owned()]).unwrap(); + let certificate = reqwest::Certificate::from_der(key.cert.der()).unwrap(); + let provider = Arc::new(rustls::crypto::ring::default_provider()); + let config = rustls::ServerConfig::builder_with_provider(provider) + .with_safe_default_protocol_versions() + .unwrap() + .with_no_client_auth() + .with_single_cert( + vec![key.cert.der().clone()], + rustls::pki_types::PrivatePkcs8KeyDer::from(key.key_pair.serialize_der()).into(), + ) + .unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + let address = listener.local_addr().unwrap(); + let (delivered, received) = tokio::sync::oneshot::channel(); + let (release, wait) = mpsc::channel(); + let thread = std::thread::spawn(move || { + let (socket, _) = listener.accept().unwrap(); + socket + .set_read_timeout(Some(Duration::from_secs(5))) + .unwrap(); + socket + .set_write_timeout(Some(Duration::from_secs(5))) + .unwrap(); + let connection = rustls::ServerConnection::new(Arc::new(config)).unwrap(); + let mut stream = rustls::StreamOwned::new(connection, socket); + let mut header = Vec::new(); + while !header.ends_with(b"\r\n\r\n") { + assert!(header.len() < 16 * 1024); + let mut byte = [0_u8]; + stream.read_exact(&mut byte).unwrap(); + header.push(byte[0]); + } + let header = std::str::from_utf8(&header).unwrap(); + assert!(header.starts_with("POST /auths/v1/submission HTTP/1.1\r\n")); + let length = header + .lines() + .find_map(|line| { + let (name, value) = line.split_once(':')?; + name.eq_ignore_ascii_case("content-length") + .then(|| value.trim().parse::().unwrap()) + }) + .unwrap(); + assert_eq!(length, expected_body.len()); + let mut body = vec![0; length]; + stream.read_exact(&mut body).unwrap(); + assert_eq!(body, expected_body); + delivered.send(()).unwrap(); + wait.recv_timeout(Duration::from_secs(5)).unwrap(); + let body = encode_response(&ActionResponse::new( + None, + ExchangeOutcome::completed(b"ok".to_vec()).unwrap(), + ExchangeMetrics::default(), + )); + let header = format!( + "HTTP/1.1 200 OK\r\ncontent-type: {CONTENT_TYPE}\r\ncontent-length: {}\r\nconnection: close\r\n\r\n", + body.len() + ); + // The cancelled client may have closed its response connection already. + let _ = stream + .write_all(header.as_bytes()) + .and_then(|()| stream.write_all(&body)); + let _ = stream.flush(); + }); + HeldResponse { + address, + certificate, + delivered: received, + release, + thread, + } +} + +#[tokio::test] +async fn cancelled_delivered_https_submission_cannot_be_sent_again() { + let expected = ActionChallenge::new( + ChallengeNonce::new([7; 32]), + ExchangeAudience::parse("mcp://reports").unwrap(), + 100, + 1024, + 4096, + ProfileBinding::new( + AUTHS_PROTOCOL_V1, + ExchangeProfileId::parse("auths.mcp").unwrap(), + 1, + ) + .unwrap(), + ) + .unwrap(); + let request = ActionSubmission::new(b"body".to_vec(), b"proof".to_vec(), &expected).unwrap(); + let peer = held_response(encode_request(&request)); + let client = Client::builder() + .no_proxy() + .http1_only() + .add_root_certificate(peer.certificate) + .resolve("localhost", peer.address) + .timeout(Duration::from_secs(5)) + .build() + .unwrap(); + let mut channel = HttpsClientChannel::new( + client, + format!("https://localhost:{}", peer.address.port()), + PeerObservation::ServerAuthenticated, + ) + .unwrap(); + channel.state = State::Challenged; + channel.challenge = Some(expected); + let mut submission = Box::pin(channel.submit_action(request.clone())); + tokio::select! { + result = &mut submission => panic!("submission completed before the held response: {result:?}"), + delivered = peer.delivered => delivered.unwrap(), + } + drop(submission); + let mut retry = Box::pin(channel.submit_action(request)); + assert!(matches!( + retry.as_mut().poll(&mut Context::from_waker(Waker::noop())), + Poll::Ready(Err(HttpsTransportError::Sequence)) + )); + peer.release.send(()).unwrap(); + peer.thread.join().unwrap(); +} diff --git a/exchange/adapters/auths-proof-exchange-https/src/lib.rs b/exchange/adapters/auths-proof-exchange-https/src/lib.rs index 667feb094..5617fc50d 100644 --- a/exchange/adapters/auths-proof-exchange-https/src/lib.rs +++ b/exchange/adapters/auths-proof-exchange-https/src/lib.rs @@ -25,6 +25,7 @@ enum State { Connected, Challenged, Completed, + Unavailable, } /// HTTPS client using deterministic messages without treating TLS identity as @@ -81,6 +82,7 @@ impl ClientProofChannel for HttpsClientChannel { if self.state != State::Connected { return Err(HttpsTransportError::Sequence); } + self.state = State::Unavailable; let response = self .client .get(format!("{}/auths/v1/challenge", self.base_url)) @@ -111,6 +113,9 @@ impl ClientProofChannel for HttpsClientChannel { { return Err(HttpsTransportError::Binding); } + // Retain the admitted attempt even if its response is lost or its + // waiter is dropped. A new channel is required after uncertainty. + self.state = State::Unavailable; let response = self .client .post(format!("{}/auths/v1/submission", self.base_url)) @@ -221,3 +226,98 @@ impl fmt::Display for HttpsTransportError { } impl std::error::Error for HttpsTransportError {} + +#[cfg(test)] +mod delivery_tests; + +#[cfg(test)] +mod tests { + use super::*; + use auths_proof_exchange_model::{ + AUTHS_PROTOCOL_V1, ChallengeNonce, ExchangeAudience, ExchangeProfileId, ProfileBinding, + }; + use std::{ + future::Future as _, + task::{Context, Poll, Waker}, + }; + + fn challenge() -> ActionChallenge { + ActionChallenge::new( + ChallengeNonce::new([7; 32]), + ExchangeAudience::parse("mcp://reports").unwrap(), + 100, + 1024, + 4096, + ProfileBinding::new( + AUTHS_PROTOCOL_V1, + ExchangeProfileId::parse("auths.mcp").unwrap(), + 1, + ) + .unwrap(), + ) + .unwrap() + } + + #[tokio::test] + async fn cancelled_http_attempt_cannot_start_another_submission() { + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let address = listener.local_addr().unwrap(); + let transport = Client::builder() + .no_proxy() + .resolve("held.invalid", address) + .build() + .unwrap(); + let mut channel = HttpsClientChannel::new( + transport, + format!("https://held.invalid:{}", address.port()), + PeerObservation::ServerAuthenticated, + ) + .unwrap(); + let expected = challenge(); + channel.challenge = Some(expected.clone()); + channel.state = State::Challenged; + let request = + ActionSubmission::new(b"body".to_vec(), b"proof".to_vec(), &expected).unwrap(); + let mut operation = Box::pin(channel.submit_action(request.clone())); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + // No TLS peer is serving this listener. A retry must reject locally, + // rather than begin another HTTP request or wait for the lost reply. + let mut retry = Box::pin(channel.submit_action(request)); + assert!(matches!( + retry.as_mut().poll(&mut Context::from_waker(Waker::noop())), + Poll::Ready(Err(HttpsTransportError::Sequence)) + )); + } + + #[tokio::test] + async fn failed_challenge_acquisition_is_not_a_fresh_channel() { + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let address = listener.local_addr().unwrap(); + drop(listener); + let transport = Client::builder() + .no_proxy() + .timeout(std::time::Duration::from_secs(2)) + .build() + .unwrap(); + let mut channel = HttpsClientChannel::new( + transport, + format!("https://{address}"), + PeerObservation::ServerAuthenticated, + ) + .unwrap(); + assert_eq!( + channel.receive_challenge().await, + Err(HttpsTransportError::Network) + ); + assert_eq!( + channel.receive_challenge().await, + Err(HttpsTransportError::Sequence) + ); + } +} diff --git a/exchange/adapters/auths-proof-exchange-iroh/src/lib.rs b/exchange/adapters/auths-proof-exchange-iroh/src/lib.rs index cfc3c7d47..648bb9593 100644 --- a/exchange/adapters/auths-proof-exchange-iroh/src/lib.rs +++ b/exchange/adapters/auths-proof-exchange-iroh/src/lib.rs @@ -31,6 +31,7 @@ enum ChannelState { Challenged, Submitted, Completed, + Unavailable, } #[derive(Clone, Copy, Debug)] @@ -159,6 +160,7 @@ impl ClientProofChannel for IrohClientChannel { if self.state != ChannelState::Connected { return Err(IrohTransportError::sequence()); } + self.state = ChannelState::Unavailable; let frame = self .channel .receive() @@ -188,6 +190,7 @@ impl ClientProofChannel for IrohClientChannel { } let encoded = encode_request(&request); check_frame(&encoded, MAX_REQUEST_FRAME)?; + self.state = ChannelState::Unavailable; self.channel .send(&encoded) .await @@ -195,7 +198,6 @@ impl ClientProofChannel for IrohClientChannel { self.channel .finish_send() .map_err(|error| IrohTransportError::iroh("finish request", error))?; - self.state = ChannelState::Submitted; let frame = self .channel .receive() @@ -223,6 +225,7 @@ impl ServerProofChannel for IrohServerChannel { } let encoded = encode_challenge(&challenge); check_frame(&encoded, MAX_CHALLENGE_FRAME)?; + self.state = ChannelState::Unavailable; self.channel .send(&encoded) .await @@ -242,6 +245,7 @@ impl ServerProofChannel for IrohServerChannel { if self.challenge.as_ref() != Some(challenge) { return Err(IrohTransportError::binding()); } + self.state = ChannelState::Unavailable; let frame = self .channel .receive() @@ -260,6 +264,7 @@ impl ServerProofChannel for IrohServerChannel { } let encoded = encode_response(&response); check_frame(&encoded, MAX_RESPONSE_FRAME)?; + self.state = ChannelState::Unavailable; self.channel .send(&encoded) .await diff --git a/exchange/adapters/auths-proof-exchange-memory/src/lib.rs b/exchange/adapters/auths-proof-exchange-memory/src/lib.rs index 8c6a2fd3b..e03745e7c 100644 --- a/exchange/adapters/auths-proof-exchange-memory/src/lib.rs +++ b/exchange/adapters/auths-proof-exchange-memory/src/lib.rs @@ -40,6 +40,7 @@ enum ClientState { Connected, Challenged, Completed, + Unavailable, } #[derive(Clone, Copy, Debug, Eq, PartialEq)] @@ -48,6 +49,7 @@ enum ServerState { Challenged, Submitted, Completed, + Unavailable, } #[must_use] @@ -87,6 +89,7 @@ impl ClientProofChannel for MemoryClientChannel { if self.state != ClientState::Connected { return Err(MemoryTransportError::InvalidSequence); } + self.state = ClientState::Unavailable; match self.from_server.recv().await { Some(ServerToClient::Challenge(challenge)) => { self.state = ClientState::Challenged; @@ -112,6 +115,9 @@ impl ClientProofChannel for MemoryClientChannel { { return Err(MemoryTransportError::BindingMismatch); } + // Delivery can precede cancellation while awaiting the response. A + // successor call must never resend or consume this attempt's reply. + self.state = ClientState::Unavailable; self.to_server .send(ClientToServer::Submission(request)) .await @@ -139,6 +145,7 @@ impl ServerProofChannel for MemoryServerChannel { if self.state != ServerState::Connected { return Err(MemoryTransportError::InvalidSequence); } + self.state = ServerState::Unavailable; self.to_client .send(ServerToClient::Challenge(challenge.clone())) .await @@ -158,6 +165,7 @@ impl ServerProofChannel for MemoryServerChannel { if self.challenge.as_ref() != Some(challenge) { return Err(MemoryTransportError::BindingMismatch); } + self.state = ServerState::Unavailable; match self.from_client.recv().await { Some(ClientToServer::Submission(request)) => { if !request.matches_challenge(challenge) { @@ -174,6 +182,7 @@ impl ServerProofChannel for MemoryServerChannel { if self.state != ServerState::Submitted { return Err(MemoryTransportError::InvalidSequence); } + self.state = ServerState::Unavailable; self.to_client .send(ServerToClient::Response(response)) .await @@ -201,3 +210,112 @@ impl fmt::Display for MemoryTransportError { } impl std::error::Error for MemoryTransportError {} + +#[cfg(test)] +mod tests { + use super::*; + use auths_proof_exchange_model::{ + AUTHS_PROTOCOL_V1, ChallengeNonce, ExchangeAudience, ExchangeProfileId, ProfileBinding, + }; + use std::{ + future::Future as _, + task::{Context, Waker}, + }; + + fn challenge() -> ActionChallenge { + ActionChallenge::new( + ChallengeNonce::new([7; 32]), + ExchangeAudience::parse("mcp://reports").unwrap(), + 100, + 1024, + 4096, + ProfileBinding::new( + AUTHS_PROTOCOL_V1, + ExchangeProfileId::parse("auths.mcp").unwrap(), + 1, + ) + .unwrap(), + ) + .unwrap() + } + + #[tokio::test] + async fn cancellation_after_delivery_does_not_reassign_the_first_reply() { + let (mut client, mut server) = channel_pair( + PeerObservation::Unauthenticated, + PeerObservation::Unauthenticated, + ); + let expected = challenge(); + server.send_challenge(expected.clone()).await.unwrap(); + client.receive_challenge().await.unwrap(); + let request = + ActionSubmission::new(b"first".to_vec(), b"proof".to_vec(), &expected).unwrap(); + let mut operation = Box::pin(client.submit_action(request.clone())); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + assert_eq!(server.receive_action(&expected).await.unwrap(), request); + let other = + ActionSubmission::new(b"second".to_vec(), b"proof".to_vec(), &expected).unwrap(); + assert_eq!( + client.submit_action(other).await, + Err(MemoryTransportError::InvalidSequence) + ); + assert!( + server.from_client.try_recv().is_err(), + "cancelled waiter cannot cause another delivery" + ); + } + + #[tokio::test] + async fn cancelled_server_receive_is_terminal_but_preflight_binding_rejection_is_not() { + let (mut client, mut server) = channel_pair( + PeerObservation::Unauthenticated, + PeerObservation::Unauthenticated, + ); + let expected = challenge(); + server.send_challenge(expected.clone()).await.unwrap(); + client.receive_challenge().await.unwrap(); + let different = ActionChallenge::new( + ChallengeNonce::new([8; 32]), + expected.audience().clone(), + expected.expires_at(), + expected.max_body_bytes(), + expected.max_proof_bytes(), + ProfileBinding::new( + expected.auths_protocol(), + expected.profile_id().clone(), + expected.profile_version(), + ) + .unwrap(), + ) + .unwrap(); + let mismatched = + ActionSubmission::new(b"body".to_vec(), b"proof".to_vec(), &different).unwrap(); + assert_eq!( + client.submit_action(mismatched).await, + Err(MemoryTransportError::BindingMismatch) + ); + assert_eq!( + server.receive_action(&different).await, + Err(MemoryTransportError::BindingMismatch) + ); + let mut operation = Box::pin(server.receive_action(&expected)); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + assert_eq!( + server.receive_action(&expected).await, + Err(MemoryTransportError::InvalidSequence) + ); + assert_eq!(client.state, ClientState::Challenged); + } +} diff --git a/exchange/crates/auths-proof-exchange-framing/src/interruption_tests.rs b/exchange/crates/auths-proof-exchange-framing/src/interruption_tests.rs new file mode 100644 index 000000000..e54ccbc52 --- /dev/null +++ b/exchange/crates/auths-proof-exchange-framing/src/interruption_tests.rs @@ -0,0 +1,257 @@ +use super::*; +use std::{ + future::Future as _, + io, + pin::Pin, + sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, + }, + task::{Context, Poll, Waker}, +}; +use tokio::io::ReadBuf; + +struct PartialStream { + input: Vec, + read_position: usize, + written: usize, + write_capacity: usize, + polls: Arc, +} + +impl PartialStream { + fn new(input: Vec, write_capacity: usize) -> Self { + Self { + input, + read_position: 0, + written: 0, + write_capacity, + polls: Arc::default(), + } + } +} + +impl AsyncRead for PartialStream { + fn poll_read( + mut self: Pin<&mut Self>, + _: &mut Context<'_>, + buffer: &mut ReadBuf<'_>, + ) -> Poll> { + self.polls.fetch_add(1, Ordering::SeqCst); + let remaining = &self.input[self.read_position..]; + if remaining.is_empty() { + return Poll::Pending; + } + let count = remaining.len().min(buffer.remaining()); + buffer.put_slice(&remaining[..count]); + self.read_position += count; + Poll::Ready(Ok(())) + } +} + +impl AsyncWrite for PartialStream { + fn poll_write( + mut self: Pin<&mut Self>, + _: &mut Context<'_>, + bytes: &[u8], + ) -> Poll> { + self.polls.fetch_add(1, Ordering::SeqCst); + let count = bytes.len().min(self.write_capacity - self.written); + if count == 0 { + return Poll::Pending; + } + self.written += count; + Poll::Ready(Ok(count)) + } + fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } + fn poll_shutdown(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll> { + Poll::Pending + } +} + +#[tokio::test] +async fn cancelled_partial_challenge_reads_cannot_restart_at_a_false_frame_boundary() { + let encoded = encode_challenge(&tests::challenge()); + let mut complete = u32::try_from(encoded.len()).unwrap().to_be_bytes().to_vec(); + complete.extend_from_slice(&encoded); + for consumed in [1, 3, 4, complete.len() - 1] { + let stream = PartialStream::new(complete[..consumed].to_vec(), usize::MAX); + let polls = Arc::clone(&stream.polls); + let mut client = FramedClient::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::default(), + ); + let mut operation = Box::pin(client.receive_challenge()); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + assert_eq!(client.stream.read_position, consumed); + let previous = polls.load(Ordering::SeqCst); + assert_eq!( + client.receive_challenge().await, + Err(FramingError::Sequence) + ); + assert_eq!( + polls.load(Ordering::SeqCst), + previous, + "no I/O after abandonment" + ); + } +} + +#[tokio::test] +async fn timed_out_partial_challenge_stays_unavailable() { + let stream = PartialStream::new(vec![0, 0], usize::MAX); + let mut client = FramedClient::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::new(Duration::from_millis(1)).unwrap(), + ); + assert_eq!(client.receive_challenge().await, Err(FramingError::Timeout)); + assert_eq!(client.stream.read_position, 2); + assert_eq!( + client.receive_challenge().await, + Err(FramingError::Sequence) + ); +} + +#[tokio::test] +async fn cancelled_partial_challenge_write_cannot_append_a_second_frame() { + for capacity in [1, 4, 5] { + let stream = PartialStream::new(Vec::new(), capacity); + let mut server = FramedServer::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::default(), + ); + let mut operation = Box::pin(server.send_challenge(tests::challenge())); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + assert_eq!(server.stream.written, capacity); + assert_eq!( + server.send_challenge(tests::challenge()).await, + Err(FramingError::Sequence) + ); + assert_eq!(server.stream.written, capacity); + } +} + +#[tokio::test] +async fn delivered_submission_cancelled_before_response_cannot_be_resent() { + let expected = tests::challenge(); + let request = ActionSubmission::new(b"body".to_vec(), b"proof".to_vec(), &expected).unwrap(); + let stream = PartialStream::new(Vec::new(), usize::MAX); + let mut client = FramedClient::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::default(), + ); + client.challenge = Some(expected); + client.state = State::Challenged; + let mut operation = Box::pin(client.submit_action(request.clone())); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + let sent = client.stream.written; + assert!(sent > 4); + assert_eq!( + client.submit_action(request).await, + Err(FramingError::Sequence) + ); + assert_eq!(client.stream.written, sent); +} + +#[tokio::test] +async fn malformed_challenge_is_consumed_and_terminal() { + let stream = PartialStream::new(vec![0, 0, 0, 1, 0xff], usize::MAX); + let mut client = FramedClient::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::default(), + ); + assert_eq!(client.receive_challenge().await, Err(FramingError::Codec)); + assert_eq!( + client.receive_challenge().await, + Err(FramingError::Sequence) + ); +} + +#[tokio::test] +async fn cancelled_server_action_read_cannot_admit_a_response_or_restart() { + let expected = tests::challenge(); + let request = ActionSubmission::new(b"body".to_vec(), b"proof".to_vec(), &expected).unwrap(); + let encoded = encode_request(&request); + let mut partial = u32::try_from(encoded.len()).unwrap().to_be_bytes().to_vec(); + partial.extend_from_slice(&encoded[..1]); + let stream = PartialStream::new(partial, usize::MAX); + let mut server = FramedServer::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::default(), + ); + server.state = State::Challenged; + server.challenge = Some(expected.clone()); + let mut operation = Box::pin(server.receive_action(&expected)); + assert!( + operation + .as_mut() + .poll(&mut Context::from_waker(Waker::noop())) + .is_pending() + ); + drop(operation); + assert_eq!(server.stream.read_position, 5); + assert_eq!( + server.receive_action(&expected).await, + Err(FramingError::Sequence) + ); + let response = ActionResponse::new( + None, + auths_proof_exchange_model::ExchangeOutcome::completed(b"ok".to_vec()).unwrap(), + auths_proof_exchange_model::ExchangeMetrics::default(), + ); + assert_eq!( + server.send_response(response).await, + Err(FramingError::Sequence) + ); + assert_eq!(server.stream.written, 0); +} + +#[tokio::test] +async fn response_shutdown_timeout_does_not_make_response_retriable() { + let stream = PartialStream::new(Vec::new(), usize::MAX); + let mut server = FramedServer::new( + stream, + PeerObservation::Unauthenticated, + FramingConfig::new(Duration::from_millis(1)).unwrap(), + ); + server.state = State::Submitted; + let response = ActionResponse::new( + None, + auths_proof_exchange_model::ExchangeOutcome::completed(b"ok".to_vec()).unwrap(), + auths_proof_exchange_model::ExchangeMetrics::default(), + ); + assert_eq!( + server.send_response(response.clone()).await, + Err(FramingError::Timeout) + ); + assert_eq!( + server.send_response(response).await, + Err(FramingError::Sequence) + ); +} diff --git a/exchange/crates/auths-proof-exchange-framing/src/lib.rs b/exchange/crates/auths-proof-exchange-framing/src/lib.rs index 14faabcdf..34942f15c 100644 --- a/exchange/crates/auths-proof-exchange-framing/src/lib.rs +++ b/exchange/crates/auths-proof-exchange-framing/src/lib.rs @@ -62,6 +62,9 @@ enum State { Challenged, Submitted, Completed, + // Claimed before I/O. Failure or dropping its future leaves the stream + // unusable because a partial frame is not a new message boundary. + Unavailable, } /// Client side of the one-submission stream state machine. @@ -125,6 +128,7 @@ where if self.state != State::Connected { return Err(FramingError::Sequence); } + self.state = State::Unavailable; let frame = read_frame(&mut self.stream, MAX_CHALLENGE_FRAME, self.config.deadline).await?; let challenge = decode_challenge(&frame).map_err(|_| FramingError::Codec)?; self.challenge = Some(challenge.clone()); @@ -146,14 +150,16 @@ where { return Err(FramingError::Binding); } + let encoded = encode_request(&request); + check_outbound(&encoded, MAX_SUBMISSION_FRAME)?; + self.state = State::Unavailable; write_frame( &mut self.stream, - &encode_request(&request), + &encoded, MAX_SUBMISSION_FRAME, self.config.deadline, ) .await?; - self.state = State::Submitted; let frame = read_frame(&mut self.stream, MAX_RESPONSE_FRAME, self.config.deadline).await?; let response = decode_response(&frame).map_err(|_| FramingError::Codec)?; self.state = State::Completed; @@ -176,9 +182,12 @@ where if self.state != State::Connected { return Err(FramingError::Sequence); } + let encoded = encode_challenge(&challenge); + check_outbound(&encoded, MAX_CHALLENGE_FRAME)?; + self.state = State::Unavailable; write_frame( &mut self.stream, - &encode_challenge(&challenge), + &encoded, MAX_CHALLENGE_FRAME, self.config.deadline, ) @@ -198,6 +207,7 @@ where if self.challenge.as_ref() != Some(challenge) { return Err(FramingError::Binding); } + self.state = State::Unavailable; let frame = read_frame(&mut self.stream, MAX_SUBMISSION_FRAME, self.config.deadline).await?; let submission = decode_request(&frame, challenge).map_err(|_| FramingError::Codec)?; @@ -209,19 +219,32 @@ where if self.state != State::Submitted { return Err(FramingError::Sequence); } + let encoded = encode_response(&response); + check_outbound(&encoded, MAX_RESPONSE_FRAME)?; + self.state = State::Unavailable; write_frame( &mut self.stream, - &encode_response(&response), + &encoded, MAX_RESPONSE_FRAME, self.config.deadline, ) .await?; - self.stream.shutdown().await.map_err(|_| FramingError::Io)?; + timeout(self.config.deadline, self.stream.shutdown()) + .await + .map_err(|_| FramingError::Timeout)? + .map_err(|_| FramingError::Io)?; self.state = State::Completed; Ok(()) } } +fn check_outbound(payload: &[u8], maximum: usize) -> Result<(), FramingError> { + if payload.len() > maximum || u32::try_from(payload.len()).is_err() { + return Err(FramingError::Limit); + } + Ok(()) +} + async fn write_frame( stream: &mut S, payload: &[u8], @@ -309,6 +332,9 @@ impl fmt::Display for FramingError { impl std::error::Error for FramingError {} +#[cfg(test)] +mod interruption_tests; + #[cfg(test)] mod tests { use super::*; @@ -316,7 +342,7 @@ mod tests { AUTHS_PROTOCOL_V1, ChallengeNonce, ExchangeAudience, ExchangeMetrics, ExchangeOutcome, ExchangeProfileId, ProfileBinding, }; - fn challenge() -> ActionChallenge { + pub(super) fn challenge() -> ActionChallenge { ActionChallenge::new( ChallengeNonce::new([7; 32]), ExchangeAudience::parse("mcp://reports").unwrap(), diff --git a/exchange/crates/auths-proof-exchange-port/src/lib.rs b/exchange/crates/auths-proof-exchange-port/src/lib.rs index 4753f1f4c..a6a74d7d9 100644 --- a/exchange/crates/auths-proof-exchange-port/src/lib.rs +++ b/exchange/crates/auths-proof-exchange-port/src/lib.rs @@ -10,6 +10,12 @@ use auths_proof_exchange_model::{ }; use std::fmt; +/// One challenge and one admitted submission on a channel. +/// +/// Preflight rejection may be retried before I/O. Once a channel operation +/// starts I/O, failure or dropping its future makes the channel unavailable; +/// a lost reply never authorizes implicit resubmission. Use a fresh channel +/// and the application's existing recovery protocol for uncertain effects. #[async_trait] pub trait ClientProofChannel { type Error: std::error::Error + Send + Sync + 'static; @@ -24,6 +30,10 @@ pub trait ClientProofChannel { ) -> Result; } +/// One service exchange with operation ownership retained across I/O. +/// +/// An interrupted or failed admitted operation makes the channel unavailable. +/// Sequence checks must reject subsequent operations without further I/O. #[async_trait] pub trait ServerProofChannel { type Error: std::error::Error + Send + Sync + 'static; diff --git a/formal/assurance-manifest-v1.toml b/formal/assurance-manifest-v1.toml index cb927a05f..f6308385f 100644 --- a/formal/assurance-manifest-v1.toml +++ b/formal/assurance-manifest-v1.toml @@ -8733,7 +8733,7 @@ sha256 = "2bb401ffca0136622cd79bb14a5a38852061649a06cc46100503870c22d300c7" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-055" @@ -8854,7 +8854,7 @@ sha256 = "2bb401ffca0136622cd79bb14a5a38852061649a06cc46100503870c22d300c7" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-056" @@ -8989,7 +8989,7 @@ sha256 = "2bb401ffca0136622cd79bb14a5a38852061649a06cc46100503870c22d300c7" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-104" @@ -10463,7 +10463,7 @@ sha256 = "ba7aea214063b8a698fbd2c9c8cd95a717bf0ec0eaef70a92844444bf7e9f22e" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-263" @@ -10559,7 +10559,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-264" @@ -10658,7 +10658,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-186" @@ -10918,7 +10918,7 @@ sha256 = "ba7aea214063b8a698fbd2c9c8cd95a717bf0ec0eaef70a92844444bf7e9f22e" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-237" @@ -11014,7 +11014,7 @@ sha256 = "ba7aea214063b8a698fbd2c9c8cd95a717bf0ec0eaef70a92844444bf7e9f22e" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-238" @@ -11113,7 +11113,7 @@ sha256 = "ba7aea214063b8a698fbd2c9c8cd95a717bf0ec0eaef70a92844444bf7e9f22e" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-175" @@ -15601,7 +15601,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-211" @@ -15696,7 +15696,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-212" @@ -15792,7 +15792,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-213" @@ -15888,7 +15888,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-214" @@ -15984,7 +15984,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-232" @@ -16083,7 +16083,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-233" @@ -16179,7 +16179,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-234" @@ -16275,7 +16275,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-235" @@ -16371,7 +16371,7 @@ sha256 = "8c6c2ab1a63280e94f4084566888d727b13a5890b9de4c75aa90322406c5c601" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-249" @@ -17038,7 +17038,7 @@ sha256 = "dfa1998e3506f06dce142222dc383116d0952155517edc399f5d94e688e22912" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-257" @@ -17137,7 +17137,7 @@ sha256 = "dfa1998e3506f06dce142222dc383116d0952155517edc399f5d94e688e22912" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-258" @@ -17236,7 +17236,7 @@ sha256 = "dfa1998e3506f06dce142222dc383116d0952155517edc399f5d94e688e22912" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-259" @@ -17332,7 +17332,7 @@ sha256 = "dfa1998e3506f06dce142222dc383116d0952155517edc399f5d94e688e22912" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-260" @@ -17431,7 +17431,7 @@ sha256 = "dfa1998e3506f06dce142222dc383116d0952155517edc399f5d94e688e22912" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-070" @@ -24429,7 +24429,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-189" @@ -24525,7 +24525,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-190" @@ -24621,7 +24621,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-191" @@ -24717,7 +24717,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-192" @@ -24812,7 +24812,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-193" @@ -24911,7 +24911,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-194" @@ -25010,7 +25010,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-195" @@ -25111,7 +25111,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-196" @@ -25215,7 +25215,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-197" @@ -25320,7 +25320,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-198" @@ -25416,7 +25416,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-199" @@ -25521,7 +25521,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-200" @@ -25616,7 +25616,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-201" @@ -25711,7 +25711,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-271" @@ -25807,7 +25807,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-272" @@ -25903,7 +25903,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-273" @@ -26002,7 +26002,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-274" @@ -26101,7 +26101,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-275" @@ -26202,7 +26202,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-276" @@ -26302,7 +26302,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-277" @@ -26401,7 +26401,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-278" @@ -26501,7 +26501,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-279" @@ -26600,7 +26600,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-280" @@ -26701,7 +26701,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-281" @@ -26801,7 +26801,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-282" @@ -26901,7 +26901,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-283" @@ -27001,7 +27001,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-284" @@ -27100,7 +27100,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-285" @@ -27202,7 +27202,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-306" @@ -27298,7 +27298,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-307" @@ -27397,7 +27397,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-308" @@ -27493,7 +27493,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-309" @@ -27592,7 +27592,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-310" @@ -27692,7 +27692,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-311" @@ -27791,7 +27791,7 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" [[claims]] claim_id = "AP-FORMAL-RICH-312" @@ -27892,4 +27892,4 @@ sha256 = "d4d36b72718a4076b7c0561abfa2edc006a1f9a4491762979f86c3dd99a71fdc" [[claims.evidence]] kind = "source-closure" artifact = "formal/qualification/aeneas/source-closure.json" -sha256 = "8a64a13ad7b14a2e88746f98c313d7984615e7f6d21999b07709839538056e96" +sha256 = "9fce2729a265a139a8777500e1369e401bf489b791ef85a05080cc60c865ebd4" diff --git a/formal/qualification/aeneas/source-closure.json b/formal/qualification/aeneas/source-closure.json index b27bd1654..11e871be9 100644 --- a/formal/qualification/aeneas/source-closure.json +++ b/formal/qualification/aeneas/source-closure.json @@ -1,6 +1,6 @@ { "schema": "auths-proof-translation-source-closure/v2", - "digest": "569ed00719d15e6b9b3edba383f77c9ebc556cac052f34961431a42068a15d6b", + "digest": "1c1b1df527358b0f36447dc90466341a1442936b372a19a0f3aa0e3dbb7eba29", "files": [ { "path": ".cargo/config.toml", @@ -8,7 +8,7 @@ }, { "path": "Cargo.lock", - "sha256": "111314a5b4331baf97c8571a908aef55b3cad88ba3ac78231826279fbaa782ab", + "sha256": "7157ff778d20e606d0553ac8fd1d89cf9c2643abe4a12e879656008534763021", "normalization": "translated-cargo-closure-v1" }, { @@ -301,7 +301,7 @@ }, { "path": "xtask/src/checks.rs", - "sha256": "a47a5f2f4ed7d877d162fa7733bee21c5290b6108d0b56512fbac8fb36e0ed15" + "sha256": "3c23e817b066fe23ad5e048b06d515ef65c2860db65d1ced345f7344c07dbd15" }, { "path": "xtask/src/compliance.rs", diff --git a/product/integrations/auths-git-signing/src/custody.rs b/product/integrations/auths-git-signing/src/custody.rs index 214205e5c..dde18922c 100644 --- a/product/integrations/auths-git-signing/src/custody.rs +++ b/product/integrations/auths-git-signing/src/custody.rs @@ -26,7 +26,7 @@ use auths_signature::ED25519_V1; use ed25519_dalek::{Signer as _, SigningKey}; use std::fs; use std::io::Write as _; -use std::path::Path; +use std::path::{Path, PathBuf}; use thiserror::Error; use zeroize::Zeroizing; @@ -60,39 +60,123 @@ pub enum CustodyError { /// Randomness or file creation failed. #[error("could not create the key: {0}")] Create(String), + /// Publication may have succeeded, but its durable acknowledgement failed. + /// Load the complete key at the requested path; never replace its identity. + #[error("key publication is unconfirmed; load the existing key before retrying: {0}")] + PublicationUncertain(String), /// A `did:key` identifier could not be derived. #[error("could not derive the did:key identity")] Identity, } +/// Observation boundaries of the single creation owner, used for interruption +/// evidence without placing process-global fault controls on the public API. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +enum KeyPublicationPoint { + StagingCreated, + SeedWritten, + ContentsSynchronized, + Published, + StagingRemoved, + ParentSynchronized, + Acknowledged, +} + +/// Owns only an unpublished sibling name. Dropping this owner must never unlink +/// the installed pathname, including after an uncertain publication result. +struct StagedSoftwareKey { + path: PathBuf, + file: fs::File, +} + +impl StagedSoftwareKey { + fn create(parent: &Path) -> Result { + let mut identifier = [0_u8; 16]; + getrandom::fill(&mut identifier) + .map_err(|error| CustodyError::Create(error.to_string()))?; + let path = parent.join(format!(".auths-key-staging-{}", hex::encode(identifier))); + let mut options = fs::OpenOptions::new(); + options.write(true).create_new(true); + #[cfg(unix)] + { + use std::os::unix::fs::OpenOptionsExt as _; + options.mode(0o600); + } + let file = options + .open(&path) + .map_err(|error| CustodyError::Create(error.to_string()))?; + Ok(Self { path, file }) + } +} + +impl Drop for StagedSoftwareKey { + fn drop(&mut self) { + // An interrupted pre-publication operation may require manual removal + // of this private file. Cleanup never changes a published identity. + let _ = fs::remove_file(&self.path); + } +} + impl SoftwareKey { - /// Generates a new key and writes its seed to `path` with mode 0600. + /// Publishes a complete new key at `path` with mode 0600. + /// + /// A private sibling owns staging until its contents are synchronized. + /// Exclusive publication never replaces another identity. The parent + /// directory is synchronized before success is acknowledged. A terminated + /// creator may leave a private staging file, which is never loaded as a key. /// /// # Errors /// /// Returns [`CustodyError::Exists`] rather than overwrite a key, and - /// [`CustodyError::Create`] when randomness or the file cannot be created. + /// [`CustodyError::Create`] before publication. After publication may have + /// succeeded, [`CustodyError::PublicationUncertain`] requires loading and + /// verifying that exact installed key instead of creating a replacement. pub fn generate(path: &Path) -> Result { + Self::generate_observed(path, |_| Ok(())) + } + + fn generate_observed( + path: &Path, + mut observe: impl FnMut(KeyPublicationPoint) -> std::io::Result<()>, + ) -> Result { let mut seed = Zeroizing::new([0_u8; 32]); getrandom::fill(seed.as_mut()).map_err(|error| CustodyError::Create(error.to_string()))?; - let mut options = fs::OpenOptions::new(); - options.write(true).create_new(true); - #[cfg(unix)] - { - use std::os::unix::fs::OpenOptionsExt as _; - options.mode(0o600); - } - let mut file = options.open(path).map_err(|error| { + let key = Self::from_seed(&seed)?; + let parent = path + .parent() + .filter(|parent| !parent.as_os_str().is_empty()) + .unwrap_or_else(|| Path::new(".")); + let mut staging = StagedSoftwareKey::create(parent)?; + let before_publication = |error: std::io::Error| CustodyError::Create(error.to_string()); + observe(KeyPublicationPoint::StagingCreated).map_err(before_publication)?; + staging + .file + .write_all(seed.as_ref()) + .map_err(before_publication)?; + observe(KeyPublicationPoint::SeedWritten).map_err(before_publication)?; + staging.file.sync_all().map_err(before_publication)?; + observe(KeyPublicationPoint::ContentsSynchronized).map_err(before_publication)?; + // A hard link is an atomic no-replacement publication on the same + // filesystem. The installed pathname can only name the complete seed. + fs::hard_link(&staging.path, path).map_err(|error| { if error.kind() == std::io::ErrorKind::AlreadyExists { CustodyError::Exists } else { - CustodyError::Create(error.to_string()) + // Conservatively include a lost filesystem acknowledgement. + CustodyError::PublicationUncertain(error.to_string()) } })?; - file.write_all(seed.as_ref()) - .and_then(|()| file.sync_all()) - .map_err(|error| CustodyError::Create(error.to_string()))?; - Self::from_seed(&seed) + let after_publication = + |error: std::io::Error| CustodyError::PublicationUncertain(error.to_string()); + observe(KeyPublicationPoint::Published).map_err(after_publication)?; + fs::remove_file(&staging.path).map_err(after_publication)?; + observe(KeyPublicationPoint::StagingRemoved).map_err(after_publication)?; + fs::File::open(parent) + .and_then(|directory| directory.sync_all()) + .map_err(after_publication)?; + observe(KeyPublicationPoint::ParentSynchronized).map_err(after_publication)?; + observe(KeyPublicationPoint::Acknowledged).map_err(after_publication)?; + Ok(key) } /// Loads the key whose seed is stored at `path`. @@ -264,7 +348,305 @@ impl GitProofSigner for CustodyKeySigner { #[cfg(all(test, unix))] mod tests { use super::*; + use std::io::{BufRead as _, Read as _}; use std::os::unix::fs::PermissionsExt as _; + use std::process::{Child, Command, Stdio}; + use std::sync::{Arc, Condvar, Mutex, mpsc}; + use std::time::Duration; + + const PUBLICATION_POINTS: &[KeyPublicationPoint] = &[ + KeyPublicationPoint::StagingCreated, + KeyPublicationPoint::SeedWritten, + KeyPublicationPoint::ContentsSynchronized, + KeyPublicationPoint::Published, + KeyPublicationPoint::StagingRemoved, + KeyPublicationPoint::ParentSynchronized, + KeyPublicationPoint::Acknowledged, + ]; + + fn published(point: KeyPublicationPoint) -> bool { + matches!( + point, + KeyPublicationPoint::Published + | KeyPublicationPoint::StagingRemoved + | KeyPublicationPoint::ParentSynchronized + | KeyPublicationPoint::Acknowledged + ) + } + + #[test] + fn software_key_publication_faults_never_expose_partial_or_replace_existing_keys() { + for &point in PUBLICATION_POINTS { + let directory = tempfile::tempdir().expect("tempdir"); + let path = directory.path().join("agent.seed"); + let result = SoftwareKey::generate_observed(&path, |current| { + for entry in fs::read_dir(directory.path())? { + assert_eq!(entry?.metadata()?.permissions().mode() & 0o777, 0o600); + } + if published(current) { + SoftwareKey::load(&path).expect("published keys are complete"); + } else { + assert!(!path.exists(), "staging is not an installed identity"); + } + if current == point { + Err(std::io::Error::other("injected publication failure")) + } else { + Ok(()) + } + }); + if published(point) { + assert!(matches!(result, Err(CustodyError::PublicationUncertain(_)))); + let identity = SoftwareKey::load(&path) + .expect("load uncertain publication") + .principal(); + assert!(matches!( + SoftwareKey::generate(&path), + Err(CustodyError::Exists) + )); + assert_eq!( + SoftwareKey::load(&path).expect("same key").principal(), + identity + ); + } else { + assert!(matches!(result, Err(CustodyError::Create(_)))); + assert!(!path.exists()); + SoftwareKey::generate(&path).expect("safe fresh creation before publication"); + } + assert_eq!(fs::read_dir(directory.path()).expect("entries").count(), 1); + } + } + + #[test] + fn competing_software_key_creators_publish_exactly_one_complete_identity() { + let directory = tempfile::tempdir().expect("tempdir"); + let path = directory.path().join("agent.seed"); + let barrier = Arc::new((Mutex::new(0), Condvar::new())); + let creators: Vec<_> = + (0..2) + .map(|_| { + let path = path.clone(); + let barrier = Arc::clone(&barrier); + std::thread::spawn(move || { + SoftwareKey::generate_observed(&path, |point| { + if point == KeyPublicationPoint::ContentsSynchronized { + assert!(!path.exists()); + let (arrivals, ready) = &*barrier; + let mut arrived = arrivals.lock() + .map_err(|_| std::io::Error::other("creator barrier poisoned"))?; + *arrived += 1; + ready.notify_all(); + let (_arrived, waited) = ready.wait_timeout_while( + arrived, Duration::from_secs(20), |arrived| *arrived < 2, + ).map_err(|_| std::io::Error::other("creator barrier poisoned"))?; + if waited.timed_out() { + return Err(std::io::Error::new(std::io::ErrorKind::TimedOut, + "competing creator failed to reach synchronized publication")); + } + } + Ok(()) + }).map(|key| key.principal()) + }) + }) + .collect(); + let mut identities = Vec::new(); + let mut conflicts = 0; + for creator in creators { + match creator.join().expect("creator") { + Ok(identity) => identities.push(identity), + Err(CustodyError::Exists) => conflicts += 1, + Err(error) => panic!("unexpected creation result: {error}"), + } + } + assert_eq!(conflicts, 1); + assert_eq!( + identities, + vec![SoftwareKey::load(&path).expect("installed key").principal()] + ); + assert_eq!(fs::read_dir(directory.path()).expect("entries").count(), 1); + } + + struct InterruptedCreator(Child); + + impl Drop for InterruptedCreator { + fn drop(&mut self) { + let _ = self.0.kill(); + let _ = self.0.wait(); + } + } + + fn publication_child(path: &Path) -> Command { + let mut command = Command::new(std::env::current_exe().expect("test executable")); + command + .args([ + "--exact", + "custody::tests::software_key_publication_child", + "--nocapture", + ]) + .env("AUTHS_TEST_KEY_PUBLICATION_PATH", path) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()); + command + } + + #[test] + fn software_key_publication_child() { + let Some(path) = std::env::var_os("AUTHS_TEST_KEY_PUBLICATION_PATH") else { + return; + }; + let path = Path::new(&path); + if std::env::var_os("AUTHS_TEST_KEY_CALLER_ACKNOWLEDGEMENT").is_some() { + // This gate is outside generate: the caller has actually received + // Ok and can acknowledge its installed identity before termination. + let installed = SoftwareKey::generate(path).expect("caller received success"); + println!( + "PUBLICATION_ACKNOWLEDGED {}", + installed.principal().as_str() + ); + std::io::stdout() + .flush() + .expect("acknowledgement delivered"); + std::io::stdin().read_exact(&mut [0]).expect("caller gate"); + } else if let Ok(boundary) = std::env::var("AUTHS_TEST_KEY_PUBLICATION_POINT") { + SoftwareKey::generate_observed(path, |point| { + if format!("{point:?}") == boundary { + println!("PUBLICATION_BOUNDARY {boundary}"); + std::io::stdout().flush()?; + std::io::stdin().read_exact(&mut [0])?; + } + Ok(()) + }) + .expect("child publication"); + } else { + println!( + "INSTALLED_PRINCIPAL {}", + SoftwareKey::load(path) + .expect("reopened complete key") + .principal() + .as_str() + ); + } + } + + #[test] + fn caller_acknowledged_software_key_survives_process_termination_and_reopen() { + let directory = tempfile::tempdir().expect("tempdir"); + let path = directory.path().join("agent.seed"); + let mut child = InterruptedCreator( + publication_child(&path) + .env("AUTHS_TEST_KEY_CALLER_ACKNOWLEDGEMENT", "1") + .spawn() + .expect("creator process"), + ); + let stdout = child.0.stdout.take().expect("stdout"); + let (sent, received) = mpsc::channel(); + let reader = std::thread::spawn(move || { + for line in std::io::BufReader::new(stdout).lines() { + let line = line.expect("child output"); + if let Some(principal) = line.strip_prefix("PUBLICATION_ACKNOWLEDGED ") { + let _ = sent.send(principal.to_owned()); + break; + } + } + }); + let acknowledged = received + .recv_timeout(Duration::from_secs(20)) + .expect("caller acknowledged successful publication"); + child + .0 + .kill() + .expect("terminate after caller observed success"); + child.0.wait().expect("join creator"); + reader.join().expect("acknowledgement reader"); + let reopened = publication_child(&path).output().expect("restart reader"); + assert!(reopened.status.success()); + assert!( + String::from_utf8(reopened.stdout) + .expect("reader output") + .contains(&format!("INSTALLED_PRINCIPAL {acknowledged}")) + ); + assert_eq!( + SoftwareKey::load(&path) + .expect("same acknowledged key") + .principal() + .as_str(), + acknowledged + ); + assert!(matches!( + SoftwareKey::generate(&path), + Err(CustodyError::Exists) + )); + assert_eq!(fs::read_dir(directory.path()).expect("entries").count(), 1); + } + + #[test] + fn software_key_publication_process_interruption_matrix() { + for &point in PUBLICATION_POINTS { + let directory = tempfile::tempdir().expect("tempdir"); + let path = directory.path().join("agent.seed"); + let mut child = InterruptedCreator( + publication_child(&path) + .env("AUTHS_TEST_KEY_PUBLICATION_POINT", format!("{point:?}")) + .spawn() + .expect("creator process"), + ); + let stdout = child.0.stdout.take().expect("stdout"); + let (sent, received) = mpsc::channel(); + let reader = std::thread::spawn(move || { + for line in std::io::BufReader::new(stdout).lines() { + let line = line.expect("child output"); + if line.starts_with("PUBLICATION_BOUNDARY ") { + let _ = sent.send(line); + break; + } + } + }); + received + .recv_timeout(Duration::from_secs(20)) + .expect("owned publication barrier"); + child.0.kill().expect("terminate at exact boundary"); + child.0.wait().expect("join terminated creator"); + reader.join().expect("reader"); + if published(point) { + let principal = SoftwareKey::load(&path) + .expect("complete published key") + .principal(); + let reopened = publication_child(&path).output().expect("restart reader"); + assert!(reopened.status.success()); + assert!( + String::from_utf8(reopened.stdout) + .expect("output") + .contains(&format!("INSTALLED_PRINCIPAL {}", principal.as_str())) + ); + assert!(matches!( + SoftwareKey::generate(&path), + Err(CustodyError::Exists) + )); + assert_eq!( + SoftwareKey::load(&path) + .expect("unchanged identity") + .principal(), + principal + ); + } else { + assert!(!path.exists()); + SoftwareKey::generate(&path).expect("restart creates first installed key"); + } + // SIGKILL can leave private staging files; none becomes the final + // identity. This is process-interruption, not power-loss evidence. + for entry in fs::read_dir(directory.path()).expect("entries") { + assert_eq!( + entry + .expect("entry") + .metadata() + .expect("metadata") + .permissions() + .mode() + & 0o777, + 0o600 + ); + } + } + } #[test] fn software_keys_are_owner_only_and_never_overwritten() { @@ -292,5 +674,13 @@ mod tests { SoftwareKey::load(&path), Err(CustodyError::Malformed) )); + assert!(matches!( + SoftwareKey::generate(&path), + Err(CustodyError::Exists) + )); + assert_eq!( + fs::read(&path).expect("malformed identity remains untouched"), + [0_u8; 31] + ); } } diff --git a/product/runtime/auths-gateway/semantic-closure.json b/product/runtime/auths-gateway/semantic-closure.json index b0966dbaa..2e38ef3c9 100644 --- a/product/runtime/auths-gateway/semantic-closure.json +++ b/product/runtime/auths-gateway/semantic-closure.json @@ -1 +1 @@ -{"files":[{"path":"Cargo.lock","sha256":"6b5774d25d19b175baf50f5e109caeea875712aaade8a52cdb20628a3fe35062"},{"path":"Cargo.toml","sha256":"f372f4257f5687249c22073205f1f5cd84f4854155d1293aa75670b4dcd71cd2"},{"path":"core/adapters/auths-did-keri/Cargo.toml","sha256":"86ba3e3f9a0a70d970568bfb3113b7ba7bbdd81c3eebbb52743dd574a0c0ecaa"},{"path":"core/adapters/auths-did-keri/src/lib.rs","sha256":"a75674842f8a7142004369ccd206ab43e476459293f0ff4bed4d4e659031b3e3"},{"path":"core/adapters/auths-did-key/Cargo.toml","sha256":"d5a3ae07ecde83f91eed4c3785051dd0f44eab6c891754f3309b6b40596707d7"},{"path":"core/adapters/auths-did-key/src/lib.rs","sha256":"b76a3f4528a725df53cfa9242e6e414e1d26caa48468aaed497e28b121f4497c"},{"path":"core/adapters/auths-raw-key/Cargo.toml","sha256":"f49616bc18c19e6aaa7e6a02ccebcdb9f5c1422c1278ef9869e0dbf22ceda7be"},{"path":"core/adapters/auths-raw-key/src/lib.rs","sha256":"45eec1b295dac3bed65cd79c942870b926b06b3f5d38eaebaeb6140ac69315fa"},{"path":"core/crates/auths-algebra-kernel/Cargo.toml","sha256":"0cb078915287b8c47d20fb97b6fa14135ed1c61c4985c4de2753855563c27bba"},{"path":"core/crates/auths-algebra-kernel/src/generated.rs","sha256":"ae4bcbef42a408c7ffa0c6a74a42f7de177a6f14479e51d205acf830bda05960"},{"path":"core/crates/auths-algebra-kernel/src/lib.rs","sha256":"6654667eeb9b353d6648954c9fd2e8838462a82ce6b2803eb49e1366892c68c6"},{"path":"core/crates/auths-assurance/Cargo.toml","sha256":"afcb12a97ddd09d7a264b9ecd3fcaefc865ff2c9b4539ee85b00883420ba333a"},{"path":"core/crates/auths-assurance/src/lib.rs","sha256":"0fb2ec844d674b25a9e20b1601452c89c2454901fa506adfa9bb38ef9a7fa213"},{"path":"core/crates/auths-author/Cargo.toml","sha256":"1e6f0e3bc079ddb558decf0db26b291c6e72fc47327b6df1b7650d41689b215f"},{"path":"core/crates/auths-author/src/lib.rs","sha256":"e14475f2f49715a1869d5fa6b11ff1fbb72497e39097e09f833b0bae7e5b3f2b"},{"path":"core/crates/auths-author/src/observations.rs","sha256":"dda7d6bfa6f4bd7e95a480ca283c2c0e996f69c5c15cb0c7197af328131a7066"},{"path":"core/crates/auths-authority/Cargo.toml","sha256":"4f68212938029f79ebd857b4f3038494eb85d0163d49f07e51376715cf959815"},{"path":"core/crates/auths-authority/src/lib.rs","sha256":"da88d5194de4e17449e69972c0fb042afa3c39798a8f570f30771e77c384f1eb"},{"path":"core/crates/auths-codec/Cargo.toml","sha256":"e20e51826e17814effd9d8925d18d5fbdd6c0d37bf50231e743ec2611314722c"},{"path":"core/crates/auths-codec/src/approval.rs","sha256":"fbff43bf4d57f69f8b7738a8647751cde75c5a932dee65d924a1fe9c7202f91f"},{"path":"core/crates/auths-codec/src/bounded_policy.rs","sha256":"d21f6728be2d8a04b6d94921f2b683f7e61cbb42e0ac6866f1c88a49caa534c3"},{"path":"core/crates/auths-codec/src/decode.rs","sha256":"ba2999584cdf53b1b517ecb9c7ea50d39efee17c666a9a38e2ad1ac94379f778"},{"path":"core/crates/auths-codec/src/encode.rs","sha256":"8491192053e2e15d62b4d2a491de22405b7487ead69ab6f6bca40669ce7ca5f7"},{"path":"core/crates/auths-codec/src/error.rs","sha256":"fecb0737c16deb42d859f1dc7727c698438d9ac12064fd99e0024629642c390c"},{"path":"core/crates/auths-codec/src/hash.rs","sha256":"f88e111f1dbb2cef6b7b5e9c948cb45ff92e366710c8a5f5c636138aa748479e"},{"path":"core/crates/auths-codec/src/lib.rs","sha256":"3b0e5c94c6f34f750b88a9333e1d5c8145746d845d3a23e0d2f61807cf592ea7"},{"path":"core/crates/auths-codec/src/observation.rs","sha256":"38328b0c71ff97a4196eeade8b4faa889527ff1f80bb168468bcd49082a3987e"},{"path":"core/crates/auths-composition/Cargo.toml","sha256":"331e13025eb82588b5269ed3975929eb41c823d588c49e4c296273d85c6fe80e"},{"path":"core/crates/auths-composition/src/lib.rs","sha256":"e42e3b0b6a9985b73c533aeb23799c638979aa27a9ce7d0f10a8d60340570fb1"},{"path":"core/crates/auths-model/Cargo.toml","sha256":"565c15302b0cc9270db1e28efa3862804846850ba933cc17aea8abcec4a65987"},{"path":"core/crates/auths-model/src/approval.rs","sha256":"54cf44a9ef747ec21546a4086aecfb130bc7803b0d646430e6082df51e6e305f"},{"path":"core/crates/auths-model/src/bounded.rs","sha256":"f90496abc0a06c028b4d850af6ddab7d850bfafeaa3d042f1b1246a41d8bbbc9"},{"path":"core/crates/auths-model/src/bounded_policy.rs","sha256":"306a8f049cc7cfc7635fe0e4de47eb7813eed63d3c14c3be2b51586aa4eea450"},{"path":"core/crates/auths-model/src/lib.rs","sha256":"e7cfe6bb9574c6b016aa63e70658c31e0b90903ec6479a49f4a2ceb64f5bad97"},{"path":"core/crates/auths-model/src/observation.rs","sha256":"b3ed3e3cc090afca2896a7d3de7988afccc1ee1ea0ebd91b51a8bc0f20ad8dbb"},{"path":"core/crates/auths-multikey/Cargo.toml","sha256":"858756c1197befcada06134742bffe8d58cf674cadd6c046bf710570e96efaf2"},{"path":"core/crates/auths-multikey/src/lib.rs","sha256":"f5177fffb11e40eeaaa665ba886c541fc1f24d5eacdd6983fb03dc20148733f0"},{"path":"core/crates/auths-ports/Cargo.toml","sha256":"596a9b0f5af3717c16a6d13f7054d8a106bcd9f01f5f72c2235dd2afcf0ab16c"},{"path":"core/crates/auths-ports/src/binding.rs","sha256":"a16c012d40aa4249e3ec54372b9611006d0bfe8c7dc3c741911c2194ad17736d"},{"path":"core/crates/auths-ports/src/diagnostics.rs","sha256":"aa596572503b5a65a918bb2ff38281c144ff53821ee914e9325c852828d852df"},{"path":"core/crates/auths-ports/src/lib.rs","sha256":"8da1debf86f9532df0660155d04298beb1ba3a1204508f8586e2e67cd2fb3449"},{"path":"core/crates/auths-ports/src/path.rs","sha256":"b68fc547b4e4d97a60cbbc1cc1939fc6b34a8233b81f840bd396914a707e3ea1"},{"path":"core/crates/auths-raw-key-core/Cargo.toml","sha256":"98c0bc8527a537512e43a74dd6ba9658c6f0cdc16610cf938e3f9b43785d836d"},{"path":"core/crates/auths-raw-key-core/src/lib.rs","sha256":"98c0500c41697aae28708ad0bf970b9a97583d96a3d2c18d23e7fa351e0f7d12"},{"path":"core/crates/auths-registries/Cargo.toml","sha256":"590e49e58b0622d9d6274fea46796dcdb07dec9550eff295cce6a6427ffa51e2"},{"path":"core/crates/auths-registries/src/lib.rs","sha256":"450d3886d85ee333b7e046317fb5b47cde62483d5f3e41d46265e2caf4c373ec"},{"path":"core/crates/auths-registries/src/template.rs","sha256":"1224039dd2b3ce6fa8357613d8cafbae40400493da7176da202b9ade62fa05e4"},{"path":"core/crates/auths-signature-core/Cargo.toml","sha256":"6bee2230eb30af1be0bd5c2d57bd3e1903497a70028d47290d4ac6e9e0e8bca0"},{"path":"core/crates/auths-signature-core/src/lib.rs","sha256":"db97ecb45a82faa6f96a92738d3af1da92d1ba2f241f2c29114f4b8107dc4ab0"},{"path":"core/crates/auths-signature/Cargo.toml","sha256":"7f7b5682466ba439d8c59579022cb61068cad9fb4bd2d73e1cc21327c902b450"},{"path":"core/crates/auths-signature/src/lib.rs","sha256":"b3d9ac4cc3ba0797b9e1c09f2d6ac05089b25dac4e285a5af28c0165b33d925b"},{"path":"core/crates/auths-verifier/Cargo.toml","sha256":"c43358e06a33324b41a8b93e5cc7279c55f7d21f1f6cfaa539a3fc7b4c27a38f"},{"path":"core/crates/auths-verifier/src/approval.rs","sha256":"c3cae6a49e169051eb555bb092b1069a4d422516d6a2114623a89e5f31ff923f"},{"path":"core/crates/auths-verifier/src/causal.rs","sha256":"9635230f33b13a263573d319ac8a1976addbcc07677514a43e3c7bf28dc04587"},{"path":"core/crates/auths-verifier/src/lib.rs","sha256":"f22dec38dfa47ced8da4f605390da8453273bee1da010f57fd1fdfcb10e0b389"},{"path":"core/crates/auths-verifier/src/observation.rs","sha256":"0bb07f06a0f9524c88427df1c972b1de8ba038a9eeeb15d3134c25125ae84b1e"},{"path":"core/crates/auths-verifier/src/trace.rs","sha256":"2213d72023a1d9e0413a2cf2c51c3dad9e04775d86033a0caaa9d29a8f0036f8"},{"path":"exchange/crates/auths-proof-exchange-model/Cargo.toml","sha256":"34b2db64f93a288e942b5a3918d28cdcbef906e0dc9074ce848018d3d5f7a1fa"},{"path":"exchange/crates/auths-proof-exchange-model/src/lib.rs","sha256":"49fac5aff2339d3a57c41cb8bb2a82852538e8f77ecc4b157c88e264ff31fb55"},{"path":"exchange/crates/auths-proof-exchange-port/Cargo.toml","sha256":"7ff660f1b7579dc570c791090aeb450404fbbf44c92781e289f5ccdde746d739"},{"path":"exchange/crates/auths-proof-exchange-port/src/lib.rs","sha256":"b408fb40c6432edc1facb3d8b3e9433a033f8dc73fe2e0ba5a88c972ca675021"},{"path":"product/config/auths-config/Cargo.toml","sha256":"e4b568ab9f6d84f7d7e6d66443fe825f360db9c27bc7c31d6ddc0647ba3ab304"},{"path":"product/config/auths-config/src/lib.rs","sha256":"fecf00ea65cef9018fda9af2063326d7065b869266d0d9e73a4f06816f1102cc"},{"path":"product/errors/auths-errors/Cargo.toml","sha256":"3b3a199b6460ba75bda84475bb5accd35e1485448a3981038db85bf4772dd350"},{"path":"product/errors/auths-errors/src/lib.rs","sha256":"7feeb9069fa4003f94f1f07c1c94619cf1c883e0dbaaf2187f04d0f742264bdd"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/Cargo.toml","sha256":"716f1f2a117d6d69d8effe9ee9057e24ba3502f20af6a602b06facb638cdabed"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/api.rs","sha256":"9ea61dd7ddd93282b073b98e453e6b75b26dc49689c04e9782435d06a3a09e48"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/clock.rs","sha256":"73f0a6e0f5903883329fa6683f5888288f759512ac69e5c87efd2b6b87f7d79f"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/http.rs","sha256":"14c1fce14e24c984b2a275563a29b6326fb08367922b6e8d37ba38b9cb81aa2b"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/identity.rs","sha256":"186de11230c8b33375951c4368609f8976bf9795f171af3fd7fac26207a94361"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/lib.rs","sha256":"0b4617d044f5254a5ab22f5a2578f91cc025206a8c1845be39c1c56dcdf7a5df"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/names.rs","sha256":"41bb23572d6002e23ee103d6fe70ecd68764861c6f2e48a1c53af998270a4afa"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/sigv4.rs","sha256":"39fed883f4802e68d3b41a68fea0aba0737810996b33d13577de70faba004c29"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/store.rs","sha256":"fc60ee9c49b2f4f063c449b4c78100c5c4872779e94ca168f796603b380ef6e4"},{"path":"product/integrations/auths-custody/Cargo.toml","sha256":"1e14034185ad1ec24a977fd5f41d0abee219606245c046ce2a82287fadef448b"},{"path":"product/integrations/auths-custody/src/conformance.rs","sha256":"13a2b28bba4a7af5b00bb96d16ecf027d35d5487b314e48a666fb8ed09c2f2e9"},{"path":"product/integrations/auths-custody/src/key.rs","sha256":"c3b1468b8538421a796aeb65a0cd94b942e3788e78741f20dde07b4838e0c3da"},{"path":"product/integrations/auths-custody/src/lib.rs","sha256":"836ad8044440fd250457a46f5c4a980339534a8af6a4daac2643560050b62d39"},{"path":"product/operations/auths-operations/Cargo.toml","sha256":"73dde1e914ba5e1386f8d49c0d730423cc72ae77ec44c6554a6a75cc8e8922b1"},{"path":"product/operations/auths-operations/src/explanation.rs","sha256":"b4a39bcbd5712cb9e735ee7deeb281f3fa6af5ddca973735bf3d87dce427ef11"},{"path":"product/operations/auths-operations/src/lib.rs","sha256":"3f401a56555113b98f57bca172a2660eaecedf76247b83a3fdbb089c133a29cd"},{"path":"product/operations/auths-operations/src/render/json.rs","sha256":"2ae042639960afee123730e945d373bc5dda1d2b3af20ae16c939a7e99b9e418"},{"path":"product/operations/auths-operations/src/render/mod.rs","sha256":"b3b7f6fe473f49227ace5a68bfc3d8dc14b5db8dd9888fd9e207070337b1b8bf"},{"path":"product/operations/auths-operations/src/render/text.rs","sha256":"f216cf3bdb00e264523271b16e7059535ac6b1aabf271cebd7935af155e4bfec"},{"path":"product/policy/auths-bounded-policy/Cargo.toml","sha256":"babd5d200923137ead71d8c2528f847cea323ce98da942a1320b054436612c47"},{"path":"product/policy/auths-bounded-policy/src/arithmetic.rs","sha256":"75e43c5d4eab8d1f71c1daf53839f5f9fe45a400afc1f63a30c6f55ce3632627"},{"path":"product/policy/auths-bounded-policy/src/commitment.rs","sha256":"c5706f2d583454e1a7f570f7ada138d4d864bef0205dfae7c1296774f396bb3f"},{"path":"product/policy/auths-bounded-policy/src/eligibility.rs","sha256":"c9acdfb793074e687fc36efad506be27dbd99ffbf40387bc66c8de39ef238432"},{"path":"product/policy/auths-bounded-policy/src/identifier.rs","sha256":"0006a32bae9eb16c4178cf797df418d2b0a781f2bc6474b741dc1a908141831c"},{"path":"product/policy/auths-bounded-policy/src/kernel.rs","sha256":"99187c28b161ac70bee1afed60711f7f645adb4d1671a01863f9849b369811d5"},{"path":"product/policy/auths-bounded-policy/src/lib.rs","sha256":"76a18638b810e62e594d6e951504679305ce21841388e0c282ad51cd7841b91c"},{"path":"product/policy/auths-bounded-policy/src/receipt.rs","sha256":"3b9eae82f349956d3e7f29b57b254bff5ce67cc703e6cf43445ce2827676d1ad"},{"path":"product/policy/auths-bounded-policy/src/registry.rs","sha256":"4e251ea5833559841f8ee0bd9b66c0c01c39fa5e3a21720a19c4e8adbfcb99d0"},{"path":"product/profiles/auths-profile-api/Cargo.toml","sha256":"7ae85761f58625b5d678f961fd052eebf3e000ef565c7312e3ac857763c0017f"},{"path":"product/profiles/auths-profile-api/src/lib.rs","sha256":"a194b82b20bf8aa864c2334ef6c6aec30b2154ded972862252d5dcefa488ab95"},{"path":"product/profiles/auths-profile-mcp/Cargo.toml","sha256":"db264fc25242f7b7e4133cbe5782545b3107b406c87168ae072683cfb59eac66"},{"path":"product/profiles/auths-profile-mcp/src/arguments.rs","sha256":"a5de696586d507e2aee4a49fee99ef1ef4c51a2e46603f8838f1af6d9009833f"},{"path":"product/profiles/auths-profile-mcp/src/lib.rs","sha256":"81c05c307797b347baaa6ad2bd483cb21cf9d0b0aa4a66710e08e16a1f22c4c1"},{"path":"product/profiles/auths-profile-mcp/src/session.rs","sha256":"166c281fa66333388e4760d6098dad02d3359e1d5de4b8f93312c014f97abb03"},{"path":"product/qualification/auths-recipe-qualification/Cargo.toml","sha256":"b7b15b30b9a3d96d4f089d514266d3a892de6608d30707aa44be31cca89ca9fe"},{"path":"product/qualification/auths-recipe-qualification/src/canonical.rs","sha256":"30a9b50777f0dcb4b606abfee2467d5a975d9f6ad941ab6c13ca3df5b359f667"},{"path":"product/qualification/auths-recipe-qualification/src/closure.rs","sha256":"0ad6aee9bd981e2863fa725f209ec84031db2ff12f4c7ac3aaf5120f0bb86039"},{"path":"product/qualification/auths-recipe-qualification/src/commissioning.rs","sha256":"db135c55e4e3079a73253ebae275536523eb36b545d1c152b4d7dce3c6b76828"},{"path":"product/qualification/auths-recipe-qualification/src/commissioning/tests.rs","sha256":"4dde3736d206099b1bea4c14e0092c6c1287d1af9065958777d7c54331dd8686"},{"path":"product/qualification/auths-recipe-qualification/src/error.rs","sha256":"52d5cf720a1e4579008fdda90a3ac2c31f0b8db57985f121f65e54b4da2b7dd1"},{"path":"product/qualification/auths-recipe-qualification/src/evidence.rs","sha256":"ba45a7409d67a8af26ab811af306412014557477a101ab2a8eb0faf8f2bd4b91"},{"path":"product/qualification/auths-recipe-qualification/src/ids.rs","sha256":"e81a906d571497ab2da753e1532d4443706410e0b75fdd59a7d2d788c7aec403"},{"path":"product/qualification/auths-recipe-qualification/src/launch.rs","sha256":"805154ce931e3977f2a2a2c62909d90f7c0a22dc167bf4f1554dcf19316ffef8"},{"path":"product/qualification/auths-recipe-qualification/src/lib.rs","sha256":"0e24b0f81191df0d078c7f4d73ced784ba9472372bfcdff3c7d0e2fb1687b323"},{"path":"product/qualification/auths-recipe-qualification/src/model.rs","sha256":"3484eb0ec287b23d4682ade7b1b0f8d1335985b3fb180f06fc28716076957d5f"},{"path":"product/qualification/auths-recipe-qualification/src/release.rs","sha256":"ec478e53f70052e566aac7e15be2f9e1b1cd46837ac6990ae955fa864d311586"},{"path":"product/qualification/auths-recipe-qualification/src/vectors/mod.rs","sha256":"1e4e5edc12d921e6b95475b3c1850f58f622c088d24a1fc9398d34019fb2f288"},{"path":"product/qualification/auths-recipe-qualification/src/vectors/schemas.rs","sha256":"c59feec2805621f341a90f81fc005e2c12f7a70f9d264fdeacccb2be4fe1c046"},{"path":"product/qualification/auths-recipe-qualification/src/vectors/verification.rs","sha256":"bdf5746fed4d10a7f577f7878619a917d29aa8b7d522f00d9f774e53eff4c8c1"},{"path":"product/qualification/auths-recipe-qualification/src/verify.rs","sha256":"646ff0e52e915174ad183768706e35e5ce2118b83475455310b930a77a7877f6"},{"path":"product/receipts/auths-receipts/Cargo.toml","sha256":"6001fa1375899953aafcb07c23a6da0c8f57ea7ec08bb9c950b12a60a8cc6f0f"},{"path":"product/receipts/auths-receipts/src/disclosure.rs","sha256":"ba9ed439be0a320c8a01f5b6e9b51361c1a37e076947490d8e4a484ba6bb119c"},{"path":"product/receipts/auths-receipts/src/lib.rs","sha256":"547a57c4160256719cafb7d0ab972d9fc80b0da14fbbce4148c70c414070ff36"},{"path":"product/runtime/auths-connections/Cargo.toml","sha256":"babeb6e1dda3dfb66291713ce1e43dce5c349833d0b50ea4dccbf986030026b2"},{"path":"product/runtime/auths-connections/src/credential.rs","sha256":"22bc7de6bcab7cebebb64edf6423d59b6493b78dca65b9da62749e3171217762"},{"path":"product/runtime/auths-connections/src/kernel.rs","sha256":"a456af19526ef7b19278551fd8d97606b6e7aa5a195e70bdd85d1e0786090ce8"},{"path":"product/runtime/auths-connections/src/lib.rs","sha256":"79209249a0acba0e854d9937255ea0e30a9a6f8e1c2baad77ab83646d392de22"},{"path":"product/runtime/auths-connections/src/model.rs","sha256":"de34a089cac9702acb889b7602b3e4732306c9e61029ec892582b7e02b73fc77"},{"path":"product/runtime/auths-connections/src/registry.rs","sha256":"e57640e003e72ad3235c567c2bb944a262bd64e673f023b62ea091094cc7e946"},{"path":"product/runtime/auths-gateway-kernel/Cargo.toml","sha256":"34f864e67656af4ac7e5c7a347a23f01fc8ab31365b8e23c0ef474483b14a183"},{"path":"product/runtime/auths-gateway-kernel/src/construct.rs","sha256":"e9d65744bae273d65face4285e5d2da75c06a92ab48f7b8333d496604e31c63c"},{"path":"product/runtime/auths-gateway-kernel/src/lib.rs","sha256":"cfda6f8453426564c085475f183b6f790b438768a19668f1b65d33ba59dc8632"},{"path":"product/runtime/auths-gateway-kernel/src/order.rs","sha256":"efc2f2eef68232fe3082e1607e6f1e87d4a19cbb2f492bdc6e71916a2461b6a8"},{"path":"product/runtime/auths-gateway-kernel/src/outcome.rs","sha256":"ac0245699457c802a70cdd6f52a01dcb4777c487b58ed7dc9cfc99345465ccaa"},{"path":"product/runtime/auths-gateway-kernel/src/ratio.rs","sha256":"7ace22264812e6fc1ef3a62afee402cf43494bb71ae0d3de219ad1b39d690bcb"},{"path":"product/runtime/auths-gateway-kernel/src/recovery.rs","sha256":"9f46dcd1685ab6e4d1ba04a3fc286a9f3afee8fb47829be1fbc670a7926a2dc6"},{"path":"product/runtime/auths-gateway-kernel/src/transition.rs","sha256":"9c9c292397aa640c2f002ffb5befe110f86d0aa246f3ffe99440718e5174af3c"},{"path":"product/runtime/auths-gateway/Cargo.toml","sha256":"959b1a58a110315f86115966f85d6992afd91be28d741fee7354207d4bd6f258"},{"path":"product/runtime/auths-gateway/src/admin.rs","sha256":"5d0f1b583a4cacdcbc62521ed1a5730ed6b57d42bf826708a0c5e591272c4a12"},{"path":"product/runtime/auths-gateway/src/admin_boundary_tests.rs","sha256":"7ef23fdaf512cfa6315aed72577ccf0c4d04725f5b4fa4b5f0482e27e5e7ba1c"},{"path":"product/runtime/auths-gateway/src/admin_fault.rs","sha256":"4a66386d91daffeeac4080c16a0d4e724adc09220ba056c0c4267e5f4fc05268"},{"path":"product/runtime/auths-gateway/src/app.rs","sha256":"acd1deab7a8524c97d4a76ec9f7079b3afc035d707e0480a0cbdf4d084972099"},{"path":"product/runtime/auths-gateway/src/app/content.rs","sha256":"4c01001659b1a563dfd4abe7e002e3f85609ffef511a0e39f967af944ea01300"},{"path":"product/runtime/auths-gateway/src/app/content_tests.rs","sha256":"6a239a15732dd279abb35a72721eb2034bf5aac79439edc7c34aa8d4fdfd5212"},{"path":"product/runtime/auths-gateway/src/app/participant.rs","sha256":"1d76d37ba8f7a4657ff013ad845bd90ab82636ade7e7a798937db05ee52a9424"},{"path":"product/runtime/auths-gateway/src/audit.rs","sha256":"aebb55cfe1305c6de26fda03989e138a6731ec57d1cfebf4114886bfb6b93d26"},{"path":"product/runtime/auths-gateway/src/audit_export.rs","sha256":"6cc3d70ef4cc64026de4ec4e094979a95fee6fadb86707b0e09515ad754632be"},{"path":"product/runtime/auths-gateway/src/audit_tests.rs","sha256":"8cf1ab4cd2789973791805b07216d423690645aa4f28307f87dbcb803bd2ad22"},{"path":"product/runtime/auths-gateway/src/bin/auths-gateway-harness.rs","sha256":"12b0c24d36b2e6a3be392d3c081a783b355fdd67dc5b54bacc0410e803116b8c"},{"path":"product/runtime/auths-gateway/src/bin/auths-gateway.rs","sha256":"6ae544618bfb0c0b938fb632e054c36e988c6eb278d62775405937c6a5d6ffa6"},{"path":"product/runtime/auths-gateway/src/binding.rs","sha256":"663b0ce878319511aa7d05722ab4ab2fa9be18817884ffb2ee9f131ff1e382d1"},{"path":"product/runtime/auths-gateway/src/bounds.rs","sha256":"d0658585765d4d8f9865f65d23d850ec196eeca23fe65a66a55f1f1bc9b2c9b9"},{"path":"product/runtime/auths-gateway/src/bounds_aggregate_tests.rs","sha256":"ab34f227b7c8692ba1da88ccb32bb3687a66adf8353d8282fae905d4a88eb612"},{"path":"product/runtime/auths-gateway/src/bounds_tests.rs","sha256":"80b116ccf65bda2d7f2fbcd3b26fcf82b0a4bd3dce3a5df7842828cb271d7741"},{"path":"product/runtime/auths-gateway/src/candidate_runtime.rs","sha256":"ebe3d2da3a340c990b6fdcaac8c4418a7c646c0148c8222c19d925b21dbc7da8"},{"path":"product/runtime/auths-gateway/src/commissioning_budget.rs","sha256":"f5c38e9e07df3cb99b6bd664f33eae414b9f3dfef4932d69c19a9b174906dc1b"},{"path":"product/runtime/auths-gateway/src/commissioning_budget/tests.rs","sha256":"da104a1643c37515deec6397bca6db2054f2c9158ec3d230a1b1ec9c7d0f659f"},{"path":"product/runtime/auths-gateway/src/commissioning_floor.rs","sha256":"7fa6991c5ccd5ae1403be84b3da390323fab09f36e15ac01fd7a38ea350c6fdb"},{"path":"product/runtime/auths-gateway/src/commissioning_floor/tests.rs","sha256":"6b663d6e556adc0b455b81845bc4394d82c6c4de0c5f43e1310f3ddc6e4e40f7"},{"path":"product/runtime/auths-gateway/src/commissioning_session.rs","sha256":"919fe57fafa563f770402be66b4e32f1f0d652f09fe1276a62e41b50d66f8696"},{"path":"product/runtime/auths-gateway/src/commissioning_session/tests.rs","sha256":"48d44a5fccea737930f24c49a397428edc439525330c83a868b5113a48f122ab"},{"path":"product/runtime/auths-gateway/src/configuration.rs","sha256":"e5597c39b1acbe50cad20c02722feb38d382294026a0a7a4097e6d97b68eaafb"},{"path":"product/runtime/auths-gateway/src/configuration/engagement.rs","sha256":"67bdd2c792b9dfb1168020a10799af043143461f020b74b18d20fd4089f9b40c"},{"path":"product/runtime/auths-gateway/src/configuration/engagement/audit.rs","sha256":"ee35149f8f348ff2a20ef7185ae0bc5a7b912ad5746510c0714b235765b8b1a4"},{"path":"product/runtime/auths-gateway/src/configuration/engagement/blob.rs","sha256":"12af8071e9cd21c04cf9b55d3cb5e8eb2f33ff888e03e06e114222feb4abf752"},{"path":"product/runtime/auths-gateway/src/connection.rs","sha256":"54f5d53c78f836bf8ce1236d449b3f4f1daa95312102d5583ef69cb4e57b513b"},{"path":"product/runtime/auths-gateway/src/control_namespace.rs","sha256":"0333baed635d34edb066d2b9cb4c6ea3f40faad4be8c75f54c989570515dddee"},{"path":"product/runtime/auths-gateway/src/credential_journal.rs","sha256":"8241dbc7a90054457c7c99fec3b35a433f671682b877f01f8429b8618a6d8e20"},{"path":"product/runtime/auths-gateway/src/disclosure_transport.rs","sha256":"614c975a4b9810f40092a2f9cdd022308b75e649167dbc486c9907f7570d8d45"},{"path":"product/runtime/auths-gateway/src/echo_verify.rs","sha256":"6d453051665f823abd7354d5c50031d9524cf47d6092d2f09080ae814e3b9575"},{"path":"product/runtime/auths-gateway/src/effect.rs","sha256":"5e1d5b8c28df616917d442b023e5161a2e3527ef7b8fb63d736728542c6caa2a"},{"path":"product/runtime/auths-gateway/src/effect/acquisition.rs","sha256":"0afd6aec490e7995a440786be6ac69cb5461201a4b4ec303e8b5a6c12ed97202"},{"path":"product/runtime/auths-gateway/src/effect/authority.rs","sha256":"2490494c3a1636decbfd04b2dbac71c47e49be26b61cc6cf41319a13450bb4a0"},{"path":"product/runtime/auths-gateway/src/effect/candidate.rs","sha256":"d1efc3ec7e1fa642af26f4e4c6a25924c60821dc2e96bd0b458d9292d3866678"},{"path":"product/runtime/auths-gateway/src/effect/candidate/proposal.rs","sha256":"d78574109f41300edfcd7ad38155439ffc3adb9a799554d75d5484738ef174f1"},{"path":"product/runtime/auths-gateway/src/effect/capacity.rs","sha256":"300fa32e09dab7c679b8c0a69bb4e3c1e924ed2ce1416090a2aa477a7eec9f0f"},{"path":"product/runtime/auths-gateway/src/effect/content.rs","sha256":"9f3b53c8c2ad5cafa183ed1229ee03f2cd8a610009b07da560372bd0fbae1673"},{"path":"product/runtime/auths-gateway/src/effect/disclosure.rs","sha256":"0acb5ac805e91c952c8f0028db03ae607c3753cbd08a76035f2d1b4fa6fe6244"},{"path":"product/runtime/auths-gateway/src/effect/disclosure_auth.rs","sha256":"32fa6f040ae46f3323df6e153c6ae810eccf32d22b9945e5565e7189dc877eac"},{"path":"product/runtime/auths-gateway/src/effect/engagement.rs","sha256":"5a36ff3f4460bf026a7e99fadc713672fbeb05dbc6f6393d10cb06440e779e54"},{"path":"product/runtime/auths-gateway/src/effect/lineage.rs","sha256":"0b3ddeb56377b69264bbd4738c624639a8dcad91b4df3328f907db439747faaf"},{"path":"product/runtime/auths-gateway/src/effect/prerequisite.rs","sha256":"e79596a4cbe47e307e3a3056c52582b1cd01a43c4c2d69479ee03df1f62af3b0"},{"path":"product/runtime/auths-gateway/src/effect/release.rs","sha256":"84e2572f76216e02131e9bbcc850f4b3572473eac6dd71baa144e63a2270cff7"},{"path":"product/runtime/auths-gateway/src/effect_binding_boundary_tests.rs","sha256":"83d8e0edf524a2be0d2c494e4b9897cab0ddcf61184828d716bae10cbaf904b4"},{"path":"product/runtime/auths-gateway/src/effect_candidate_staging_tests.rs","sha256":"7db0f4fd86cf119a6b4b0702267c91debdf11a73fc93105ce7e98d0c6e4cd8d9"},{"path":"product/runtime/auths-gateway/src/effect_candidate_tests.rs","sha256":"e93c08c2eca2abdc58f7db9fbf19e775e4f709225b04789832e2b8f5a81c8948"},{"path":"product/runtime/auths-gateway/src/effect_content_tests.rs","sha256":"63eb623413167bf9ff34161b6bf4f54f68709af9fb1d1e7a419a07f63ce04409"},{"path":"product/runtime/auths-gateway/src/effect_created_resource_tests.rs","sha256":"98f7a9de7824dbf3e2361b3006ef823002b391d557969442edb371266f7673db"},{"path":"product/runtime/auths-gateway/src/effect_disclosure_delivery_tests.rs","sha256":"9586b84b045561edbcf8276cd9769b412240f04248e240cd29a5068d4cd03a00"},{"path":"product/runtime/auths-gateway/src/effect_disclosure_journal_tests.rs","sha256":"19f349a090f07288cfafe24aaffad49f28fe163e59870520aac6bb899f673a99"},{"path":"product/runtime/auths-gateway/src/effect_disclosure_tests.rs","sha256":"5389b03d7d0cd5b23abaa3c396450fa4018102c942b27af35aef81e65b9bb841"},{"path":"product/runtime/auths-gateway/src/effect_engagement_admission_tests.rs","sha256":"46a34a83cfecb180c6f0937e83b8b14009afb4ce315864dfb9b3137759cb9959"},{"path":"product/runtime/auths-gateway/src/effect_engagement_control_tests.rs","sha256":"71e2e965b71b52d2fb877e22e5d4951d1d4072adede4b60dc3996197ac554395"},{"path":"product/runtime/auths-gateway/src/effect_engagement_delivery_tests.rs","sha256":"14b241916d9c3fe8141a38e93c62f8b8a039f2780ad3cd63282e707feaa4d1b3"},{"path":"product/runtime/auths-gateway/src/effect_engagement_information_tests.rs","sha256":"27735a9e1237a063c2a525cdcd93e8102164d549dc72509767a977ab4abd8491"},{"path":"product/runtime/auths-gateway/src/effect_engagement_prerequisite_tests.rs","sha256":"0566288b7f77f5beda44c8374f31a5053e02b44ccbe92781618e9fd90b1a6800"},{"path":"product/runtime/auths-gateway/src/effect_engagement_tests.rs","sha256":"2b78b315c7539d4119ce5b20164d6e4855d9b403b76eaa5b72fa3b72959a7621"},{"path":"product/runtime/auths-gateway/src/effect_instance_recovery_tests.rs","sha256":"eee64773b6373e1bd7185c07c5c4ffeaacafb907f4d0aa17b89ba1556beec5e4"},{"path":"product/runtime/auths-gateway/src/effect_native_tests.rs","sha256":"fd9cd960dfb02f68eef479ed2a95d65b79882c20f8a737c9a74d6a4222af407b"},{"path":"product/runtime/auths-gateway/src/effect_prerequisite_tests.rs","sha256":"51efa528051919d0ca67643cac3d0e06afac534706b802adb18311e2bfa222ff"},{"path":"product/runtime/auths-gateway/src/effect_read_budget_tests.rs","sha256":"9bf8491f0da471e07b5d96dbfdbdf5fbe5a47fec11700dca55a6ac05a1ebb68b"},{"path":"product/runtime/auths-gateway/src/effect_recovery_prerequisite_tests.rs","sha256":"e6235b83ac159d9446d79e6e072dd4aa9d0447a68055be3b32de6450a2300699"},{"path":"product/runtime/auths-gateway/src/effect_review_approval_tests.rs","sha256":"6e5c5a72ec93255d7d8f219ae8cf4401431644ff03d624164645a1e9d2b2e87e"},{"path":"product/runtime/auths-gateway/src/engine.rs","sha256":"113390cb4ef92ef337b5f82b7c77c54a428ec492756f90100b74002487dc8c7f"},{"path":"product/runtime/auths-gateway/src/entry.rs","sha256":"6fd17c142c0001b9cda33c33b0e18f4d1d40866cde8a66b3f57d46f971c1ead9"},{"path":"product/runtime/auths-gateway/src/entry_tests.rs","sha256":"86dcfc4918394052d18fc5509dcc0e740a064a97b084d1c2c9f23eddedaa6db4"},{"path":"product/runtime/auths-gateway/src/execution_witness.rs","sha256":"e8b1a8e41d5e3fa309760067849d390ef065feeb46701a83391832645a2f000c"},{"path":"product/runtime/auths-gateway/src/fuzzing.rs","sha256":"2dcf0a15e407a9180c7fecb7eecfaf4674698aa997b1f5de9a3649a49baebd1b"},{"path":"product/runtime/auths-gateway/src/generation_floor.rs","sha256":"09ed98d9533c7a4355890943ee6ef26a9c20da775b4cb77fdb25a723f6a16e54"},{"path":"product/runtime/auths-gateway/src/harness.rs","sha256":"5e296231c98e6429f3d805150fab9ce2d6a5789d41dd83f562b677314374567b"},{"path":"product/runtime/auths-gateway/src/harness/authoring.rs","sha256":"de511d89bf6bb72e443558caf0c4835dad2908b5fe5c13a3a02483e85dd7d354"},{"path":"product/runtime/auths-gateway/src/lib.rs","sha256":"a39306228bb0ee5e7c50fb83149756a15fa761d52bb6807942f1ec77db2049d6"},{"path":"product/runtime/auths-gateway/src/listener.rs","sha256":"aa08239bcbc1fcb55e8a212fbdf6a84f12985b0d436dcb51dc58b06e59e435f2"},{"path":"product/runtime/auths-gateway/src/native_budget_tests.rs","sha256":"d6de965afc7f794e611545744fa515f833abf315157519ed8390c195a7dac8c0"},{"path":"product/runtime/auths-gateway/src/native_cost_store.rs","sha256":"d1acdd7e4076e3a32f312dce74a01e5dcbccdb1f8912758524b7841d61377eed"},{"path":"product/runtime/auths-gateway/src/native_cost_tests.rs","sha256":"45bcb4e9174d4c23495ac734a42b5f8b7735c14d4599cd191d50f6547aaf374c"},{"path":"product/runtime/auths-gateway/src/native_crash_tests.rs","sha256":"46998a973388884d902a6b07e12fa342fb08ea77363a43a41b0b0a7a5ccbcde9"},{"path":"product/runtime/auths-gateway/src/native_cross_recipe_tests.rs","sha256":"e2dbde7afba1b3da5df3a7a44821f413ab7861a5417ad16f8b912f390128d115"},{"path":"product/runtime/auths-gateway/src/native_dependency_tests.rs","sha256":"0e15d059140ad485b2548f4234b94424d62b5563a8dded42224329a76b101f37"},{"path":"product/runtime/auths-gateway/src/native_differential_tests.rs","sha256":"17fc0803fe5e7f78b416f8f68e7c9066baf1bab69bdf0b51c44fd19e3d719da8"},{"path":"product/runtime/auths-gateway/src/native_disclosure_budget_tests.rs","sha256":"bb2a6f76f06a6d42d69698f7d22d0b4aeb4dc857e442042d65582097567009fb"},{"path":"product/runtime/auths-gateway/src/native_disclosure_crash_testkit.rs","sha256":"4beb946a288e4fe082cc0917f4200b18b8154eff98eca1ea3d0c830ffdc3625d"},{"path":"product/runtime/auths-gateway/src/native_disclosure_crash_tests.rs","sha256":"425e423f04d92794656d4da915125e4d0a8be25ec85fb88244ee0c27ece8ec44"},{"path":"product/runtime/auths-gateway/src/native_disclosure_entry_tests.rs","sha256":"50f5dc35a9a8ef462b8833296cb313b2acec81d544b7e317c7f188741d0786db"},{"path":"product/runtime/auths-gateway/src/native_disclosure_file_fault_tests.rs","sha256":"72d67bb0d3fd77fb93c4f5d3ab0afa5a939742b5a47acf006a511d99d72cee9f"},{"path":"product/runtime/auths-gateway/src/native_disclosure_pg_batch_tests.rs","sha256":"a8b8a90210d9f7f0012e40701c09c524527f93f9e56933d89b58a38464cba702"},{"path":"product/runtime/auths-gateway/src/native_disclosure_pg_commit_tests.rs","sha256":"1e14503140805c12883e1c288b75029aa7fd9ebe8c5d490a4c503161c4a27a4b"},{"path":"product/runtime/auths-gateway/src/native_epoch_tests.rs","sha256":"e37d34e699baa2b84578bd4c378975dbdceb407de51861c2217afdcf7b48e3b9"},{"path":"product/runtime/auths-gateway/src/native_federation_tests.rs","sha256":"bf2c6313f70c4b7f51f9ad05351048be3625d9432f3c725e84b046936304f540"},{"path":"product/runtime/auths-gateway/src/native_file_fault_tests.rs","sha256":"e1077a0059aa69918fb7e0a3481edd19af45a7343ce876583fbdbc96c4291b21"},{"path":"product/runtime/auths-gateway/src/native_generated_history_tests.rs","sha256":"5a5e308c1e4bc32cac31badf91e9453bed62e3e90f1b6585fc522bb4038990f9"},{"path":"product/runtime/auths-gateway/src/native_guarded_mutation_crash_tests.rs","sha256":"5329f72e7f22399a17627b058c2035c243e1b6ba60c9dfcd1c834258244cc440"},{"path":"product/runtime/auths-gateway/src/native_information_journal_tests.rs","sha256":"067bc51f7011971e8c5d021430fbfe323e5cc3cd7cde41c546cc92fad1f2cbc2"},{"path":"product/runtime/auths-gateway/src/native_information_replay_tests.rs","sha256":"165a1dce11c2006e6adfb5eee4c4977737b830995e6e29f77544a999893b0a5f"},{"path":"product/runtime/auths-gateway/src/native_journal_tests.rs","sha256":"d803ff53f90ce2a8c29808b4f874cd81954a3a5c52e19b519ab22f0543808fe1"},{"path":"product/runtime/auths-gateway/src/native_mutation_budget_tests.rs","sha256":"41d7f560d6b04e750acb2f8add2544745743ea9fea760a8ffd5ec5aab307e94c"},{"path":"product/runtime/auths-gateway/src/native_mutation_crash_tests.rs","sha256":"3e1befd35e7264024666331b52ca2245540ffa8f9927ed62e3aa45c7c8cc8950"},{"path":"product/runtime/auths-gateway/src/native_mutation_entry_tests.rs","sha256":"219a1986cf7440d31734db9db3c25f7997486a2fc29fee0a1ac8c7f0ee9ce803"},{"path":"product/runtime/auths-gateway/src/native_mutation_file_fault_tests.rs","sha256":"252f6ca9455b291b0873d983c8fccc75254d947b89a3fe9a1de0155c8ee53930"},{"path":"product/runtime/auths-gateway/src/native_mutation_journal_tests.rs","sha256":"181bf0a196805e50944cff4fe2315459eba877e7d7b5b90bf3c99e3353a8cad7"},{"path":"product/runtime/auths-gateway/src/native_mutation_pg_batch_tests.rs","sha256":"137f0e2f0e8d950cea3b38a7a03113c61177e54083f11eecc34b994ce41728f1"},{"path":"product/runtime/auths-gateway/src/native_mutation_pg_commit_tests.rs","sha256":"5d9a3b8a1601c83c66db3aefd904c16233ce2700d070ba5c9c4f81f4051c5fad"},{"path":"product/runtime/auths-gateway/src/native_mutation_replay_tests.rs","sha256":"3a874e1416cbb29cce70930f9955a70b4a5ad46e2cbca8d55f1acf070215cfbd"},{"path":"product/runtime/auths-gateway/src/native_partial_upload_tests.rs","sha256":"5fa867219d61b7c8a563e7cf5111291f15b8a11464623859be8aa9ea858170ea"},{"path":"product/runtime/auths-gateway/src/native_postgres_commit_proxy.rs","sha256":"1c95b3f8af48b78dc4f1c1baa3b26c1aa7bbe868c23aefbb32f1f0ae592f0045"},{"path":"product/runtime/auths-gateway/src/native_postgres_commit_tests.rs","sha256":"f021b110991ba3ae497705d0aaa0350a210f09b6f102fd71ac2f8eb4ff8f30c0"},{"path":"product/runtime/auths-gateway/src/native_postgres_fault_tests.rs","sha256":"0c6edea869a20765b322fa69c48e580aa0664e726b6cef483d4eba49803135ba"},{"path":"product/runtime/auths-gateway/src/native_process_tests.rs","sha256":"778a02ea4de3a0655021bad7d2f4b5f0007c6518ef60e966db3da49bfaf22c37"},{"path":"product/runtime/auths-gateway/src/native_public_evidence_tests.rs","sha256":"dac3a70f4535a14aab49ceed5a6b5fd7002e199270bb5a120f5bc8edfa5398bf"},{"path":"product/runtime/auths-gateway/src/native_recovery_actor_tests.rs","sha256":"bfdcdbaa0ee1d6822c57e5ab9ca524e731c393f9289c5508b61a0fc1d0b065e5"},{"path":"product/runtime/auths-gateway/src/native_recovery_authoring.rs","sha256":"9f4e8008160b349a52267eacd6a1c1e5c31c3c1cdfd71b574162ccaa9f7430b6"},{"path":"product/runtime/auths-gateway/src/native_recovery_history_tests.rs","sha256":"0c6ec8fe18fd4cc8496f04c3bc38552c3602d7254cae979fac76aeb7c7e4f41b"},{"path":"product/runtime/auths-gateway/src/native_recovery_limits_tests.rs","sha256":"f147c2e78cbe364fb3fd0c97bbbacdad86d77ca8c0b8575d9fa108968f82379a"},{"path":"product/runtime/auths-gateway/src/native_result_wire_cases.rs","sha256":"2b93c8ed96d7092216410bb99435411fd57497284639f56e0120b16639a98eb2"},{"path":"product/runtime/auths-gateway/src/native_retention_tests.rs","sha256":"224c941e394dd711a7ee19e7b52a1d6b7359eec62e7decec323d066319cb59d3"},{"path":"product/runtime/auths-gateway/src/native_scope_tests.rs","sha256":"8d3f362df9fadc10c22f0483f3a16d238d0f82f393a628727adf0b728707673e"},{"path":"product/runtime/auths-gateway/src/native_threshold_testkit.rs","sha256":"74e6b6ed1b77b463effff132fd8af9b3b59aeee64704a8fe8a19ed3ca9d79bf7"},{"path":"product/runtime/auths-gateway/src/observed_tests.rs","sha256":"91223493fefd3efc3fec58db225f00786b539e3b24027419e919d8bd7310059c"},{"path":"product/runtime/auths-gateway/src/observer.rs","sha256":"1c8988dd8807566d5a152e1894aa0f4c80c3ba7302ac910a4a6978d4f31b323d"},{"path":"product/runtime/auths-gateway/src/onboarding.rs","sha256":"6180e79d7698bcd4dd6ffdf32dcfbe14427f96de92f4ae4ceac4dda651f3671b"},{"path":"product/runtime/auths-gateway/src/operator.rs","sha256":"fe3b11fcf8e2394ab955b09a5b9b1f979c46f9e07a4f16e1a3ca160d675f1ace"},{"path":"product/runtime/auths-gateway/src/participant_control.rs","sha256":"58acbac1ab812963ad0ba0e2864395a87b3afe50962263cb44e19776cf5100b8"},{"path":"product/runtime/auths-gateway/src/participant_enrollment.rs","sha256":"719e82ed5f30f7b37d6d87e45220918d945a2ed8fadc9e760308398e9f6501a4"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/audience.rs","sha256":"83940af76073d391f1181eccea2e9b682dbd7ffcace6c39b2123ebe09e721573"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/audit_tests.rs","sha256":"1a8cb537f16d023962f1375b7f15d0879b2be85c29775dd677c84d87b8c9d183"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/configuration_tests.rs","sha256":"2e1cb7024ff137bfd3292929f26ec078c9213f6276f4a2f915b279530c6c7782"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/cross_recipe_fixture.rs","sha256":"5a957eeac83da3f1c74e923648319674f6a90e6673b45fdc029b784b1c09053a"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/identity.rs","sha256":"a04328f93d59da6c34d623319b8a6f55a32e7d718837109b299ef6935b126930"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/recovery_tests.rs","sha256":"b13faae436b325fa6ea234613f1542f4ec8b1dfb7082d3f31339ea7f4a8b0cb8"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/root.rs","sha256":"586bfc83e1a615b7d255ea235f6e519945126bb3ba7fe41d2aecd1dbcdccc797"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/tests.rs","sha256":"a6f83af4c504d7a5bdedad90e473c8032f10c384adeab29075051389040f7696"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/tree.rs","sha256":"4f2b8965b91b6e23317168221d077b074fd149690e28c30fad6055982ada584e"},{"path":"product/runtime/auths-gateway/src/pending_vectors/attempts.rs","sha256":"79803db1c278b2133d4adb112ab325247f359cfa5cf34e3de32898f6a9bffe62"},{"path":"product/runtime/auths-gateway/src/pending_vectors/bounds.rs","sha256":"e612217307e1da5b0eb5ee6582a7458bb064b8aa8a529fc6555b1b334127ab68"},{"path":"product/runtime/auths-gateway/src/pending_vectors/codes.rs","sha256":"6fb3f1679b0fd2ca7a8ac6aaee65f586b9eb809d9d7c9e26d3dd8ae2bfd10307"},{"path":"product/runtime/auths-gateway/src/pending_vectors/keys.rs","sha256":"b0b1f79d2fadc06e91378a8250223a429163138e4b86e90e09bc207d80fabf86"},{"path":"product/runtime/auths-gateway/src/pending_vectors/mod.rs","sha256":"5de8340f0ef71a0b57a09e323fefe473d3160c6ae952b9ba46f714825fbacafc"},{"path":"product/runtime/auths-gateway/src/pending_vectors/outcomes.rs","sha256":"a8960d8e055ac31827e379513f57f00ed868b559079fa2a4687e1b055d48e3ca"},{"path":"product/runtime/auths-gateway/src/pending_vectors/production.rs","sha256":"15c687599b0342dc141878afdf727092b23ade67ee5564eaa671f3f06befad57"},{"path":"product/runtime/auths-gateway/src/pending_vectors/recipes.rs","sha256":"5d550e3708ea41a9547ae2207699bde5ff4435f5a1ed7afa4378fb8defb51bb4"},{"path":"product/runtime/auths-gateway/src/pre_entry.rs","sha256":"3f2554feda72fa047229d427504676a1fb14894bdd377055a3108d7b3e3587cd"},{"path":"product/runtime/auths-gateway/src/prerequisite_race_tests.rs","sha256":"683cc46b3718d12dbb42668dae4bc6ec7e7508dcbb6b6232fead2e3e4f510d0d"},{"path":"product/runtime/auths-gateway/src/property_tests.rs","sha256":"85a77aaf01d9be51e1dd7c72461653a099c51b0ca9c818800d991abe262b198a"},{"path":"product/runtime/auths-gateway/src/qualification.rs","sha256":"f25bbb01c2a6131633c5a4de4e59345b761609e47b3c69353187364996ec87ea"},{"path":"product/runtime/auths-gateway/src/qualification_simulation.rs","sha256":"61f4117e33db07be83ce0f0376f79a405ff6d8bb7ffc2e28ff0bf927486941ce"},{"path":"product/runtime/auths-gateway/src/qualification_tests.rs","sha256":"ed9eb74599074af67730d63f8c5093f6a5277bced96dffeb81317a6dd9f4c8c6"},{"path":"product/runtime/auths-gateway/src/quorum_tests.rs","sha256":"a6533de9bc2689ec632f009404daf363494e224e7b89b1c65bb2e2cd4fc6421d"},{"path":"product/runtime/auths-gateway/src/readiness.rs","sha256":"911c3f11892f94641574375e2da4c671c802738f71082f12c39832331052d43d"},{"path":"product/runtime/auths-gateway/src/recipe.rs","sha256":"efb99a8f060b5633ea8ea75f24378e701f6ba2af023faf8c7609e4de4e868637"},{"path":"product/runtime/auths-gateway/src/recipe/content.rs","sha256":"e3f8aa8cf2dd9ef5777d9d1e76331052c67be87873db0c2cd6a8f48ff940d9d6"},{"path":"product/runtime/auths-gateway/src/recipe/created_resource.rs","sha256":"2284b6f7363b1a15dd3c91dd3043f46a5c7a9c12d997213b13751b82ae627e26"},{"path":"product/runtime/auths-gateway/src/recipe/created_resource_tests.rs","sha256":"ab371d7d7a5dae249da924e7b94d5c863491a2af796d2febdf2dda2a191c559f"},{"path":"product/runtime/auths-gateway/src/recipe/effect_review.rs","sha256":"8f94896f0d124162d3dbd080c44582bb23ad181bb582ff5cd3d049d75fcb6d77"},{"path":"product/runtime/auths-gateway/src/recipe/lower.rs","sha256":"81118ea7ae6c2d9984b88fe9991f91283070859d56923ee4fdfe9a50eee9ccb1"},{"path":"product/runtime/auths-gateway/src/recipe/response.rs","sha256":"0b4a074eb05b98685697094ed4775c5fe588b3e34f954aa1844135fe14c94487"},{"path":"product/runtime/auths-gateway/src/recipe/review.rs","sha256":"f9f88f6d54c9a517b55ea717ce8caf5199954ff710c0d20e2bb609f6b1344a51"},{"path":"product/runtime/auths-gateway/src/recipe/runtime.rs","sha256":"6301c005c5f014eb81a7a85dfa3bd256ec15e35bf1cdf6e60815a2a18b7151a0"},{"path":"product/runtime/auths-gateway/src/recipe/source.rs","sha256":"f79e481ab0f40985819b317c540c715766611b5c8c0e5647c87849fefc10cbac"},{"path":"product/runtime/auths-gateway/src/recipe/tests.rs","sha256":"78cfa166bb02b722c92205d2a95c261ef4f3cc272150145980252cb4c51c13d1"},{"path":"product/runtime/auths-gateway/src/recipe/validate.rs","sha256":"3f613af38c5cf29901575af4f82a9daca6718b2da70bc84baa0994a71be6113b"},{"path":"product/runtime/auths-gateway/src/resource_identity.rs","sha256":"edf093bf84c0ca6c0a300adc6060fe10cf58b90e592dc3cd6ebd58e73632373d"},{"path":"product/runtime/auths-gateway/src/scenario_tests.rs","sha256":"eba5fe0268e5d8516eea79a2cf418f5c52ccdf777fa94e553cfba00f0b90865e"},{"path":"product/runtime/auths-gateway/src/separation.rs","sha256":"be9306848ca5d801767cf6aa14247c8618312ef0e202f00ce0c24c4844491061"},{"path":"product/runtime/auths-gateway/src/simulation_attestation.rs","sha256":"88705e5d45415f760f1e3c3a065c35c48f4f4065bf7b3feb7882246983814d6f"},{"path":"product/runtime/auths-gateway/src/store.rs","sha256":"5645f57bcd92190ff2c83836744ecc514558c466bb5d377b258a8d82d21504f9"},{"path":"product/runtime/auths-gateway/src/store/acquisition.rs","sha256":"c52193c7ca87f4eedc3a3523be12eb85a2825fa989d8a61b076be734eb99684e"},{"path":"product/runtime/auths-gateway/src/store/acquisition/candidate.rs","sha256":"90c133dfc48ed351d0f1fea9de236135e82297719c383f9f37404a335909d225"},{"path":"product/runtime/auths-gateway/src/store/acquisition/content.rs","sha256":"92f87e4556335af8e1c4157e60e6936ca02b271381569e14510bc2c35e697ece"},{"path":"product/runtime/auths-gateway/src/store/acquisition/recovery.rs","sha256":"cc1be15bb948608868d33a088951530834235220a8fed7d77161ff53bf416dc1"},{"path":"product/runtime/auths-gateway/src/store/capacity.rs","sha256":"d25c4a0d753317270cb352246c70642bf0659e6448d14061356e4e9ea7ed3811"},{"path":"product/runtime/auths-gateway/src/store/disclosure.rs","sha256":"3b2f68d024bb10b734bd1e48ceb4eed23d1348ec6f716be78ec27384458ff007"},{"path":"product/runtime/auths-gateway/src/store/engagement.rs","sha256":"953ef4c20f16775c10bca98b820536f347a6ce9c756934503efdb7bb77c41ff5"},{"path":"product/runtime/auths-gateway/src/store/mutation_phase_tests.rs","sha256":"163c177cf5e053126b46c7de7e429a99df789090b1127b5d3b91636efcac4365"},{"path":"product/runtime/auths-gateway/src/store_retention_tests.rs","sha256":"a9e300fde3c45999764ee05c4c6ea46cfb9ffcaa51b82337a322925ad50f4f50"},{"path":"product/runtime/auths-gateway/src/store_testkit.rs","sha256":"720bdda4464a54198348e1cac8ff75ad4882b9ce10c389befb4e9bc80340156c"},{"path":"product/runtime/auths-gateway/src/submit.rs","sha256":"a8e5e908b99d997cdf34c46c5827e04c0f502307f71497d15511bb40ef52815b"},{"path":"product/runtime/auths-gateway/src/support.rs","sha256":"d4865f95a7a2fdfe297f3f73687c05ab64a6b911814daf5f2b6c703ce58262ce"},{"path":"product/runtime/auths-gateway/src/transport.rs","sha256":"0ad16c63c19cc41d11c485625c8fc0617aede21401d16ec814401f963538bb46"},{"path":"product/runtime/auths-kernel-runtime/Cargo.toml","sha256":"926bcd0053e5edd703be8f0027ad009e2982db013c8174c1366edbf38b48087d"},{"path":"product/runtime/auths-kernel-runtime/src/lib.rs","sha256":"7108faae9ca4bc32dc093ddaf885ac8f74f3c9b8d317b7c7d0ed00d1d0ab5972"},{"path":"product/runtime/auths-lifecycle/Cargo.toml","sha256":"c5053c705f8d5554b44e432fe75287a2faf11d644e5a2552e45ad6cd94176af5"},{"path":"product/runtime/auths-lifecycle/src/codec.rs","sha256":"51c4b746749150e8bfcd8ff972b3f6c1ef40bec15583448ec1b471d9ad737dc0"},{"path":"product/runtime/auths-lifecycle/src/digest.rs","sha256":"55282cd7d8aba37713c2dcb5357c9877819edb72a30eadefb860d28d7d3a3eb7"},{"path":"product/runtime/auths-lifecycle/src/identifier.rs","sha256":"31620e8c16de68d3d2d3b84d6353c1a5b9d4151d8247f91fa389b906a8e660f1"},{"path":"product/runtime/auths-lifecycle/src/kernel.rs","sha256":"2abb8c094b36d35b364e74d78091d14c5d6f3d1eb6552cca3b5538dbd017ce23"},{"path":"product/runtime/auths-lifecycle/src/lib.rs","sha256":"afe5a345cd309b5a4f08ffba3170a6d7f16ff914892b3f2006d5208ed24ec736"},{"path":"product/runtime/auths-lifecycle/src/model.rs","sha256":"1af12bbeeeaa65ec02ddcebd7d2c8c92ec1e339fa40ae85b45ab9b01a722a4fa"},{"path":"product/runtime/auths-lifecycle/src/operation.rs","sha256":"78e6d05fcf5d7ea4f148032a3fa26fdfcab77eb346019effe927b08e0d64d732"},{"path":"product/runtime/auths-lifecycle/src/registry.rs","sha256":"53495fe6f7a77422593a41623e28716f1c140dcc1e00f87f6b0ffbfb93a5ef90"},{"path":"product/runtime/auths-lifecycle/src/sealed.rs","sha256":"2e0c03b5813c926c159598bb7890d1523825edbe57cd687d42a5dfb3374a0c19"},{"path":"product/runtime/auths-lifecycle/src/test_support.rs","sha256":"221d9a5c5ef8e1f9f8fd66927484eaf813571d0568470278ecd8fa08a5eec8cd"},{"path":"product/runtime/auths-lifecycle/src/transition.rs","sha256":"011805a28efdd541f44ccea54dd0e34a1e58f4004447ee58013703b4fb6b2822"},{"path":"product/runtime/auths-runtime/Cargo.toml","sha256":"dd29d80a8b4bb56c869f036a6c9998f6e6d1c0383ac5dc03fa42b24abe2a7ff7"},{"path":"product/runtime/auths-runtime/src/lib.rs","sha256":"132ca03d58c14905d3a822a4972f42a22a5ad33a45f2ba9ca44f3a57d810b4b0"},{"path":"product/runtime/auths-runtime/src/production.rs","sha256":"fd4eff4270c571c10fcff6cf27df28961ebf074de8a1a028f500fda1ca376820"},{"path":"product/sdk/auths-approval-quorum/Cargo.toml","sha256":"df904971fca87a24194c5816738a331588fe8f164acb5d70839a35dca5f57114"},{"path":"product/sdk/auths-approval-quorum/src/lib.rs","sha256":"72e4086088a1c0912e4e1a9e980f26a5c280bf5ab16ea39c9f0f58d5096ac2ce"},{"path":"product/sdk/auths-approval-quorum/src/remote.rs","sha256":"9fa029c7c63003adf260f8aec55160c545681c60c1bace0d934e7525862aac7b"},{"path":"product/sdk/auths-approval-quorum/src/remote_tests.rs","sha256":"8a09ce17cfee82a035a74edd535f3ebeb3db0e078784740d3997b17dbdb10197"},{"path":"product/sdk/auths-approval-quorum/src/tests.rs","sha256":"0acbf12be3e497dcc6c2d8f29c9af3b1a7ed8e11b75f6399570d4f217a785060"},{"path":"product/stores/auths-stores/Cargo.toml","sha256":"a32c4b76d17b264be5d40d24497ff237e1ed87822e8bab86229b3db93106dbe3"},{"path":"product/stores/auths-stores/src/gateway_attempt.rs","sha256":"f39dc84a238db0ebc70ad1ac495da194d2c24b5e1f9905552a9b1143278725a9"},{"path":"product/stores/auths-stores/src/lib.rs","sha256":"40c280a5ff79bfc1cafcf0bb415e775e205637c526973eb94b43a30f86d4e6fe"},{"path":"product/stores/auths-stores/src/lifecycle.rs","sha256":"4033f69a8d36de9285b87ab86af363fc85f785918ec2042d0ef1bdcb64d6f73a"}],"schema":"auths.gateway-semantic-closure/1"} \ No newline at end of file +{"files":[{"path":"Cargo.lock","sha256":"c5670142fd364c741ef2d87fad1477861afe5a45ae5fd6c537f889ea90dc6477"},{"path":"Cargo.toml","sha256":"f372f4257f5687249c22073205f1f5cd84f4854155d1293aa75670b4dcd71cd2"},{"path":"core/adapters/auths-did-keri/Cargo.toml","sha256":"86ba3e3f9a0a70d970568bfb3113b7ba7bbdd81c3eebbb52743dd574a0c0ecaa"},{"path":"core/adapters/auths-did-keri/src/lib.rs","sha256":"a75674842f8a7142004369ccd206ab43e476459293f0ff4bed4d4e659031b3e3"},{"path":"core/adapters/auths-did-key/Cargo.toml","sha256":"d5a3ae07ecde83f91eed4c3785051dd0f44eab6c891754f3309b6b40596707d7"},{"path":"core/adapters/auths-did-key/src/lib.rs","sha256":"b76a3f4528a725df53cfa9242e6e414e1d26caa48468aaed497e28b121f4497c"},{"path":"core/adapters/auths-raw-key/Cargo.toml","sha256":"f49616bc18c19e6aaa7e6a02ccebcdb9f5c1422c1278ef9869e0dbf22ceda7be"},{"path":"core/adapters/auths-raw-key/src/lib.rs","sha256":"45eec1b295dac3bed65cd79c942870b926b06b3f5d38eaebaeb6140ac69315fa"},{"path":"core/crates/auths-algebra-kernel/Cargo.toml","sha256":"0cb078915287b8c47d20fb97b6fa14135ed1c61c4985c4de2753855563c27bba"},{"path":"core/crates/auths-algebra-kernel/src/generated.rs","sha256":"ae4bcbef42a408c7ffa0c6a74a42f7de177a6f14479e51d205acf830bda05960"},{"path":"core/crates/auths-algebra-kernel/src/lib.rs","sha256":"6654667eeb9b353d6648954c9fd2e8838462a82ce6b2803eb49e1366892c68c6"},{"path":"core/crates/auths-assurance/Cargo.toml","sha256":"afcb12a97ddd09d7a264b9ecd3fcaefc865ff2c9b4539ee85b00883420ba333a"},{"path":"core/crates/auths-assurance/src/lib.rs","sha256":"0fb2ec844d674b25a9e20b1601452c89c2454901fa506adfa9bb38ef9a7fa213"},{"path":"core/crates/auths-author/Cargo.toml","sha256":"1e6f0e3bc079ddb558decf0db26b291c6e72fc47327b6df1b7650d41689b215f"},{"path":"core/crates/auths-author/src/lib.rs","sha256":"e14475f2f49715a1869d5fa6b11ff1fbb72497e39097e09f833b0bae7e5b3f2b"},{"path":"core/crates/auths-author/src/observations.rs","sha256":"dda7d6bfa6f4bd7e95a480ca283c2c0e996f69c5c15cb0c7197af328131a7066"},{"path":"core/crates/auths-authority/Cargo.toml","sha256":"4f68212938029f79ebd857b4f3038494eb85d0163d49f07e51376715cf959815"},{"path":"core/crates/auths-authority/src/lib.rs","sha256":"da88d5194de4e17449e69972c0fb042afa3c39798a8f570f30771e77c384f1eb"},{"path":"core/crates/auths-codec/Cargo.toml","sha256":"e20e51826e17814effd9d8925d18d5fbdd6c0d37bf50231e743ec2611314722c"},{"path":"core/crates/auths-codec/src/approval.rs","sha256":"fbff43bf4d57f69f8b7738a8647751cde75c5a932dee65d924a1fe9c7202f91f"},{"path":"core/crates/auths-codec/src/bounded_policy.rs","sha256":"d21f6728be2d8a04b6d94921f2b683f7e61cbb42e0ac6866f1c88a49caa534c3"},{"path":"core/crates/auths-codec/src/decode.rs","sha256":"ba2999584cdf53b1b517ecb9c7ea50d39efee17c666a9a38e2ad1ac94379f778"},{"path":"core/crates/auths-codec/src/encode.rs","sha256":"8491192053e2e15d62b4d2a491de22405b7487ead69ab6f6bca40669ce7ca5f7"},{"path":"core/crates/auths-codec/src/error.rs","sha256":"fecb0737c16deb42d859f1dc7727c698438d9ac12064fd99e0024629642c390c"},{"path":"core/crates/auths-codec/src/hash.rs","sha256":"f88e111f1dbb2cef6b7b5e9c948cb45ff92e366710c8a5f5c636138aa748479e"},{"path":"core/crates/auths-codec/src/lib.rs","sha256":"3b0e5c94c6f34f750b88a9333e1d5c8145746d845d3a23e0d2f61807cf592ea7"},{"path":"core/crates/auths-codec/src/observation.rs","sha256":"38328b0c71ff97a4196eeade8b4faa889527ff1f80bb168468bcd49082a3987e"},{"path":"core/crates/auths-composition/Cargo.toml","sha256":"331e13025eb82588b5269ed3975929eb41c823d588c49e4c296273d85c6fe80e"},{"path":"core/crates/auths-composition/src/lib.rs","sha256":"e42e3b0b6a9985b73c533aeb23799c638979aa27a9ce7d0f10a8d60340570fb1"},{"path":"core/crates/auths-model/Cargo.toml","sha256":"565c15302b0cc9270db1e28efa3862804846850ba933cc17aea8abcec4a65987"},{"path":"core/crates/auths-model/src/approval.rs","sha256":"54cf44a9ef747ec21546a4086aecfb130bc7803b0d646430e6082df51e6e305f"},{"path":"core/crates/auths-model/src/bounded.rs","sha256":"f90496abc0a06c028b4d850af6ddab7d850bfafeaa3d042f1b1246a41d8bbbc9"},{"path":"core/crates/auths-model/src/bounded_policy.rs","sha256":"306a8f049cc7cfc7635fe0e4de47eb7813eed63d3c14c3be2b51586aa4eea450"},{"path":"core/crates/auths-model/src/lib.rs","sha256":"e7cfe6bb9574c6b016aa63e70658c31e0b90903ec6479a49f4a2ceb64f5bad97"},{"path":"core/crates/auths-model/src/observation.rs","sha256":"b3ed3e3cc090afca2896a7d3de7988afccc1ee1ea0ebd91b51a8bc0f20ad8dbb"},{"path":"core/crates/auths-multikey/Cargo.toml","sha256":"858756c1197befcada06134742bffe8d58cf674cadd6c046bf710570e96efaf2"},{"path":"core/crates/auths-multikey/src/lib.rs","sha256":"f5177fffb11e40eeaaa665ba886c541fc1f24d5eacdd6983fb03dc20148733f0"},{"path":"core/crates/auths-ports/Cargo.toml","sha256":"596a9b0f5af3717c16a6d13f7054d8a106bcd9f01f5f72c2235dd2afcf0ab16c"},{"path":"core/crates/auths-ports/src/binding.rs","sha256":"a16c012d40aa4249e3ec54372b9611006d0bfe8c7dc3c741911c2194ad17736d"},{"path":"core/crates/auths-ports/src/diagnostics.rs","sha256":"aa596572503b5a65a918bb2ff38281c144ff53821ee914e9325c852828d852df"},{"path":"core/crates/auths-ports/src/lib.rs","sha256":"8da1debf86f9532df0660155d04298beb1ba3a1204508f8586e2e67cd2fb3449"},{"path":"core/crates/auths-ports/src/path.rs","sha256":"b68fc547b4e4d97a60cbbc1cc1939fc6b34a8233b81f840bd396914a707e3ea1"},{"path":"core/crates/auths-raw-key-core/Cargo.toml","sha256":"98c0bc8527a537512e43a74dd6ba9658c6f0cdc16610cf938e3f9b43785d836d"},{"path":"core/crates/auths-raw-key-core/src/lib.rs","sha256":"98c0500c41697aae28708ad0bf970b9a97583d96a3d2c18d23e7fa351e0f7d12"},{"path":"core/crates/auths-registries/Cargo.toml","sha256":"590e49e58b0622d9d6274fea46796dcdb07dec9550eff295cce6a6427ffa51e2"},{"path":"core/crates/auths-registries/src/lib.rs","sha256":"450d3886d85ee333b7e046317fb5b47cde62483d5f3e41d46265e2caf4c373ec"},{"path":"core/crates/auths-registries/src/template.rs","sha256":"1224039dd2b3ce6fa8357613d8cafbae40400493da7176da202b9ade62fa05e4"},{"path":"core/crates/auths-signature-core/Cargo.toml","sha256":"6bee2230eb30af1be0bd5c2d57bd3e1903497a70028d47290d4ac6e9e0e8bca0"},{"path":"core/crates/auths-signature-core/src/lib.rs","sha256":"db97ecb45a82faa6f96a92738d3af1da92d1ba2f241f2c29114f4b8107dc4ab0"},{"path":"core/crates/auths-signature/Cargo.toml","sha256":"7f7b5682466ba439d8c59579022cb61068cad9fb4bd2d73e1cc21327c902b450"},{"path":"core/crates/auths-signature/src/lib.rs","sha256":"b3d9ac4cc3ba0797b9e1c09f2d6ac05089b25dac4e285a5af28c0165b33d925b"},{"path":"core/crates/auths-verifier/Cargo.toml","sha256":"c43358e06a33324b41a8b93e5cc7279c55f7d21f1f6cfaa539a3fc7b4c27a38f"},{"path":"core/crates/auths-verifier/src/approval.rs","sha256":"c3cae6a49e169051eb555bb092b1069a4d422516d6a2114623a89e5f31ff923f"},{"path":"core/crates/auths-verifier/src/causal.rs","sha256":"9635230f33b13a263573d319ac8a1976addbcc07677514a43e3c7bf28dc04587"},{"path":"core/crates/auths-verifier/src/lib.rs","sha256":"f22dec38dfa47ced8da4f605390da8453273bee1da010f57fd1fdfcb10e0b389"},{"path":"core/crates/auths-verifier/src/observation.rs","sha256":"0bb07f06a0f9524c88427df1c972b1de8ba038a9eeeb15d3134c25125ae84b1e"},{"path":"core/crates/auths-verifier/src/trace.rs","sha256":"2213d72023a1d9e0413a2cf2c51c3dad9e04775d86033a0caaa9d29a8f0036f8"},{"path":"exchange/crates/auths-proof-exchange-model/Cargo.toml","sha256":"34b2db64f93a288e942b5a3918d28cdcbef906e0dc9074ce848018d3d5f7a1fa"},{"path":"exchange/crates/auths-proof-exchange-model/src/lib.rs","sha256":"49fac5aff2339d3a57c41cb8bb2a82852538e8f77ecc4b157c88e264ff31fb55"},{"path":"exchange/crates/auths-proof-exchange-port/Cargo.toml","sha256":"7ff660f1b7579dc570c791090aeb450404fbbf44c92781e289f5ccdde746d739"},{"path":"exchange/crates/auths-proof-exchange-port/src/lib.rs","sha256":"bd8f844641cbd065524a9f6db6fb88f38e86073072df448f2f89f13512fd80cc"},{"path":"product/config/auths-config/Cargo.toml","sha256":"e4b568ab9f6d84f7d7e6d66443fe825f360db9c27bc7c31d6ddc0647ba3ab304"},{"path":"product/config/auths-config/src/lib.rs","sha256":"fecf00ea65cef9018fda9af2063326d7065b869266d0d9e73a4f06816f1102cc"},{"path":"product/errors/auths-errors/Cargo.toml","sha256":"3b3a199b6460ba75bda84475bb5accd35e1485448a3981038db85bf4772dd350"},{"path":"product/errors/auths-errors/src/lib.rs","sha256":"7feeb9069fa4003f94f1f07c1c94619cf1c883e0dbaaf2187f04d0f742264bdd"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/Cargo.toml","sha256":"716f1f2a117d6d69d8effe9ee9057e24ba3502f20af6a602b06facb638cdabed"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/api.rs","sha256":"9ea61dd7ddd93282b073b98e453e6b75b26dc49689c04e9782435d06a3a09e48"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/clock.rs","sha256":"73f0a6e0f5903883329fa6683f5888288f759512ac69e5c87efd2b6b87f7d79f"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/http.rs","sha256":"14c1fce14e24c984b2a275563a29b6326fb08367922b6e8d37ba38b9cb81aa2b"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/identity.rs","sha256":"186de11230c8b33375951c4368609f8976bf9795f171af3fd7fac26207a94361"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/lib.rs","sha256":"0b4617d044f5254a5ab22f5a2578f91cc025206a8c1845be39c1c56dcdf7a5df"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/names.rs","sha256":"41bb23572d6002e23ee103d6fe70ecd68764861c6f2e48a1c53af998270a4afa"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/sigv4.rs","sha256":"39fed883f4802e68d3b41a68fea0aba0737810996b33d13577de70faba004c29"},{"path":"product/integrations/auths-credentials-aws-secrets-manager/src/store.rs","sha256":"fc60ee9c49b2f4f063c449b4c78100c5c4872779e94ca168f796603b380ef6e4"},{"path":"product/integrations/auths-custody/Cargo.toml","sha256":"1e14034185ad1ec24a977fd5f41d0abee219606245c046ce2a82287fadef448b"},{"path":"product/integrations/auths-custody/src/conformance.rs","sha256":"13a2b28bba4a7af5b00bb96d16ecf027d35d5487b314e48a666fb8ed09c2f2e9"},{"path":"product/integrations/auths-custody/src/key.rs","sha256":"c3b1468b8538421a796aeb65a0cd94b942e3788e78741f20dde07b4838e0c3da"},{"path":"product/integrations/auths-custody/src/lib.rs","sha256":"836ad8044440fd250457a46f5c4a980339534a8af6a4daac2643560050b62d39"},{"path":"product/operations/auths-operations/Cargo.toml","sha256":"73dde1e914ba5e1386f8d49c0d730423cc72ae77ec44c6554a6a75cc8e8922b1"},{"path":"product/operations/auths-operations/src/explanation.rs","sha256":"b4a39bcbd5712cb9e735ee7deeb281f3fa6af5ddca973735bf3d87dce427ef11"},{"path":"product/operations/auths-operations/src/lib.rs","sha256":"3f401a56555113b98f57bca172a2660eaecedf76247b83a3fdbb089c133a29cd"},{"path":"product/operations/auths-operations/src/render/json.rs","sha256":"2ae042639960afee123730e945d373bc5dda1d2b3af20ae16c939a7e99b9e418"},{"path":"product/operations/auths-operations/src/render/mod.rs","sha256":"b3b7f6fe473f49227ace5a68bfc3d8dc14b5db8dd9888fd9e207070337b1b8bf"},{"path":"product/operations/auths-operations/src/render/text.rs","sha256":"f216cf3bdb00e264523271b16e7059535ac6b1aabf271cebd7935af155e4bfec"},{"path":"product/policy/auths-bounded-policy/Cargo.toml","sha256":"babd5d200923137ead71d8c2528f847cea323ce98da942a1320b054436612c47"},{"path":"product/policy/auths-bounded-policy/src/arithmetic.rs","sha256":"75e43c5d4eab8d1f71c1daf53839f5f9fe45a400afc1f63a30c6f55ce3632627"},{"path":"product/policy/auths-bounded-policy/src/commitment.rs","sha256":"c5706f2d583454e1a7f570f7ada138d4d864bef0205dfae7c1296774f396bb3f"},{"path":"product/policy/auths-bounded-policy/src/eligibility.rs","sha256":"c9acdfb793074e687fc36efad506be27dbd99ffbf40387bc66c8de39ef238432"},{"path":"product/policy/auths-bounded-policy/src/identifier.rs","sha256":"0006a32bae9eb16c4178cf797df418d2b0a781f2bc6474b741dc1a908141831c"},{"path":"product/policy/auths-bounded-policy/src/kernel.rs","sha256":"99187c28b161ac70bee1afed60711f7f645adb4d1671a01863f9849b369811d5"},{"path":"product/policy/auths-bounded-policy/src/lib.rs","sha256":"76a18638b810e62e594d6e951504679305ce21841388e0c282ad51cd7841b91c"},{"path":"product/policy/auths-bounded-policy/src/receipt.rs","sha256":"3b9eae82f349956d3e7f29b57b254bff5ce67cc703e6cf43445ce2827676d1ad"},{"path":"product/policy/auths-bounded-policy/src/registry.rs","sha256":"4e251ea5833559841f8ee0bd9b66c0c01c39fa5e3a21720a19c4e8adbfcb99d0"},{"path":"product/profiles/auths-profile-api/Cargo.toml","sha256":"7ae85761f58625b5d678f961fd052eebf3e000ef565c7312e3ac857763c0017f"},{"path":"product/profiles/auths-profile-api/src/lib.rs","sha256":"a194b82b20bf8aa864c2334ef6c6aec30b2154ded972862252d5dcefa488ab95"},{"path":"product/profiles/auths-profile-mcp/Cargo.toml","sha256":"db264fc25242f7b7e4133cbe5782545b3107b406c87168ae072683cfb59eac66"},{"path":"product/profiles/auths-profile-mcp/src/arguments.rs","sha256":"a5de696586d507e2aee4a49fee99ef1ef4c51a2e46603f8838f1af6d9009833f"},{"path":"product/profiles/auths-profile-mcp/src/lib.rs","sha256":"81c05c307797b347baaa6ad2bd483cb21cf9d0b0aa4a66710e08e16a1f22c4c1"},{"path":"product/profiles/auths-profile-mcp/src/session.rs","sha256":"166c281fa66333388e4760d6098dad02d3359e1d5de4b8f93312c014f97abb03"},{"path":"product/qualification/auths-recipe-qualification/Cargo.toml","sha256":"b7b15b30b9a3d96d4f089d514266d3a892de6608d30707aa44be31cca89ca9fe"},{"path":"product/qualification/auths-recipe-qualification/src/canonical.rs","sha256":"30a9b50777f0dcb4b606abfee2467d5a975d9f6ad941ab6c13ca3df5b359f667"},{"path":"product/qualification/auths-recipe-qualification/src/closure.rs","sha256":"0ad6aee9bd981e2863fa725f209ec84031db2ff12f4c7ac3aaf5120f0bb86039"},{"path":"product/qualification/auths-recipe-qualification/src/commissioning.rs","sha256":"db135c55e4e3079a73253ebae275536523eb36b545d1c152b4d7dce3c6b76828"},{"path":"product/qualification/auths-recipe-qualification/src/commissioning/tests.rs","sha256":"4dde3736d206099b1bea4c14e0092c6c1287d1af9065958777d7c54331dd8686"},{"path":"product/qualification/auths-recipe-qualification/src/error.rs","sha256":"52d5cf720a1e4579008fdda90a3ac2c31f0b8db57985f121f65e54b4da2b7dd1"},{"path":"product/qualification/auths-recipe-qualification/src/evidence.rs","sha256":"ba45a7409d67a8af26ab811af306412014557477a101ab2a8eb0faf8f2bd4b91"},{"path":"product/qualification/auths-recipe-qualification/src/ids.rs","sha256":"e81a906d571497ab2da753e1532d4443706410e0b75fdd59a7d2d788c7aec403"},{"path":"product/qualification/auths-recipe-qualification/src/launch.rs","sha256":"805154ce931e3977f2a2a2c62909d90f7c0a22dc167bf4f1554dcf19316ffef8"},{"path":"product/qualification/auths-recipe-qualification/src/lib.rs","sha256":"0e24b0f81191df0d078c7f4d73ced784ba9472372bfcdff3c7d0e2fb1687b323"},{"path":"product/qualification/auths-recipe-qualification/src/model.rs","sha256":"3484eb0ec287b23d4682ade7b1b0f8d1335985b3fb180f06fc28716076957d5f"},{"path":"product/qualification/auths-recipe-qualification/src/release.rs","sha256":"ec478e53f70052e566aac7e15be2f9e1b1cd46837ac6990ae955fa864d311586"},{"path":"product/qualification/auths-recipe-qualification/src/vectors/mod.rs","sha256":"1e4e5edc12d921e6b95475b3c1850f58f622c088d24a1fc9398d34019fb2f288"},{"path":"product/qualification/auths-recipe-qualification/src/vectors/schemas.rs","sha256":"c59feec2805621f341a90f81fc005e2c12f7a70f9d264fdeacccb2be4fe1c046"},{"path":"product/qualification/auths-recipe-qualification/src/vectors/verification.rs","sha256":"bdf5746fed4d10a7f577f7878619a917d29aa8b7d522f00d9f774e53eff4c8c1"},{"path":"product/qualification/auths-recipe-qualification/src/verify.rs","sha256":"646ff0e52e915174ad183768706e35e5ce2118b83475455310b930a77a7877f6"},{"path":"product/receipts/auths-receipts/Cargo.toml","sha256":"6001fa1375899953aafcb07c23a6da0c8f57ea7ec08bb9c950b12a60a8cc6f0f"},{"path":"product/receipts/auths-receipts/src/disclosure.rs","sha256":"ba9ed439be0a320c8a01f5b6e9b51361c1a37e076947490d8e4a484ba6bb119c"},{"path":"product/receipts/auths-receipts/src/lib.rs","sha256":"547a57c4160256719cafb7d0ab972d9fc80b0da14fbbce4148c70c414070ff36"},{"path":"product/runtime/auths-connections/Cargo.toml","sha256":"babeb6e1dda3dfb66291713ce1e43dce5c349833d0b50ea4dccbf986030026b2"},{"path":"product/runtime/auths-connections/src/credential.rs","sha256":"22bc7de6bcab7cebebb64edf6423d59b6493b78dca65b9da62749e3171217762"},{"path":"product/runtime/auths-connections/src/kernel.rs","sha256":"a456af19526ef7b19278551fd8d97606b6e7aa5a195e70bdd85d1e0786090ce8"},{"path":"product/runtime/auths-connections/src/lib.rs","sha256":"79209249a0acba0e854d9937255ea0e30a9a6f8e1c2baad77ab83646d392de22"},{"path":"product/runtime/auths-connections/src/model.rs","sha256":"de34a089cac9702acb889b7602b3e4732306c9e61029ec892582b7e02b73fc77"},{"path":"product/runtime/auths-connections/src/registry.rs","sha256":"e57640e003e72ad3235c567c2bb944a262bd64e673f023b62ea091094cc7e946"},{"path":"product/runtime/auths-gateway-kernel/Cargo.toml","sha256":"34f864e67656af4ac7e5c7a347a23f01fc8ab31365b8e23c0ef474483b14a183"},{"path":"product/runtime/auths-gateway-kernel/src/construct.rs","sha256":"e9d65744bae273d65face4285e5d2da75c06a92ab48f7b8333d496604e31c63c"},{"path":"product/runtime/auths-gateway-kernel/src/lib.rs","sha256":"cfda6f8453426564c085475f183b6f790b438768a19668f1b65d33ba59dc8632"},{"path":"product/runtime/auths-gateway-kernel/src/order.rs","sha256":"efc2f2eef68232fe3082e1607e6f1e87d4a19cbb2f492bdc6e71916a2461b6a8"},{"path":"product/runtime/auths-gateway-kernel/src/outcome.rs","sha256":"ac0245699457c802a70cdd6f52a01dcb4777c487b58ed7dc9cfc99345465ccaa"},{"path":"product/runtime/auths-gateway-kernel/src/ratio.rs","sha256":"7ace22264812e6fc1ef3a62afee402cf43494bb71ae0d3de219ad1b39d690bcb"},{"path":"product/runtime/auths-gateway-kernel/src/recovery.rs","sha256":"9f46dcd1685ab6e4d1ba04a3fc286a9f3afee8fb47829be1fbc670a7926a2dc6"},{"path":"product/runtime/auths-gateway-kernel/src/transition.rs","sha256":"9c9c292397aa640c2f002ffb5befe110f86d0aa246f3ffe99440718e5174af3c"},{"path":"product/runtime/auths-gateway/Cargo.toml","sha256":"959b1a58a110315f86115966f85d6992afd91be28d741fee7354207d4bd6f258"},{"path":"product/runtime/auths-gateway/src/admin.rs","sha256":"5d0f1b583a4cacdcbc62521ed1a5730ed6b57d42bf826708a0c5e591272c4a12"},{"path":"product/runtime/auths-gateway/src/admin_boundary_tests.rs","sha256":"7ef23fdaf512cfa6315aed72577ccf0c4d04725f5b4fa4b5f0482e27e5e7ba1c"},{"path":"product/runtime/auths-gateway/src/admin_fault.rs","sha256":"4a66386d91daffeeac4080c16a0d4e724adc09220ba056c0c4267e5f4fc05268"},{"path":"product/runtime/auths-gateway/src/app.rs","sha256":"acd1deab7a8524c97d4a76ec9f7079b3afc035d707e0480a0cbdf4d084972099"},{"path":"product/runtime/auths-gateway/src/app/content.rs","sha256":"4c01001659b1a563dfd4abe7e002e3f85609ffef511a0e39f967af944ea01300"},{"path":"product/runtime/auths-gateway/src/app/content_tests.rs","sha256":"6a239a15732dd279abb35a72721eb2034bf5aac79439edc7c34aa8d4fdfd5212"},{"path":"product/runtime/auths-gateway/src/app/participant.rs","sha256":"1d76d37ba8f7a4657ff013ad845bd90ab82636ade7e7a798937db05ee52a9424"},{"path":"product/runtime/auths-gateway/src/audit.rs","sha256":"aebb55cfe1305c6de26fda03989e138a6731ec57d1cfebf4114886bfb6b93d26"},{"path":"product/runtime/auths-gateway/src/audit_export.rs","sha256":"6cc3d70ef4cc64026de4ec4e094979a95fee6fadb86707b0e09515ad754632be"},{"path":"product/runtime/auths-gateway/src/audit_tests.rs","sha256":"8cf1ab4cd2789973791805b07216d423690645aa4f28307f87dbcb803bd2ad22"},{"path":"product/runtime/auths-gateway/src/bin/auths-gateway-harness.rs","sha256":"12b0c24d36b2e6a3be392d3c081a783b355fdd67dc5b54bacc0410e803116b8c"},{"path":"product/runtime/auths-gateway/src/bin/auths-gateway.rs","sha256":"26e8204195fafd4870d82bc92e8fb488011966c7646abb4f8b3081db0ea1e0ea"},{"path":"product/runtime/auths-gateway/src/binding.rs","sha256":"663b0ce878319511aa7d05722ab4ab2fa9be18817884ffb2ee9f131ff1e382d1"},{"path":"product/runtime/auths-gateway/src/bounds.rs","sha256":"d0658585765d4d8f9865f65d23d850ec196eeca23fe65a66a55f1f1bc9b2c9b9"},{"path":"product/runtime/auths-gateway/src/bounds_aggregate_tests.rs","sha256":"ab34f227b7c8692ba1da88ccb32bb3687a66adf8353d8282fae905d4a88eb612"},{"path":"product/runtime/auths-gateway/src/bounds_tests.rs","sha256":"80b116ccf65bda2d7f2fbcd3b26fcf82b0a4bd3dce3a5df7842828cb271d7741"},{"path":"product/runtime/auths-gateway/src/candidate_runtime.rs","sha256":"ebe3d2da3a340c990b6fdcaac8c4418a7c646c0148c8222c19d925b21dbc7da8"},{"path":"product/runtime/auths-gateway/src/commissioning_budget.rs","sha256":"f5c38e9e07df3cb99b6bd664f33eae414b9f3dfef4932d69c19a9b174906dc1b"},{"path":"product/runtime/auths-gateway/src/commissioning_budget/tests.rs","sha256":"da104a1643c37515deec6397bca6db2054f2c9158ec3d230a1b1ec9c7d0f659f"},{"path":"product/runtime/auths-gateway/src/commissioning_floor.rs","sha256":"7fa6991c5ccd5ae1403be84b3da390323fab09f36e15ac01fd7a38ea350c6fdb"},{"path":"product/runtime/auths-gateway/src/commissioning_floor/tests.rs","sha256":"6b663d6e556adc0b455b81845bc4394d82c6c4de0c5f43e1310f3ddc6e4e40f7"},{"path":"product/runtime/auths-gateway/src/commissioning_session.rs","sha256":"919fe57fafa563f770402be66b4e32f1f0d652f09fe1276a62e41b50d66f8696"},{"path":"product/runtime/auths-gateway/src/commissioning_session/tests.rs","sha256":"48d44a5fccea737930f24c49a397428edc439525330c83a868b5113a48f122ab"},{"path":"product/runtime/auths-gateway/src/configuration.rs","sha256":"e5597c39b1acbe50cad20c02722feb38d382294026a0a7a4097e6d97b68eaafb"},{"path":"product/runtime/auths-gateway/src/configuration/engagement.rs","sha256":"67bdd2c792b9dfb1168020a10799af043143461f020b74b18d20fd4089f9b40c"},{"path":"product/runtime/auths-gateway/src/configuration/engagement/audit.rs","sha256":"ee35149f8f348ff2a20ef7185ae0bc5a7b912ad5746510c0714b235765b8b1a4"},{"path":"product/runtime/auths-gateway/src/configuration/engagement/blob.rs","sha256":"12af8071e9cd21c04cf9b55d3cb5e8eb2f33ff888e03e06e114222feb4abf752"},{"path":"product/runtime/auths-gateway/src/connection.rs","sha256":"54f5d53c78f836bf8ce1236d449b3f4f1daa95312102d5583ef69cb4e57b513b"},{"path":"product/runtime/auths-gateway/src/control_namespace.rs","sha256":"0333baed635d34edb066d2b9cb4c6ea3f40faad4be8c75f54c989570515dddee"},{"path":"product/runtime/auths-gateway/src/credential_journal.rs","sha256":"8241dbc7a90054457c7c99fec3b35a433f671682b877f01f8429b8618a6d8e20"},{"path":"product/runtime/auths-gateway/src/disclosure_transport.rs","sha256":"614c975a4b9810f40092a2f9cdd022308b75e649167dbc486c9907f7570d8d45"},{"path":"product/runtime/auths-gateway/src/echo_verify.rs","sha256":"6d453051665f823abd7354d5c50031d9524cf47d6092d2f09080ae814e3b9575"},{"path":"product/runtime/auths-gateway/src/effect.rs","sha256":"5e1d5b8c28df616917d442b023e5161a2e3527ef7b8fb63d736728542c6caa2a"},{"path":"product/runtime/auths-gateway/src/effect/acquisition.rs","sha256":"0afd6aec490e7995a440786be6ac69cb5461201a4b4ec303e8b5a6c12ed97202"},{"path":"product/runtime/auths-gateway/src/effect/authority.rs","sha256":"2490494c3a1636decbfd04b2dbac71c47e49be26b61cc6cf41319a13450bb4a0"},{"path":"product/runtime/auths-gateway/src/effect/candidate.rs","sha256":"d1efc3ec7e1fa642af26f4e4c6a25924c60821dc2e96bd0b458d9292d3866678"},{"path":"product/runtime/auths-gateway/src/effect/candidate/proposal.rs","sha256":"d78574109f41300edfcd7ad38155439ffc3adb9a799554d75d5484738ef174f1"},{"path":"product/runtime/auths-gateway/src/effect/capacity.rs","sha256":"300fa32e09dab7c679b8c0a69bb4e3c1e924ed2ce1416090a2aa477a7eec9f0f"},{"path":"product/runtime/auths-gateway/src/effect/content.rs","sha256":"9f3b53c8c2ad5cafa183ed1229ee03f2cd8a610009b07da560372bd0fbae1673"},{"path":"product/runtime/auths-gateway/src/effect/disclosure.rs","sha256":"0acb5ac805e91c952c8f0028db03ae607c3753cbd08a76035f2d1b4fa6fe6244"},{"path":"product/runtime/auths-gateway/src/effect/disclosure_auth.rs","sha256":"32fa6f040ae46f3323df6e153c6ae810eccf32d22b9945e5565e7189dc877eac"},{"path":"product/runtime/auths-gateway/src/effect/engagement.rs","sha256":"5a36ff3f4460bf026a7e99fadc713672fbeb05dbc6f6393d10cb06440e779e54"},{"path":"product/runtime/auths-gateway/src/effect/lineage.rs","sha256":"0b3ddeb56377b69264bbd4738c624639a8dcad91b4df3328f907db439747faaf"},{"path":"product/runtime/auths-gateway/src/effect/prerequisite.rs","sha256":"e79596a4cbe47e307e3a3056c52582b1cd01a43c4c2d69479ee03df1f62af3b0"},{"path":"product/runtime/auths-gateway/src/effect/release.rs","sha256":"84e2572f76216e02131e9bbcc850f4b3572473eac6dd71baa144e63a2270cff7"},{"path":"product/runtime/auths-gateway/src/effect_binding_boundary_tests.rs","sha256":"83d8e0edf524a2be0d2c494e4b9897cab0ddcf61184828d716bae10cbaf904b4"},{"path":"product/runtime/auths-gateway/src/effect_candidate_staging_tests.rs","sha256":"7db0f4fd86cf119a6b4b0702267c91debdf11a73fc93105ce7e98d0c6e4cd8d9"},{"path":"product/runtime/auths-gateway/src/effect_candidate_tests.rs","sha256":"e93c08c2eca2abdc58f7db9fbf19e775e4f709225b04789832e2b8f5a81c8948"},{"path":"product/runtime/auths-gateway/src/effect_content_tests.rs","sha256":"63eb623413167bf9ff34161b6bf4f54f68709af9fb1d1e7a419a07f63ce04409"},{"path":"product/runtime/auths-gateway/src/effect_created_resource_tests.rs","sha256":"98f7a9de7824dbf3e2361b3006ef823002b391d557969442edb371266f7673db"},{"path":"product/runtime/auths-gateway/src/effect_disclosure_delivery_tests.rs","sha256":"9586b84b045561edbcf8276cd9769b412240f04248e240cd29a5068d4cd03a00"},{"path":"product/runtime/auths-gateway/src/effect_disclosure_journal_tests.rs","sha256":"19f349a090f07288cfafe24aaffad49f28fe163e59870520aac6bb899f673a99"},{"path":"product/runtime/auths-gateway/src/effect_disclosure_tests.rs","sha256":"5389b03d7d0cd5b23abaa3c396450fa4018102c942b27af35aef81e65b9bb841"},{"path":"product/runtime/auths-gateway/src/effect_engagement_admission_tests.rs","sha256":"46a34a83cfecb180c6f0937e83b8b14009afb4ce315864dfb9b3137759cb9959"},{"path":"product/runtime/auths-gateway/src/effect_engagement_control_tests.rs","sha256":"71e2e965b71b52d2fb877e22e5d4951d1d4072adede4b60dc3996197ac554395"},{"path":"product/runtime/auths-gateway/src/effect_engagement_delivery_tests.rs","sha256":"14b241916d9c3fe8141a38e93c62f8b8a039f2780ad3cd63282e707feaa4d1b3"},{"path":"product/runtime/auths-gateway/src/effect_engagement_information_tests.rs","sha256":"27735a9e1237a063c2a525cdcd93e8102164d549dc72509767a977ab4abd8491"},{"path":"product/runtime/auths-gateway/src/effect_engagement_prerequisite_tests.rs","sha256":"0566288b7f77f5beda44c8374f31a5053e02b44ccbe92781618e9fd90b1a6800"},{"path":"product/runtime/auths-gateway/src/effect_engagement_tests.rs","sha256":"2b78b315c7539d4119ce5b20164d6e4855d9b403b76eaa5b72fa3b72959a7621"},{"path":"product/runtime/auths-gateway/src/effect_instance_recovery_tests.rs","sha256":"eee64773b6373e1bd7185c07c5c4ffeaacafb907f4d0aa17b89ba1556beec5e4"},{"path":"product/runtime/auths-gateway/src/effect_native_tests.rs","sha256":"fd9cd960dfb02f68eef479ed2a95d65b79882c20f8a737c9a74d6a4222af407b"},{"path":"product/runtime/auths-gateway/src/effect_prerequisite_tests.rs","sha256":"51efa528051919d0ca67643cac3d0e06afac534706b802adb18311e2bfa222ff"},{"path":"product/runtime/auths-gateway/src/effect_read_budget_tests.rs","sha256":"9bf8491f0da471e07b5d96dbfdbdf5fbe5a47fec11700dca55a6ac05a1ebb68b"},{"path":"product/runtime/auths-gateway/src/effect_recovery_prerequisite_tests.rs","sha256":"e6235b83ac159d9446d79e6e072dd4aa9d0447a68055be3b32de6450a2300699"},{"path":"product/runtime/auths-gateway/src/effect_review_approval_tests.rs","sha256":"6e5c5a72ec93255d7d8f219ae8cf4401431644ff03d624164645a1e9d2b2e87e"},{"path":"product/runtime/auths-gateway/src/engine.rs","sha256":"113390cb4ef92ef337b5f82b7c77c54a428ec492756f90100b74002487dc8c7f"},{"path":"product/runtime/auths-gateway/src/entry.rs","sha256":"6fd17c142c0001b9cda33c33b0e18f4d1d40866cde8a66b3f57d46f971c1ead9"},{"path":"product/runtime/auths-gateway/src/entry_tests.rs","sha256":"86dcfc4918394052d18fc5509dcc0e740a064a97b084d1c2c9f23eddedaa6db4"},{"path":"product/runtime/auths-gateway/src/execution_witness.rs","sha256":"e8b1a8e41d5e3fa309760067849d390ef065feeb46701a83391832645a2f000c"},{"path":"product/runtime/auths-gateway/src/fuzzing.rs","sha256":"2dcf0a15e407a9180c7fecb7eecfaf4674698aa997b1f5de9a3649a49baebd1b"},{"path":"product/runtime/auths-gateway/src/generation_floor.rs","sha256":"09ed98d9533c7a4355890943ee6ef26a9c20da775b4cb77fdb25a723f6a16e54"},{"path":"product/runtime/auths-gateway/src/harness.rs","sha256":"5e296231c98e6429f3d805150fab9ce2d6a5789d41dd83f562b677314374567b"},{"path":"product/runtime/auths-gateway/src/harness/authoring.rs","sha256":"de511d89bf6bb72e443558caf0c4835dad2908b5fe5c13a3a02483e85dd7d354"},{"path":"product/runtime/auths-gateway/src/lib.rs","sha256":"a39306228bb0ee5e7c50fb83149756a15fa761d52bb6807942f1ec77db2049d6"},{"path":"product/runtime/auths-gateway/src/listener.rs","sha256":"aa08239bcbc1fcb55e8a212fbdf6a84f12985b0d436dcb51dc58b06e59e435f2"},{"path":"product/runtime/auths-gateway/src/native_budget_tests.rs","sha256":"d6de965afc7f794e611545744fa515f833abf315157519ed8390c195a7dac8c0"},{"path":"product/runtime/auths-gateway/src/native_cost_store.rs","sha256":"d1acdd7e4076e3a32f312dce74a01e5dcbccdb1f8912758524b7841d61377eed"},{"path":"product/runtime/auths-gateway/src/native_cost_tests.rs","sha256":"45bcb4e9174d4c23495ac734a42b5f8b7735c14d4599cd191d50f6547aaf374c"},{"path":"product/runtime/auths-gateway/src/native_crash_tests.rs","sha256":"46998a973388884d902a6b07e12fa342fb08ea77363a43a41b0b0a7a5ccbcde9"},{"path":"product/runtime/auths-gateway/src/native_cross_recipe_tests.rs","sha256":"e2dbde7afba1b3da5df3a7a44821f413ab7861a5417ad16f8b912f390128d115"},{"path":"product/runtime/auths-gateway/src/native_dependency_tests.rs","sha256":"0e15d059140ad485b2548f4234b94424d62b5563a8dded42224329a76b101f37"},{"path":"product/runtime/auths-gateway/src/native_differential_tests.rs","sha256":"17fc0803fe5e7f78b416f8f68e7c9066baf1bab69bdf0b51c44fd19e3d719da8"},{"path":"product/runtime/auths-gateway/src/native_disclosure_budget_tests.rs","sha256":"bb2a6f76f06a6d42d69698f7d22d0b4aeb4dc857e442042d65582097567009fb"},{"path":"product/runtime/auths-gateway/src/native_disclosure_crash_testkit.rs","sha256":"4beb946a288e4fe082cc0917f4200b18b8154eff98eca1ea3d0c830ffdc3625d"},{"path":"product/runtime/auths-gateway/src/native_disclosure_crash_tests.rs","sha256":"425e423f04d92794656d4da915125e4d0a8be25ec85fb88244ee0c27ece8ec44"},{"path":"product/runtime/auths-gateway/src/native_disclosure_entry_tests.rs","sha256":"50f5dc35a9a8ef462b8833296cb313b2acec81d544b7e317c7f188741d0786db"},{"path":"product/runtime/auths-gateway/src/native_disclosure_file_fault_tests.rs","sha256":"72d67bb0d3fd77fb93c4f5d3ab0afa5a939742b5a47acf006a511d99d72cee9f"},{"path":"product/runtime/auths-gateway/src/native_disclosure_pg_batch_tests.rs","sha256":"a8b8a90210d9f7f0012e40701c09c524527f93f9e56933d89b58a38464cba702"},{"path":"product/runtime/auths-gateway/src/native_disclosure_pg_commit_tests.rs","sha256":"1e14503140805c12883e1c288b75029aa7fd9ebe8c5d490a4c503161c4a27a4b"},{"path":"product/runtime/auths-gateway/src/native_epoch_tests.rs","sha256":"e37d34e699baa2b84578bd4c378975dbdceb407de51861c2217afdcf7b48e3b9"},{"path":"product/runtime/auths-gateway/src/native_federation_tests.rs","sha256":"bf2c6313f70c4b7f51f9ad05351048be3625d9432f3c725e84b046936304f540"},{"path":"product/runtime/auths-gateway/src/native_file_fault_tests.rs","sha256":"e1077a0059aa69918fb7e0a3481edd19af45a7343ce876583fbdbc96c4291b21"},{"path":"product/runtime/auths-gateway/src/native_generated_history_tests.rs","sha256":"5a5e308c1e4bc32cac31badf91e9453bed62e3e90f1b6585fc522bb4038990f9"},{"path":"product/runtime/auths-gateway/src/native_guarded_mutation_crash_tests.rs","sha256":"5329f72e7f22399a17627b058c2035c243e1b6ba60c9dfcd1c834258244cc440"},{"path":"product/runtime/auths-gateway/src/native_information_journal_tests.rs","sha256":"067bc51f7011971e8c5d021430fbfe323e5cc3cd7cde41c546cc92fad1f2cbc2"},{"path":"product/runtime/auths-gateway/src/native_information_replay_tests.rs","sha256":"165a1dce11c2006e6adfb5eee4c4977737b830995e6e29f77544a999893b0a5f"},{"path":"product/runtime/auths-gateway/src/native_journal_tests.rs","sha256":"d803ff53f90ce2a8c29808b4f874cd81954a3a5c52e19b519ab22f0543808fe1"},{"path":"product/runtime/auths-gateway/src/native_mutation_budget_tests.rs","sha256":"41d7f560d6b04e750acb2f8add2544745743ea9fea760a8ffd5ec5aab307e94c"},{"path":"product/runtime/auths-gateway/src/native_mutation_crash_tests.rs","sha256":"3e1befd35e7264024666331b52ca2245540ffa8f9927ed62e3aa45c7c8cc8950"},{"path":"product/runtime/auths-gateway/src/native_mutation_entry_tests.rs","sha256":"219a1986cf7440d31734db9db3c25f7997486a2fc29fee0a1ac8c7f0ee9ce803"},{"path":"product/runtime/auths-gateway/src/native_mutation_file_fault_tests.rs","sha256":"252f6ca9455b291b0873d983c8fccc75254d947b89a3fe9a1de0155c8ee53930"},{"path":"product/runtime/auths-gateway/src/native_mutation_journal_tests.rs","sha256":"181bf0a196805e50944cff4fe2315459eba877e7d7b5b90bf3c99e3353a8cad7"},{"path":"product/runtime/auths-gateway/src/native_mutation_pg_batch_tests.rs","sha256":"137f0e2f0e8d950cea3b38a7a03113c61177e54083f11eecc34b994ce41728f1"},{"path":"product/runtime/auths-gateway/src/native_mutation_pg_commit_tests.rs","sha256":"5d9a3b8a1601c83c66db3aefd904c16233ce2700d070ba5c9c4f81f4051c5fad"},{"path":"product/runtime/auths-gateway/src/native_mutation_replay_tests.rs","sha256":"3a874e1416cbb29cce70930f9955a70b4a5ad46e2cbca8d55f1acf070215cfbd"},{"path":"product/runtime/auths-gateway/src/native_partial_upload_tests.rs","sha256":"5fa867219d61b7c8a563e7cf5111291f15b8a11464623859be8aa9ea858170ea"},{"path":"product/runtime/auths-gateway/src/native_postgres_commit_proxy.rs","sha256":"1c95b3f8af48b78dc4f1c1baa3b26c1aa7bbe868c23aefbb32f1f0ae592f0045"},{"path":"product/runtime/auths-gateway/src/native_postgres_commit_tests.rs","sha256":"f021b110991ba3ae497705d0aaa0350a210f09b6f102fd71ac2f8eb4ff8f30c0"},{"path":"product/runtime/auths-gateway/src/native_postgres_fault_tests.rs","sha256":"0c6edea869a20765b322fa69c48e580aa0664e726b6cef483d4eba49803135ba"},{"path":"product/runtime/auths-gateway/src/native_process_tests.rs","sha256":"778a02ea4de3a0655021bad7d2f4b5f0007c6518ef60e966db3da49bfaf22c37"},{"path":"product/runtime/auths-gateway/src/native_public_evidence_tests.rs","sha256":"dac3a70f4535a14aab49ceed5a6b5fd7002e199270bb5a120f5bc8edfa5398bf"},{"path":"product/runtime/auths-gateway/src/native_recovery_actor_tests.rs","sha256":"bfdcdbaa0ee1d6822c57e5ab9ca524e731c393f9289c5508b61a0fc1d0b065e5"},{"path":"product/runtime/auths-gateway/src/native_recovery_authoring.rs","sha256":"9f4e8008160b349a52267eacd6a1c1e5c31c3c1cdfd71b574162ccaa9f7430b6"},{"path":"product/runtime/auths-gateway/src/native_recovery_history_tests.rs","sha256":"0c6ec8fe18fd4cc8496f04c3bc38552c3602d7254cae979fac76aeb7c7e4f41b"},{"path":"product/runtime/auths-gateway/src/native_recovery_limits_tests.rs","sha256":"f147c2e78cbe364fb3fd0c97bbbacdad86d77ca8c0b8575d9fa108968f82379a"},{"path":"product/runtime/auths-gateway/src/native_result_wire_cases.rs","sha256":"2b93c8ed96d7092216410bb99435411fd57497284639f56e0120b16639a98eb2"},{"path":"product/runtime/auths-gateway/src/native_retention_tests.rs","sha256":"224c941e394dd711a7ee19e7b52a1d6b7359eec62e7decec323d066319cb59d3"},{"path":"product/runtime/auths-gateway/src/native_scope_tests.rs","sha256":"8d3f362df9fadc10c22f0483f3a16d238d0f82f393a628727adf0b728707673e"},{"path":"product/runtime/auths-gateway/src/native_threshold_testkit.rs","sha256":"74e6b6ed1b77b463effff132fd8af9b3b59aeee64704a8fe8a19ed3ca9d79bf7"},{"path":"product/runtime/auths-gateway/src/observed_tests.rs","sha256":"91223493fefd3efc3fec58db225f00786b539e3b24027419e919d8bd7310059c"},{"path":"product/runtime/auths-gateway/src/observer.rs","sha256":"1c8988dd8807566d5a152e1894aa0f4c80c3ba7302ac910a4a6978d4f31b323d"},{"path":"product/runtime/auths-gateway/src/onboarding.rs","sha256":"6180e79d7698bcd4dd6ffdf32dcfbe14427f96de92f4ae4ceac4dda651f3671b"},{"path":"product/runtime/auths-gateway/src/operator.rs","sha256":"fe3b11fcf8e2394ab955b09a5b9b1f979c46f9e07a4f16e1a3ca160d675f1ace"},{"path":"product/runtime/auths-gateway/src/participant_control.rs","sha256":"58acbac1ab812963ad0ba0e2864395a87b3afe50962263cb44e19776cf5100b8"},{"path":"product/runtime/auths-gateway/src/participant_enrollment.rs","sha256":"719e82ed5f30f7b37d6d87e45220918d945a2ed8fadc9e760308398e9f6501a4"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/audience.rs","sha256":"83940af76073d391f1181eccea2e9b682dbd7ffcace6c39b2123ebe09e721573"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/audit_tests.rs","sha256":"1a8cb537f16d023962f1375b7f15d0879b2be85c29775dd677c84d87b8c9d183"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/configuration_tests.rs","sha256":"2e1cb7024ff137bfd3292929f26ec078c9213f6276f4a2f915b279530c6c7782"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/cross_recipe_fixture.rs","sha256":"5a957eeac83da3f1c74e923648319674f6a90e6673b45fdc029b784b1c09053a"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/identity.rs","sha256":"a04328f93d59da6c34d623319b8a6f55a32e7d718837109b299ef6935b126930"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/recovery_tests.rs","sha256":"b13faae436b325fa6ea234613f1542f4ec8b1dfb7082d3f31339ea7f4a8b0cb8"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/root.rs","sha256":"586bfc83e1a615b7d255ea235f6e519945126bb3ba7fe41d2aecd1dbcdccc797"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/tests.rs","sha256":"a6f83af4c504d7a5bdedad90e473c8032f10c384adeab29075051389040f7696"},{"path":"product/runtime/auths-gateway/src/participant_enrollment/tree.rs","sha256":"4f2b8965b91b6e23317168221d077b074fd149690e28c30fad6055982ada584e"},{"path":"product/runtime/auths-gateway/src/pending_vectors/attempts.rs","sha256":"79803db1c278b2133d4adb112ab325247f359cfa5cf34e3de32898f6a9bffe62"},{"path":"product/runtime/auths-gateway/src/pending_vectors/bounds.rs","sha256":"e612217307e1da5b0eb5ee6582a7458bb064b8aa8a529fc6555b1b334127ab68"},{"path":"product/runtime/auths-gateway/src/pending_vectors/codes.rs","sha256":"6fb3f1679b0fd2ca7a8ac6aaee65f586b9eb809d9d7c9e26d3dd8ae2bfd10307"},{"path":"product/runtime/auths-gateway/src/pending_vectors/keys.rs","sha256":"b0b1f79d2fadc06e91378a8250223a429163138e4b86e90e09bc207d80fabf86"},{"path":"product/runtime/auths-gateway/src/pending_vectors/mod.rs","sha256":"5de8340f0ef71a0b57a09e323fefe473d3160c6ae952b9ba46f714825fbacafc"},{"path":"product/runtime/auths-gateway/src/pending_vectors/outcomes.rs","sha256":"a8960d8e055ac31827e379513f57f00ed868b559079fa2a4687e1b055d48e3ca"},{"path":"product/runtime/auths-gateway/src/pending_vectors/production.rs","sha256":"15c687599b0342dc141878afdf727092b23ade67ee5564eaa671f3f06befad57"},{"path":"product/runtime/auths-gateway/src/pending_vectors/recipes.rs","sha256":"5d550e3708ea41a9547ae2207699bde5ff4435f5a1ed7afa4378fb8defb51bb4"},{"path":"product/runtime/auths-gateway/src/pre_entry.rs","sha256":"3f2554feda72fa047229d427504676a1fb14894bdd377055a3108d7b3e3587cd"},{"path":"product/runtime/auths-gateway/src/prerequisite_race_tests.rs","sha256":"683cc46b3718d12dbb42668dae4bc6ec7e7508dcbb6b6232fead2e3e4f510d0d"},{"path":"product/runtime/auths-gateway/src/property_tests.rs","sha256":"85a77aaf01d9be51e1dd7c72461653a099c51b0ca9c818800d991abe262b198a"},{"path":"product/runtime/auths-gateway/src/qualification.rs","sha256":"f25bbb01c2a6131633c5a4de4e59345b761609e47b3c69353187364996ec87ea"},{"path":"product/runtime/auths-gateway/src/qualification_simulation.rs","sha256":"61f4117e33db07be83ce0f0376f79a405ff6d8bb7ffc2e28ff0bf927486941ce"},{"path":"product/runtime/auths-gateway/src/qualification_tests.rs","sha256":"ed9eb74599074af67730d63f8c5093f6a5277bced96dffeb81317a6dd9f4c8c6"},{"path":"product/runtime/auths-gateway/src/quorum_tests.rs","sha256":"a6533de9bc2689ec632f009404daf363494e224e7b89b1c65bb2e2cd4fc6421d"},{"path":"product/runtime/auths-gateway/src/readiness.rs","sha256":"911c3f11892f94641574375e2da4c671c802738f71082f12c39832331052d43d"},{"path":"product/runtime/auths-gateway/src/recipe.rs","sha256":"efb99a8f060b5633ea8ea75f24378e701f6ba2af023faf8c7609e4de4e868637"},{"path":"product/runtime/auths-gateway/src/recipe/content.rs","sha256":"e3f8aa8cf2dd9ef5777d9d1e76331052c67be87873db0c2cd6a8f48ff940d9d6"},{"path":"product/runtime/auths-gateway/src/recipe/created_resource.rs","sha256":"2284b6f7363b1a15dd3c91dd3043f46a5c7a9c12d997213b13751b82ae627e26"},{"path":"product/runtime/auths-gateway/src/recipe/created_resource_tests.rs","sha256":"ab371d7d7a5dae249da924e7b94d5c863491a2af796d2febdf2dda2a191c559f"},{"path":"product/runtime/auths-gateway/src/recipe/effect_review.rs","sha256":"8f94896f0d124162d3dbd080c44582bb23ad181bb582ff5cd3d049d75fcb6d77"},{"path":"product/runtime/auths-gateway/src/recipe/lower.rs","sha256":"81118ea7ae6c2d9984b88fe9991f91283070859d56923ee4fdfe9a50eee9ccb1"},{"path":"product/runtime/auths-gateway/src/recipe/response.rs","sha256":"0b4a074eb05b98685697094ed4775c5fe588b3e34f954aa1844135fe14c94487"},{"path":"product/runtime/auths-gateway/src/recipe/review.rs","sha256":"f9f88f6d54c9a517b55ea717ce8caf5199954ff710c0d20e2bb609f6b1344a51"},{"path":"product/runtime/auths-gateway/src/recipe/runtime.rs","sha256":"6301c005c5f014eb81a7a85dfa3bd256ec15e35bf1cdf6e60815a2a18b7151a0"},{"path":"product/runtime/auths-gateway/src/recipe/source.rs","sha256":"f79e481ab0f40985819b317c540c715766611b5c8c0e5647c87849fefc10cbac"},{"path":"product/runtime/auths-gateway/src/recipe/tests.rs","sha256":"78cfa166bb02b722c92205d2a95c261ef4f3cc272150145980252cb4c51c13d1"},{"path":"product/runtime/auths-gateway/src/recipe/validate.rs","sha256":"3f613af38c5cf29901575af4f82a9daca6718b2da70bc84baa0994a71be6113b"},{"path":"product/runtime/auths-gateway/src/resource_identity.rs","sha256":"edf093bf84c0ca6c0a300adc6060fe10cf58b90e592dc3cd6ebd58e73632373d"},{"path":"product/runtime/auths-gateway/src/scenario_tests.rs","sha256":"eba5fe0268e5d8516eea79a2cf418f5c52ccdf777fa94e553cfba00f0b90865e"},{"path":"product/runtime/auths-gateway/src/separation.rs","sha256":"be9306848ca5d801767cf6aa14247c8618312ef0e202f00ce0c24c4844491061"},{"path":"product/runtime/auths-gateway/src/simulation_attestation.rs","sha256":"88705e5d45415f760f1e3c3a065c35c48f4f4065bf7b3feb7882246983814d6f"},{"path":"product/runtime/auths-gateway/src/store.rs","sha256":"5645f57bcd92190ff2c83836744ecc514558c466bb5d377b258a8d82d21504f9"},{"path":"product/runtime/auths-gateway/src/store/acquisition.rs","sha256":"c52193c7ca87f4eedc3a3523be12eb85a2825fa989d8a61b076be734eb99684e"},{"path":"product/runtime/auths-gateway/src/store/acquisition/candidate.rs","sha256":"90c133dfc48ed351d0f1fea9de236135e82297719c383f9f37404a335909d225"},{"path":"product/runtime/auths-gateway/src/store/acquisition/content.rs","sha256":"92f87e4556335af8e1c4157e60e6936ca02b271381569e14510bc2c35e697ece"},{"path":"product/runtime/auths-gateway/src/store/acquisition/recovery.rs","sha256":"cc1be15bb948608868d33a088951530834235220a8fed7d77161ff53bf416dc1"},{"path":"product/runtime/auths-gateway/src/store/capacity.rs","sha256":"d25c4a0d753317270cb352246c70642bf0659e6448d14061356e4e9ea7ed3811"},{"path":"product/runtime/auths-gateway/src/store/disclosure.rs","sha256":"3b2f68d024bb10b734bd1e48ceb4eed23d1348ec6f716be78ec27384458ff007"},{"path":"product/runtime/auths-gateway/src/store/engagement.rs","sha256":"953ef4c20f16775c10bca98b820536f347a6ce9c756934503efdb7bb77c41ff5"},{"path":"product/runtime/auths-gateway/src/store/mutation_phase_tests.rs","sha256":"163c177cf5e053126b46c7de7e429a99df789090b1127b5d3b91636efcac4365"},{"path":"product/runtime/auths-gateway/src/store_retention_tests.rs","sha256":"a9e300fde3c45999764ee05c4c6ea46cfb9ffcaa51b82337a322925ad50f4f50"},{"path":"product/runtime/auths-gateway/src/store_testkit.rs","sha256":"720bdda4464a54198348e1cac8ff75ad4882b9ce10c389befb4e9bc80340156c"},{"path":"product/runtime/auths-gateway/src/submit.rs","sha256":"a8e5e908b99d997cdf34c46c5827e04c0f502307f71497d15511bb40ef52815b"},{"path":"product/runtime/auths-gateway/src/support.rs","sha256":"d4865f95a7a2fdfe297f3f73687c05ab64a6b911814daf5f2b6c703ce58262ce"},{"path":"product/runtime/auths-gateway/src/transport.rs","sha256":"0ad16c63c19cc41d11c485625c8fc0617aede21401d16ec814401f963538bb46"},{"path":"product/runtime/auths-kernel-runtime/Cargo.toml","sha256":"926bcd0053e5edd703be8f0027ad009e2982db013c8174c1366edbf38b48087d"},{"path":"product/runtime/auths-kernel-runtime/src/lib.rs","sha256":"7108faae9ca4bc32dc093ddaf885ac8f74f3c9b8d317b7c7d0ed00d1d0ab5972"},{"path":"product/runtime/auths-lifecycle/Cargo.toml","sha256":"c5053c705f8d5554b44e432fe75287a2faf11d644e5a2552e45ad6cd94176af5"},{"path":"product/runtime/auths-lifecycle/src/codec.rs","sha256":"51c4b746749150e8bfcd8ff972b3f6c1ef40bec15583448ec1b471d9ad737dc0"},{"path":"product/runtime/auths-lifecycle/src/digest.rs","sha256":"55282cd7d8aba37713c2dcb5357c9877819edb72a30eadefb860d28d7d3a3eb7"},{"path":"product/runtime/auths-lifecycle/src/identifier.rs","sha256":"31620e8c16de68d3d2d3b84d6353c1a5b9d4151d8247f91fa389b906a8e660f1"},{"path":"product/runtime/auths-lifecycle/src/kernel.rs","sha256":"2abb8c094b36d35b364e74d78091d14c5d6f3d1eb6552cca3b5538dbd017ce23"},{"path":"product/runtime/auths-lifecycle/src/lib.rs","sha256":"afe5a345cd309b5a4f08ffba3170a6d7f16ff914892b3f2006d5208ed24ec736"},{"path":"product/runtime/auths-lifecycle/src/model.rs","sha256":"1af12bbeeeaa65ec02ddcebd7d2c8c92ec1e339fa40ae85b45ab9b01a722a4fa"},{"path":"product/runtime/auths-lifecycle/src/operation.rs","sha256":"78e6d05fcf5d7ea4f148032a3fa26fdfcab77eb346019effe927b08e0d64d732"},{"path":"product/runtime/auths-lifecycle/src/registry.rs","sha256":"53495fe6f7a77422593a41623e28716f1c140dcc1e00f87f6b0ffbfb93a5ef90"},{"path":"product/runtime/auths-lifecycle/src/sealed.rs","sha256":"2e0c03b5813c926c159598bb7890d1523825edbe57cd687d42a5dfb3374a0c19"},{"path":"product/runtime/auths-lifecycle/src/test_support.rs","sha256":"221d9a5c5ef8e1f9f8fd66927484eaf813571d0568470278ecd8fa08a5eec8cd"},{"path":"product/runtime/auths-lifecycle/src/transition.rs","sha256":"011805a28efdd541f44ccea54dd0e34a1e58f4004447ee58013703b4fb6b2822"},{"path":"product/runtime/auths-runtime/Cargo.toml","sha256":"dd29d80a8b4bb56c869f036a6c9998f6e6d1c0383ac5dc03fa42b24abe2a7ff7"},{"path":"product/runtime/auths-runtime/src/lib.rs","sha256":"132ca03d58c14905d3a822a4972f42a22a5ad33a45f2ba9ca44f3a57d810b4b0"},{"path":"product/runtime/auths-runtime/src/production.rs","sha256":"fd4eff4270c571c10fcff6cf27df28961ebf074de8a1a028f500fda1ca376820"},{"path":"product/sdk/auths-approval-quorum/Cargo.toml","sha256":"df904971fca87a24194c5816738a331588fe8f164acb5d70839a35dca5f57114"},{"path":"product/sdk/auths-approval-quorum/src/lib.rs","sha256":"72e4086088a1c0912e4e1a9e980f26a5c280bf5ab16ea39c9f0f58d5096ac2ce"},{"path":"product/sdk/auths-approval-quorum/src/remote.rs","sha256":"9fa029c7c63003adf260f8aec55160c545681c60c1bace0d934e7525862aac7b"},{"path":"product/sdk/auths-approval-quorum/src/remote_tests.rs","sha256":"8a09ce17cfee82a035a74edd535f3ebeb3db0e078784740d3997b17dbdb10197"},{"path":"product/sdk/auths-approval-quorum/src/tests.rs","sha256":"0acbf12be3e497dcc6c2d8f29c9af3b1a7ed8e11b75f6399570d4f217a785060"},{"path":"product/stores/auths-stores/Cargo.toml","sha256":"a32c4b76d17b264be5d40d24497ff237e1ed87822e8bab86229b3db93106dbe3"},{"path":"product/stores/auths-stores/src/gateway_attempt.rs","sha256":"f39dc84a238db0ebc70ad1ac495da194d2c24b5e1f9905552a9b1143278725a9"},{"path":"product/stores/auths-stores/src/lib.rs","sha256":"40c280a5ff79bfc1cafcf0bb415e775e205637c526973eb94b43a30f86d4e6fe"},{"path":"product/stores/auths-stores/src/lifecycle.rs","sha256":"f69744bb91bb4ea408e4bbfd027f252803b4963ceda6f6f1137148c3f887efbd"}],"schema":"auths.gateway-semantic-closure/1"} \ No newline at end of file diff --git a/product/runtime/auths-gateway/src/bin/auths-gateway.rs b/product/runtime/auths-gateway/src/bin/auths-gateway.rs index 3e8fc53d1..aa711801a 100644 --- a/product/runtime/auths-gateway/src/bin/auths-gateway.rs +++ b/product/runtime/auths-gateway/src/bin/auths-gateway.rs @@ -3473,17 +3473,17 @@ mod unix { fn bind_recovering_socket(path: &Path, code: &'static str) -> Result { let owner = rustix::process::geteuid().as_raw(); + if !secure_socket_parent(path, owner) { + return Err(Failure::at( + code, + path, + "the parent directory must be canonical, owned by this gateway and closed to group and other writes", + )); + } match fs::symlink_metadata(path) { Ok(metadata) => { // Only replace a dead socket owned by this gateway inside its own // non-writable directory. A live listener or foreign inode fails closed. - if !secure_socket_parent(path, owner) { - return Err(Failure::at( - code, - path, - "the parent directory is not this gateway's own directory closed to group and other writes", - )); - } if !metadata.file_type().is_socket() { return Err(Failure::at(code, path, "an existing file is not a socket")); } @@ -3519,39 +3519,104 @@ mod unix { UnixListener::bind(path).map_err(|error| Failure::at(code, path, error)) } - /// Removes a socket file this process bound when startup fails after - /// the bind; [`BoundSocket::keep`] leaves it for the running gateway. - struct BoundSocket<'a> { - path: &'a Path, - kept: bool, + /// One serving generation owns admission, drain and cleanup. Endpoint + /// claims are independent of installation/admin locks and survive listener + /// closure; their stable inodes are never unlinked on release. + struct ServingClaim { + _locks: Vec, } - impl<'a> BoundSocket<'a> { - const fn new(path: &'a Path) -> Self { - Self { path, kept: false } - } + impl ServingClaim { + fn acquire(state_dir: &Path, app: &Path, admin: &Path) -> Result { + let owner = rustix::process::geteuid().as_raw(); + let mut parents = [ + (app, "gateway.serve.app-bind-failed"), + (admin, "gateway.serve.admin-bind-failed"), + ] + .into_iter() + .map(|(path, code)| { + if !secure_socket_parent(path, owner) { + return Err(Failure::at(code, path, + "the parent directory must be canonical, owned by this gateway and closed to group and other writes")); + } + let parent = path.parent().ok_or(code)?; + Ok((parent.to_owned(), path, code)) + }) + .collect::, Failure>>()?; + parents.sort_by(|left, right| left.0.cmp(&right.0)); + parents.dedup_by(|left, right| left.0 == right.0); + let mut locks = vec![Self::lock( + &state_dir.join("serving.lock"), + state_dir, + "gateway.serve.claim-unavailable", + )?]; + // A directory is the supported endpoint allocation unit. One fixed + // inode also covers case/normalization aliases on Unix filesystems; + // installations that need concurrent service use distinct parents. + for (parent, path, code) in parents { + locks.push(Self::lock(&parent.join(".auths-serving.lock"), path, code)?); + } + Ok(Self { _locks: locks }) + } + + fn lock(lock_path: &Path, endpoint: &Path, code: &'static str) -> Result { + let file = + private_lock_file(lock_path).map_err(|error| Failure::at(code, endpoint, error))?; + rustix::fs::flock(&file, rustix::fs::FlockOperation::NonBlockingLockExclusive) + .map_err(|error| { + let code = if error == rustix::io::Errno::WOULDBLOCK { + "gateway.serve.busy" + } else { + code + }; + Failure::at(code, endpoint, error) + })?; + Ok(file) + } + } + + /// Cleanup belongs to the bound inode, including startup failure. A + /// successor or foreign replacement at the pathname is never ours to remove. + struct BoundSocket { + path: PathBuf, + device: u64, + inode: u64, + } - fn keep(mut self) { - self.kept = true; + impl BoundSocket { + fn new(path: &Path) -> Result { + let metadata = fs::symlink_metadata(path)?; + if !metadata.file_type().is_socket() { + return Err(std::io::Error::other("bound socket was replaced")); + } + Ok(Self { + path: path.to_owned(), + device: metadata.dev(), + inode: metadata.ino(), + }) } } - impl Drop for BoundSocket<'_> { + impl Drop for BoundSocket { fn drop(&mut self) { - if !self.kept { - let _ = fs::remove_file(self.path); + if fs::symlink_metadata(&self.path).is_ok_and(|metadata| { + metadata.file_type().is_socket() + && metadata.dev() == self.device + && metadata.ino() == self.inode + }) { + let _ = fs::remove_file(&self.path); } } } - async fn serve( - state_dir: PathBuf, - app_socket: PathBuf, - admin_socket: AdminSocket, + /// Load the installed engine off the executor, then apply the optional + /// development transport before the serving owner binds any resources. + async fn prepare_serving_engine( + state_dir: &Path, app_capacity: usize, loopback_provider: Option, - ) -> Result<(), Failure> { - let loading = state_dir.clone(); + ) -> Result, Failure> { + let loading = state_dir.to_owned(); let engine = tokio::task::spawn_blocking(move || load_for_serve(&loading, app_capacity)) .await .map_err(|_| "gateway.serve.load-failed")??; @@ -3567,7 +3632,17 @@ mod unix { }; #[cfg(not(feature = "loopback-provider"))] let _ = loopback_provider; - let engine = Arc::new(engine); + Ok(Arc::new(engine)) + } + + async fn serve( + state_dir: PathBuf, + app_socket: PathBuf, + admin_socket: AdminSocket, + app_capacity: usize, + loopback_provider: Option, + ) -> Result<(), Failure> { + let engine = prepare_serving_engine(&state_dir, app_capacity, loopback_provider).await?; // Both paths are checked before either socket is bound. if !app_socket.is_absolute() { return Err("gateway.serve.invalid-app-socket".into()); @@ -3584,22 +3659,25 @@ mod unix { } check_admin_socket(&admin_socket, &SERVE_ADMIN_SOCKET)?; let admin_path = admin_socket.path.as_path(); + // Claim before inspecting/recovering either endpoint. Keep this owner + // until all bound guards have cleaned up after real session settlement. + let _serving = ServingClaim::acquire(&state_dir, &app_socket, admin_path)?; // The admin socket is bound first, so the socket an application // waits for appears last. let admin = bind_recovering_socket(admin_path, "gateway.serve.admin-bind-failed")?; - let admin_bound = BoundSocket::new(admin_path); + let admin_bound = BoundSocket::new(admin_path) + .map_err(|error| Failure::at("gateway.serve.admin-bind-failed", admin_path, error))?; fs::set_permissions(admin_path, fs::Permissions::from_mode(0o600)).map_err(|error| { Failure::at("gateway.serve.admin-permissions-failed", admin_path, error) })?; let app = bind_recovering_socket(&app_socket, "gateway.serve.app-bind-failed")?; - let app_bound = BoundSocket::new(&app_socket); + let app_bound = BoundSocket::new(&app_socket) + .map_err(|error| Failure::at("gateway.serve.app-bind-failed", &app_socket, error))?; fs::set_permissions(&app_socket, fs::Permissions::from_mode(0o660)).map_err(|error| { Failure::at("gateway.serve.app-permissions-failed", &app_socket, error) })?; let recipe_marker = engine_recipe_marker(&state_dir)?; let admin_state_dir = Arc::new(state_dir.clone()); - admin_bound.keep(); - app_bound.keep(); announce_ready(&engine, &recipe_marker); // Separate capacities: the application can fill its own listener but // never take an admin permit. @@ -3616,6 +3694,8 @@ mod unix { let engine = Arc::clone(&app_engine); async move { let _permit = permit; + #[cfg(feature = "testkit-harness")] + auths_gateway::administrative_test_boundary("serve.session-admitted"); Box::pin(app_session(stream, engine.as_ref())).await; } }, @@ -3646,13 +3726,15 @@ mod unix { _ = terminate.recv() => {}, _ = tokio::signal::ctrl_c() => {}, } + #[cfg(feature = "testkit-harness")] + auths_gateway::administrative_test_boundary("serve.draining"); // The listeners have been dropped: no new session can be admitted. // Waiting for permits includes pre-entry and admin sessions, not // just transports already counted by the engine. - let drained = drain_sessions(&app_permits, &admin_permits, app_capacity).await; - let _ = fs::remove_file(&app_socket); - let _ = fs::remove_file(admin_path); - drained + finish_drain(drain_sessions(&app_permits, &admin_permits, app_capacity).await); + drop(app_bound); + drop(admin_bound); + Ok(()) } async fn sweep_periodically(engine: &GatewayEngine) -> ! { @@ -3672,7 +3754,32 @@ mod unix { admin_permits: &Semaphore, app_capacity: usize, ) -> Result<(), Failure> { - let drained = tokio::time::timeout(Duration::from_secs(25), async { + drain_sessions_with_deadline( + app_permits, + admin_permits, + app_capacity, + Duration::from_secs(25), + ) + .await + } + + /// An incomplete drain never releases ownership back into a live process. + /// Exit here while the caller still owns claims, socket guards and tasks; + /// the OS releases locks only when this process has actually terminated. + fn finish_drain(result: Result<(), Failure>) { + if let Err(failure) = result { + eprintln!("{failure}"); + std::process::exit(1); + } + } + + async fn drain_sessions_with_deadline( + app_permits: &Semaphore, + admin_permits: &Semaphore, + app_capacity: usize, + deadline: Duration, + ) -> Result<(), Failure> { + let drained = tokio::time::timeout(deadline, async { let _app = app_permits .acquire_many(u32::try_from(app_capacity).map_err(|_| "gateway.serve.capacity")?) .await @@ -4971,6 +5078,14 @@ mod unix { name: &str, code: &'static str, ) -> Result { + let lock = private_lock_file(&state_dir.join(name)).map_err(|_| code)?; + rustix::fs::flock(&lock, rustix::fs::FlockOperation::LockExclusive).map_err(|_| code)?; + Ok(lock) + } + + /// The same private, stable lock inode policy for administrative and + /// serving coordination; callers select blocking versus prompt admission. + fn private_lock_file(path: &Path) -> Result { let lock = OpenOptions::new() .read(true) .write(true) @@ -4980,17 +5095,15 @@ mod unix { .custom_flags(i32::from_ne_bytes( rustix::fs::OFlags::NOFOLLOW.bits().to_ne_bytes(), )) - .open(state_dir.join(name)) - .map_err(|_| code)?; - let metadata = lock.metadata().map_err(|_| code)?; + .open(path)?; + let metadata = lock.metadata()?; if !metadata.is_file() || metadata.permissions().mode() & 0o077 != 0 || metadata.uid() != rustix::process::geteuid().as_raw() || metadata.nlink() != 1 { - return Err(code); + return Err(std::io::Error::other("unsafe private lock file")); } - rustix::fs::flock(&lock, rustix::fs::FlockOperation::LockExclusive).map_err(|_| code)?; Ok(lock) } @@ -6394,6 +6507,162 @@ mod unix { mod tests { use super::*; + #[tokio::test] + async fn socket_cleanup_preserves_a_replacement_inode() { + let directory = tempfile::tempdir_in("/tmp").expect("private directory"); + let path = directory.path().join("owned.sock"); + let original = UnixListener::bind(&path).expect("original bind"); + let owned = BoundSocket::new(&path).expect("owned identity"); + fs::remove_file(&path).expect("replace pathname"); + let replacement = UnixListener::bind(&path).expect("replacement bind"); + drop(owned); + assert!(UnixStream::connect(&path).await.is_ok()); + drop((original, replacement)); + } + + #[tokio::test] + async fn failed_start_cleans_owned_socket_before_releasing_claims() { + let directory = tempfile::tempdir_in("/tmp").expect("private directory"); + let root = fs::canonicalize(directory.path()).expect("canonical directory"); + fs::set_permissions(&root, fs::Permissions::from_mode(0o700)).expect("private"); + let app = root.join("app.sock"); + let admin = root.join("admin.sock"); + let serving = ServingClaim::acquire(&root, &app, &admin).expect("claim"); + let listener = bind_recovering_socket(&admin, "bind").expect("admin bind"); + let owned = BoundSocket::new(&admin).expect("identity"); + fs::write(&app, b"occupied").expect("fail second bind"); + assert!(bind_recovering_socket(&app, "bind").is_err()); + drop(listener); + drop(owned); + assert!(!admin.exists()); + assert!(ServingClaim::acquire(&root, &app, &admin).is_err()); + drop(serving); + assert!(ServingClaim::acquire(&root, &app, &admin).is_ok()); + assert_eq!(fs::read(app).expect("foreign file remains"), b"occupied"); + } + + #[test] + fn endpoint_directory_claims_serialize_distinct_leaves_and_case_aliases() { + let directory = tempfile::tempdir_in("/tmp").expect("private directory"); + let root = fs::canonicalize(directory.path()).expect("canonical directory"); + fs::set_permissions(&root, fs::Permissions::from_mode(0o700)).expect("private"); + let first = root.join("first"); + let second = root.join("second"); + fs::create_dir(&first).expect("first"); + fs::create_dir(&second).expect("second"); + let app = root.join("app.sock"); + let owner = + ServingClaim::acquire(&first, &app, &first.join("admin.sock")).expect("owner"); + for leaf in ["APP.sock", "different.sock"] { + let error = + ServingClaim::acquire(&second, &root.join(leaf), &second.join("admin.sock")) + .err() + .expect("shared endpoint directory is busy"); + assert_eq!(error.code, "gateway.serve.busy"); + } + drop(owner); + assert!(ServingClaim::acquire(&second, &app, &second.join("admin.sock")).is_ok()); + } + + #[tokio::test] + async fn overdue_drain_child() { + let Some(root) = std::env::var_os("AUTHS_TEST_OVERDUE_DRAIN_ROOT") else { + return; + }; + let root = PathBuf::from(root); + let app = root.join("app.sock"); + let admin = root.join("admin.sock"); + let _serving = ServingClaim::acquire(&root, &app, &admin).expect("claim"); + let app_listener = bind_recovering_socket(&app, "app bind").expect("app"); + let admin_listener = bind_recovering_socket(&admin, "admin bind").expect("admin"); + let _app_owned = BoundSocket::new(&app).expect("app identity"); + let _admin_owned = BoundSocket::new(&admin).expect("admin identity"); + let app_permits = Arc::new(Semaphore::new(1)); + let admin_permits = Semaphore::new(ADMIN_CAPACITY); + let admitted = Arc::clone(&app_permits) + .acquire_owned() + .await + .expect("admitted session"); + let _session = tokio::spawn(async move { + let _admitted = admitted; + std::future::pending::<()>().await; + }); + // As in real shutdown, listeners close before admitted work settles. + drop((app_listener, admin_listener)); + fs::write(root.join("admitted"), b"owned").expect("admission evidence"); + finish_drain( + drain_sessions_with_deadline( + &app_permits, + &admin_permits, + 1, + Duration::from_millis(1), + ) + .await, + ); + panic!("an overdue drain returned into a live owner"); + } + + #[tokio::test] + async fn overdue_drain_exits_with_claims_and_socket_guards_still_owned() { + use std::process::{Command, Stdio}; + let directory = tempfile::tempdir_in("/tmp").expect("private directory"); + let root = fs::canonicalize(directory.path()).expect("canonical directory"); + let mut child = Command::new(std::env::current_exe().expect("test binary")) + .arg("--exact") + .arg("unix::tests::overdue_drain_child") + .arg("--nocapture") + .env("AUTHS_TEST_OVERDUE_DRAIN_ROOT", &root) + .stdout(Stdio::null()) + .stderr(Stdio::piped()) + .spawn() + .expect("child"); + let deadline = std::time::Instant::now() + Duration::from_secs(10); + let status = loop { + if let Some(status) = child.try_wait().expect("child status") { + break status; + } + if std::time::Instant::now() >= deadline { + let _ = child.kill(); + let _ = child.wait(); + panic!("overdue shutdown did not terminate"); + } + tokio::time::sleep(Duration::from_millis(5)).await; + }; + let output = child.wait_with_output().expect("child output"); + assert_eq!(status.code(), Some(1)); + assert!( + String::from_utf8_lossy(&output.stderr) + .contains("gateway.serve.shutdown-incomplete") + ); + assert!(root.join("admitted").exists()); + let app = root.join("app.sock"); + let admin = root.join("admin.sock"); + // If guards dropped before exit, these exact socket inodes would + // have disappeared. OS process exit releases claims without cleanup. + assert!( + fs::symlink_metadata(&app) + .expect("uncleaned app") + .file_type() + .is_socket() + ); + assert!( + fs::symlink_metadata(&admin) + .expect("uncleaned admin") + .file_type() + .is_socket() + ); + let _successor = + ServingClaim::acquire(&root, &app, &admin).expect("OS released claims"); + let app_listener = bind_recovering_socket(&app, "recover app").expect("recover app"); + let _app_owned = BoundSocket::new(&app).expect("new app identity"); + let admin_listener = + bind_recovering_socket(&admin, "recover admin").expect("recover admin"); + let _admin_owned = BoundSocket::new(&admin).expect("new admin identity"); + assert!(UnixStream::connect(&app).await.is_ok()); + assert!(UnixStream::connect(&admin).await.is_ok()); + drop((app_listener, admin_listener)); + } + #[test] #[allow( clippy::too_many_lines, diff --git a/product/runtime/auths-gateway/src/semantic_closure.rs b/product/runtime/auths-gateway/src/semantic_closure.rs index 3d6ff3f6a..5e42101dd 100644 --- a/product/runtime/auths-gateway/src/semantic_closure.rs +++ b/product/runtime/auths-gateway/src/semantic_closure.rs @@ -10,7 +10,7 @@ /// SHA-256 of the schema, a NUL byte, and `semantic-closure.json`. /// Regenerate through `semantic_closure_is_current` with `AUTHS_UPDATE_FIXTURES=1`. pub const GATEWAY_SEMANTIC_CLOSURE_SHA256: &str = - "3fea3b7b2b5b9c94bbdcdf0c0b0a233e97473c8c595f9d21abb78e078c75ad10"; + "aec56a258755908915162ecad9e44075fd94fa80d32ee6dd46a8b765b5dd9d5b"; #[cfg(test)] mod tests { diff --git a/product/runtime/auths-gateway/tests/content_journey.rs b/product/runtime/auths-gateway/tests/content_journey.rs index ea5761781..6f6bfef47 100644 --- a/product/runtime/auths-gateway/tests/content_journey.rs +++ b/product/runtime/auths-gateway/tests/content_journey.rs @@ -1519,21 +1519,22 @@ fn private_capacity_records(state: &Path) -> std::collections::BTreeMap>(); + barrier.wait(); + let mut winner = None; + let mut refused = 0; + for thread in threads { + match thread.join().expect("start joined") { + Served::Started(running) => { + assert!( + winner.replace(running).is_none(), + "only one serving generation" + ); + } + Served::Exited { status, stderr } => { + assert_eq!(status.code(), Some(1)); + assert!(stderr.starts_with("gateway.serve.busy "), "{stderr}"); + refused += 1; + } + } + } + assert_eq!(refused, 1); + assert!(UnixStream::connect(&app).is_ok()); + assert!(UnixStream::connect(&admin).is_ok()); + drop(winner); // SIGKILL releases claims without running owned cleanup. + let restarted = serve(&state, &app, &[]).started(); + assert!(UnixStream::connect(&app).is_ok()); + assert!(UnixStream::connect(&admin).is_ok()); + drop(restarted); +} + +#[test] +fn a_shared_endpoint_is_busy_across_installation_directories() { + let (_directory, root) = private_root(); + let first = root.join("first"); + let second = root.join("second"); + install(&root, &first); + install(&root, &second); + let app = root.join("shared.sock"); + let running = serve(&first, &app, &[]).started(); + // The protected parent is the endpoint allocation unit, including leaf + // aliases on case-insensitive filesystems and distinct leaves everywhere. + for socket in [&app, &root.join("SHARED.sock"), &root.join("other.sock")] { + let stderr = serve(&second, socket, &[]).refused(); + assert!(stderr.starts_with("gateway.serve.busy "), "{stderr}"); + assert!(!second.join("admin.sock").exists()); + } + assert!(UnixStream::connect(&app).is_ok()); + assert!(UnixStream::connect(first.join("admin.sock")).is_ok()); + // Serving locks do not consume the administrative operation lock. + assert!(revoke(&first, &[]).status.success()); + drop(running); +} + +#[cfg(feature = "testkit-harness")] +fn traced_serve(state: &Path, app: &Path) -> (Running, mpsc::Receiver) { + let mut child = Command::new(BIN) + .arg("serve") + .arg("--state-dir") + .arg(state) + .arg("--app-socket") + .arg(app) + .env("AUTHS_TEST_ADMIN_TRACE", "1") + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("traced serve"); + let stdout = child.stdout.take().expect("stdout"); + let stderr = child.stderr.take().expect("stderr"); + let (ready_sender, ready_receiver) = mpsc::channel(); + thread::spawn(move || { + let mut line = String::new(); + BufReader::new(stdout) + .read_line(&mut line) + .expect("readiness"); + let _ = ready_sender.send(line); + }); + let (sender, receiver) = mpsc::channel(); + thread::spawn(move || { + for line in BufReader::new(stderr).lines() { + if sender.send(line.expect("trace line")).is_err() { + break; + } + } + }); + let running = Running(child); + assert!( + ready_receiver + .recv_timeout(DEADLINE) + .expect("bounded readiness") + .starts_with("app socket ready") + ); + (running, receiver) +} + +#[cfg(feature = "testkit-harness")] +fn wait_boundary(trace: &mpsc::Receiver, boundary: &str) { + let deadline = Instant::now() + DEADLINE; + loop { + let line = trace + .recv_timeout(deadline.saturating_duration_since(Instant::now())) + .expect("bounded serving boundary"); + if line.starts_with("auths-test-admin-boundary:") && line.ends_with(boundary) { + return; + } + } +} + +#[cfg(feature = "testkit-harness")] +#[test] +fn replacement_start_is_busy_until_admitted_session_drain_and_cleanup_finish() { + let (_directory, root) = private_root(); + let state = root.join("state"); + install(&root, &state); + let app = root.join("app.sock"); + let (mut running, trace) = traced_serve(&state, &app); + let pending = UnixStream::connect(&app).expect("admitted connection"); + wait_boundary(&trace, "serve.session-admitted"); + assert!( + Command::new("kill") + .arg("-TERM") + .arg(running.0.id().to_string()) + .status() + .expect("SIGTERM") + .success() + ); + wait_boundary(&trace, "serve.draining"); + assert!(running.0.try_wait().expect("still draining").is_none()); + assert!( + UnixStream::connect(&app).is_err(), + "listener is closed before drain" + ); + let stderr = serve(&state, &app, &[]).refused(); + assert!(stderr.starts_with("gateway.serve.busy "), "{stderr}"); + // The failed replacement has neither rebound nor removed the old paths. + assert!(exists(&app)); + assert!(exists(&state.join("admin.sock"))); + drop(pending); + let deadline = Instant::now() + DEADLINE; + loop { + if let Some(status) = running.0.try_wait().expect("drain") { + assert!(status.success()); + break; + } + assert!(Instant::now() < deadline, "drain remained pending"); + thread::sleep(Duration::from_millis(10)); + } + assert!(!exists(&app)); + assert!(!exists(&state.join("admin.sock"))); + let successor = serve(&state, &app, &[]).started(); + drop(running); + assert!(UnixStream::connect(&app).is_ok()); + assert!(UnixStream::connect(state.join("admin.sock")).is_ok()); + drop(successor); +} + +#[test] +fn a_second_bind_failure_cleans_only_its_socket_then_releases_serving_claims() { + let (_directory, root) = private_root(); + let state = root.join("state"); + install(&root, &state); + let app = root.join("occupied.sock"); + fs::write(&app, b"foreign input").expect("occupied endpoint"); + let stderr = serve(&state, &app, &[]).refused(); + assert!( + stderr.starts_with("gateway.serve.app-bind-failed "), + "{stderr}" + ); + assert!(!exists(&state.join("admin.sock"))); + assert_eq!( + fs::read(&app).expect("foreign input remains"), + b"foreign input" + ); + fs::remove_file(&app).expect("remove test input"); + let successor = serve(&state, &app, &[]).started(); + assert!(UnixStream::connect(&app).is_ok()); + assert!(UnixStream::connect(state.join("admin.sock")).is_ok()); + drop(successor); +} + +#[test] +fn absent_application_socket_requires_a_protected_canonical_parent() { + let (_directory, root) = private_root(); + let state = root.join("state"); + install(&root, &state); + let shared = root.join("shared"); + directory(&shared, 0o770); + let app = shared.join("absent.sock"); + let stderr = serve(&state, &app, &[]).refused(); + assert!( + stderr.starts_with("gateway.serve.app-bind-failed "), + "{stderr}" + ); + assert!( + stderr.contains("parent directory must be canonical"), + "{stderr}" + ); + assert!(!exists(&app)); + assert!(!exists(&state.join("admin.sock"))); + assert!(!shared.join(".auths-serving.lock").exists()); + + let real = root.join("real"); + directory(&real, 0o700); + let alias = root.join("alias"); + std::os::unix::fs::symlink(&real, &alias).expect("parent alias"); + let stderr = serve(&state, &alias.join("absent.sock"), &[]).refused(); + assert!( + stderr.starts_with("gateway.serve.app-bind-failed "), + "{stderr}" + ); + assert!( + stderr.contains("parent directory must be canonical"), + "{stderr}" + ); + assert!(!exists(&real.join("absent.sock"))); + assert!(!real.join(".auths-serving.lock").exists()); + assert!(!exists(&state.join("admin.sock"))); +} diff --git a/product/stores/auths-stores/src/lifecycle.rs b/product/stores/auths-stores/src/lifecycle.rs index 6c7549e96..2e68ff40f 100644 --- a/product/stores/auths-stores/src/lifecycle.rs +++ b/product/stores/auths-stores/src/lifecycle.rs @@ -170,14 +170,24 @@ impl LifecycleReader for InMemoryLifecycleStore { /// file, atomically replaces the target, then syncs the parent directory /// before acknowledging durability. This adapter deliberately does not claim /// multi-process safety; the transactional adapter covers that boundary. +/// +/// Any persistence failure makes this instance unavailable, including reads and +/// exact replay. A replacement may already have happened before the error; +/// reopen the store to validate and recover its authoritative file snapshot. pub struct PersistentLifecycleStore { path: PathBuf, rules: Vec, maximum_records: usize, - database: Mutex, + database: Mutex, fault: Mutex>, } +/// Persistence uncertainty belongs to the same owner as the usable snapshot. +enum PersistentDatabase { + Usable(LifecycleDatabase), + Unavailable, +} + impl PersistentLifecycleStore { /// Opens or creates a bounded canonical lifecycle database. /// @@ -203,7 +213,7 @@ impl PersistentLifecycleStore { path, rules, maximum_records, - database: Mutex::new(database), + database: Mutex::new(PersistentDatabase::Usable(database)), fault: Mutex::new(None), }) } @@ -212,12 +222,14 @@ impl PersistentLifecycleStore { /// /// # Errors /// - /// Returns [`StoreError::Unavailable`] if the process lock is poisoned. + /// Returns [`StoreError::Unavailable`] after any persistence failure or if + /// the process lock is poisoned. Reopen to recover the retained file. pub fn load(&self, workflow: &WorkflowId) -> Result, StoreError> { - self.database - .lock() - .map(|database| database.records.get(workflow).cloned()) - .map_err(|_| StoreError::Unavailable) + let database = self.database.lock().map_err(|_| StoreError::Unavailable)?; + match &*database { + PersistentDatabase::Usable(database) => Ok(database.records.get(workflow).cloned()), + PersistentDatabase::Unavailable => Err(StoreError::Unavailable), + } } #[cfg(test)] @@ -228,20 +240,32 @@ impl PersistentLifecycleStore { impl LifecycleStore for PersistentLifecycleStore { fn transact(&self, transaction: &StoreTransactionV1) -> Result { - let mut database = self.database.lock().map_err(|_| StoreError::Unavailable)?; + let mut state = self.database.lock().map_err(|_| StoreError::Unavailable)?; + let PersistentDatabase::Usable(database) = &mut *state else { + return Err(StoreError::Unavailable); + }; let path = self.path.clone(); let fault = self .fault .lock() .map_err(|_| StoreError::Unavailable)? .take(); - transact_database( - &mut database, + let mut persistence_failed = false; + let result = transact_database( + database, &self.rules, self.maximum_records, transaction, - |next| persist_database(&path, next, fault), - ) + |next| { + let result = persist_database(&path, next, fault); + persistence_failed = result.is_err(); + result + }, + ); + if persistence_failed { + *state = PersistentDatabase::Unavailable; + } + result } } @@ -1776,6 +1800,25 @@ mod tests { ), Err(StoreError::Unavailable) )); + // An error is not proof that replacement did not happen. The same + // live owner must neither acknowledge old replay nor rewrite it as + // part of an unrelated workflow's next snapshot. + let retained = fs::read(&path).unwrap(); + assert!(matches!( + store.load(&WorkflowId::parse("workflow-1").unwrap()), + Err(StoreError::Unavailable) + )); + let mut replay = decision_transaction("workflow-1", Some(6)); + replay.expected_revision = Some(1); + assert!(matches!( + execute_store_transaction(&store, &replay), + Err(StoreError::Unavailable) + )); + assert!(matches!( + execute_store_transaction(&store, &decision_transaction("workflow-2", Some(1))), + Err(StoreError::Unavailable) + )); + assert_eq!(fs::read(&path).unwrap(), retained); drop(store); let reopened = PersistentLifecycleStore::open(&path, rules(), 16).unwrap(); assert_eq!( @@ -1786,9 +1829,47 @@ mod tests { .state(), expected_state ); + execute_store_transaction(&reopened, &decision_transaction("workflow-2", Some(1))) + .unwrap(); + assert_eq!( + reopened + .load(&WorkflowId::parse("workflow-1").unwrap()) + .unwrap() + .unwrap() + .state(), + expected_state + ); } } + #[test] + fn rejected_transition_does_not_make_persistent_store_unavailable() { + let directory = tempfile::tempdir().unwrap(); + let path = directory.path().join("lifecycle.store"); + let store = PersistentLifecycleStore::open(&path, rules(), 16).unwrap(); + execute_store_transaction(&store, &decision_transaction("workflow-1", Some(6))).unwrap(); + assert!(matches!( + execute_store_transaction( + &store, + &transaction("workflow-1", Some(99), TransitionCommandV1::Reserve, 11), + ), + Err(StoreError::Conflict) + )); + assert_eq!( + store + .load(&WorkflowId::parse("workflow-1").unwrap()) + .unwrap() + .unwrap() + .revision(), + 1 + ); + execute_store_transaction( + &store, + &transaction("workflow-1", Some(1), TransitionCommandV1::Reserve, 11), + ) + .unwrap(); + } + #[test] fn production_pool_and_server_identity_are_bounded() { for duration in [Duration::ZERO, Duration::from_nanos(999_999)] { diff --git a/qualification/security_assessment/operations.py b/qualification/security_assessment/operations.py index 3809ed1b4..f17fab91c 100644 --- a/qualification/security_assessment/operations.py +++ b/qualification/security_assessment/operations.py @@ -138,6 +138,8 @@ def crash(): process.kill() process.wait(timeout=5) operator.processes.remove((process, log, host)) + if process.stdout is not None: + process.stdout.close() log.close() steps.append({'command': 'SIGKILL owned gateway0 PID; wait', 'elapsed_seconds': time.monotonic() - started}) @@ -147,7 +149,7 @@ def crash(): started = time.monotonic() operator.start_gateway(0) steps.append({'command': 'serve --state-dir /run/demo/gateway0 ' - '--app-socket /run/demo/sockets/app0.sock --loopback-provider ', + '--app-socket /run/demo/sockets/gateway0/app.sock --loopback-provider ', 'elapsed_seconds': time.monotonic() - started}) replay = campaign.frame(frame(label))['response'] assert replay['outcome'] == 'unknown', 'crash strengthened unrecorded provider result' diff --git a/qualification/security_assessment/stripe_probe.py b/qualification/security_assessment/stripe_probe.py index 47f580530..f0c85f316 100644 --- a/qualification/security_assessment/stripe_probe.py +++ b/qualification/security_assessment/stripe_probe.py @@ -140,7 +140,7 @@ def run(self, name, families, action): def frame(self, value, host=0, length=None): raw = value if isinstance(value, bytes) else canonical(value) request = {'kind': 'frame', 'payload': b64(raw), - 'socket': '/run/demo/sockets/app' + str(host) + '.sock'} + 'socket': str(self.operator.app_sockets[host])} if length is not None: request['length'] = length return self.invoke(request) @@ -394,7 +394,7 @@ def main(): except Exception as failure: if args.suite == 'reference': doctor = subprocess.run([str(operator.binary), 'doctor', '--state-dir', '/run/demo/gateway0', - '--app-socket', '/run/demo/sockets/app0.sock', + '--app-socket', str(operator.app_sockets[0]), '--app-uid', str(APP_UID), '--app-gid', str(APP_GID)], capture_output=True, env=ENV, timeout=30) readiness = json.loads(doctor.stdout) if doctor.stdout else {} diff --git a/release/semantic-freeze-versions.toml b/release/semantic-freeze-versions.toml index cf7c2d941..7366d1b62 100644 --- a/release/semantic-freeze-versions.toml +++ b/release/semantic-freeze-versions.toml @@ -1,4 +1,4 @@ -freeze_version = 443 +freeze_version = 445 # Semantic identity counters live outside the xtask source tree deliberately. # The formal source closure binds xtask's executable code, while the semantic @@ -7,7 +7,7 @@ freeze_version = 443 # converge. This file is a reviewed release input, never an automatic output. [entries] "auths.core.protocol" = 37 -"auths.frozen-bytes/architecture/dependency-graph.json" = 82 +"auths.frozen-bytes/architecture/dependency-graph.json" = 83 "auths.frozen-bytes/bindings/wasm/auths-proof-wasm/identity-abi-v1.json" = 4 "auths.frozen-bytes/bounded-domains.toml" = 2 "auths.frozen-bytes/core/conformance/v1/manifest.json" = 2 @@ -16,10 +16,10 @@ freeze_version = 443 "auths.frozen-bytes/core/fixtures/v1/manifest.json" = 16 "auths.frozen-bytes/core/formal-vectors/v1/manifest.json" = 1 "auths.frozen-bytes/demos/benchmarks/profiles/release.toml" = 1 -"auths.frozen-bytes/formal/assurance-manifest-v1.toml" = 68 +"auths.frozen-bytes/formal/assurance-manifest-v1.toml" = 70 "auths.frozen-bytes/formal/qualification/aeneas/generated" = 20 "auths.frozen-bytes/formal/qualification/aeneas/qualification.toml" = 17 -"auths.frozen-bytes/formal/qualification/aeneas/source-closure.json" = 113 +"auths.frozen-bytes/formal/qualification/aeneas/source-closure.json" = 115 "auths.frozen-bytes/product/conformance/v1/mechanism-profile-conformance.json" = 1 "auths.frozen-bytes/product/conformance/v1/simplified-product-waist.json" = 4 "auths.frozen-bytes/product/fixtures/v1/bounded-policy/manifest.json" = 3 @@ -47,7 +47,7 @@ freeze_version = 443 "auths.frozen-bytes/product/integrations/auths-stripe/fixtures/v1/manifest.sha256.json" = 1 "auths.identity.protocol" = 175 "auths.modular-components" = 22 -"auths.portable-abi-bindings" = 134 +"auths.portable-abi-bindings" = 135 "auths.product.bounded-domains" = 21 "auths.product.bounded-policy" = 6 "auths.product.configuration-commitments" = 1 @@ -56,7 +56,7 @@ freeze_version = 443 "auths.product.external-custody" = 7 "auths.product.facade" = 26 "auths.product.github-issue-address-v2" = 4 -"auths.product.lifecycle" = 17 +"auths.product.lifecycle" = 18 "auths.product.mcp-closed-execution" = 32 "auths.product.mechanism-profile-conformance" = 13 "auths.product.operations" = 7 @@ -66,5 +66,5 @@ freeze_version = 443 "auths.product.simplified-waist" = 20 "auths.product.vocabulary" = 31 "auths.release.benchmark-contract" = 1 -"auths.release.evolution-contract" = 91 -"auths.release.public-surface" = 443 +"auths.release.evolution-contract" = 92 +"auths.release.public-surface" = 445 diff --git a/release/semantic-freeze.json b/release/semantic-freeze.json index 536d65df3..00b0e9f94 100644 --- a/release/semantic-freeze.json +++ b/release/semantic-freeze.json @@ -1,6 +1,6 @@ { "schema": "auths.semantic-freeze/1", - "freezeVersion": 443, + "freezeVersion": 445, "publicSurface": { "rustRoots": [ "auths", @@ -94,7 +94,7 @@ }, { "id": "auths.frozen-bytes/architecture/dependency-graph.json", - "version": 82, + "version": 83, "classification": "frozen-bytes", "categories": [ "canonical-generated-evidence" @@ -102,7 +102,7 @@ "owners": [ "architecture/dependency-graph.json" ], - "sha256": "8cc7b3f1ddd63f66119731ce6aebed12e3a5b46036cfcbd8dd43aa9018e88328" + "sha256": "d7b68ec068946c67ae662f0b508dd0182705c2770159a142d9e1554e34d3d155" }, { "id": "auths.frozen-bytes/bindings/wasm/auths-proof-wasm/identity-abi-v1.json", @@ -202,7 +202,7 @@ }, { "id": "auths.frozen-bytes/formal/assurance-manifest-v1.toml", - "version": 68, + "version": 70, "classification": "frozen-bytes", "categories": [ "canonical-generated-evidence" @@ -210,7 +210,7 @@ "owners": [ "formal/assurance-manifest-v1.toml" ], - "sha256": "7bef5156dc7d773bc926f912ef7b555a58bc84d32e840fb390719cd1c3df1f5a" + "sha256": "235dd0d0ed0dec997687910cb0b1dd3b63fd7be89defea23aa96c1b4986ece78" }, { "id": "auths.frozen-bytes/formal/qualification/aeneas/generated", @@ -238,7 +238,7 @@ }, { "id": "auths.frozen-bytes/formal/qualification/aeneas/source-closure.json", - "version": 113, + "version": 115, "classification": "frozen-bytes", "categories": [ "canonical-generated-evidence" @@ -246,7 +246,7 @@ "owners": [ "formal/qualification/aeneas/source-closure.json" ], - "sha256": "61f59c73a60651aa20d5eaed05c70bc4049297ca17cddadcfca4c7a8735a7791" + "sha256": "5d28574c07c11141300e80ebb7c5c20079a77f12812a1856736b510acb53e320" }, { "id": "auths.frozen-bytes/product/conformance/v1/mechanism-profile-conformance.json", @@ -611,7 +611,7 @@ }, { "id": "auths.portable-abi-bindings", - "version": 134, + "version": 135, "classification": "frozen-meaning", "categories": [ "portable-abi", @@ -631,7 +631,7 @@ "core/crates/auths-model/src/lib.rs", "core/spec/v1/auths-proof.cddl" ], - "sha256": "255bbda31e13850c157395ddea7778abdc4fe71fe2a1aff2c28c6241d10d81cd" + "sha256": "b9d35f9dbd9b42e03be758bc79587b1fc965b57e88a1d5bb413513507335c2ff" }, { "id": "auths.product.bounded-domains", @@ -784,7 +784,7 @@ }, { "id": "auths.product.lifecycle", - "version": 17, + "version": 18, "classification": "frozen-meaning", "categories": [ "reservation-state", @@ -801,7 +801,7 @@ "product/stores/auths-stores/tests/postgres_lifecycle.rs", "product/stores/auths-stores/tests/postgres_tls" ], - "sha256": "c820ceb9640850fb52d9afe5b08fd8cfe1d81fd96dc0356f70a1c8a26ce23a36" + "sha256": "6e523eba4e795dcc102dac7a625ecd909f1e1e49a8c5fe8f28b2212c7fc5e120" }, { "id": "auths.product.mcp-closed-execution", @@ -986,7 +986,7 @@ }, { "id": "auths.release.evolution-contract", - "version": 91, + "version": 92, "classification": "frozen-meaning", "categories": [ "version-axes", @@ -1007,11 +1007,11 @@ "release/fixtures/evolution", "xtask/src/evolution_policy.rs" ], - "sha256": "2045b4332aca80b02573acc3fe48eca64e6c6d69d8428aed3a0651ef03df7a29" + "sha256": "b5e9bff206946d068b775c53b160dc29d2ecf9237d62398d7e0c48e685669171" }, { "id": "auths.release.public-surface", - "version": 443, + "version": 445, "classification": "release-metadata", "categories": [ "package-names", @@ -1104,7 +1104,7 @@ "xtask/src/release_launch.rs", "xtask/src/semantic_freeze.rs" ], - "sha256": "53f787ef826628a8a506adf9cb48556d3642cebd50f9164a8d6fa68f721549d2" + "sha256": "6c54830daa19f0115771333d2d44587237774863f9c181fb0d8c07c5329cc3c4" } ] } diff --git a/xtask/src/checks.rs b/xtask/src/checks.rs index 3d8b7c097..9ecfa84bc 100644 --- a/xtask/src/checks.rs +++ b/xtask/src/checks.rs @@ -27,6 +27,7 @@ pub(crate) fn ci_preflight() -> Result<(), String> { "--workspace", "--all-targets", "--all-features", + "--keep-going", "--", "-D", "warnings",