Skip to content

Strengthen Zero Trust safety, receipt recovery and wallet Host contracts - #14

Merged
GTrunSec merged 28 commits into
mainfrom
feat/scoped-receipt-realization
Nov 7, 2026
Merged

GTrunSec merged 28 commits into
mainfrom
feat/scoped-receipt-realization

Conversation

@GTrunSec

@GTrunSec GTrunSec commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

A valid authorization or historical receipt can coexist with changed execution state. This PR strengthens shared Zero Trust admission, source-bound receipt recovery and wallet Host containment so authorization changes, crashes and retries cannot silently reset prior consumption.

Shared authorization and recovery

  • Strengthen the existing Zero Trust framework with safe-source and all-successor invariant requirements, preserving its original checks. Instantiate finite-history preservation on real OAuth issuance/refresh/revocation steps and shared delegated-budget reserve/revoke steps. Historical token associations, exact root authority, prior debits and committed revocations remain intact; typed POO reservation receipts bind the existing allocator.
  • Bind receipt realization and restoration to exact decoded outcomes, signed bytes, operation, receiver/provider/witness authority, version and independent source association. Missing, substituted and cross-operation/authority mappings are refused. Historical receipt restoration grants no current execution authority.
  • Reject incomplete OAuth recovery images instead of defaulting a missing effect inventory to empty or a missing writer cut to zero. Reject duplicate access digests and operation keys (including escaped aliases), empty operation keys, malformed intents and key/intent mismatch. The duplicate-operation check runs before another value is decoded. Normal serialized images and explicit bootstrap encoding are unchanged; incomplete older images are refused.
  • Add a structural restoration Contract and a finite history combining actual typed fresh reservations with existing reconciliation, takeover, revocation and staged/durable recovery transitions. Prior unknown-operation holds and operation uniqueness survive interleavings with unrelated work. Native DPoP/mTLS controls persist a real reservation, lose its reply, reject malformed images without repair, add another legitimate operation, and retain the original signed-intent identity through three takeovers and revocation without redispatch.
  • Replace baseline policy/Case names with authorization-specific names and remove an unused procurement alias. Sixteen of 52 frozen fingerprints change only after inverse renaming reconstructs every original SHA-256; the other 36 remain byte-identical. Expected decisions and negative controls are retained.

Wallet Host and disclosed-chain replay

  • Compose containment, current registrar/fact authority, Zero Trust refinement and the existing signing Contract in PaymentHost. Bind wallet/network identity, quarantine delegation, couple pause to Gateway revocation, retain consumed nonces/unknown exposure, bind the exact before/after journal and acknowledgment, and recheck current authority and decoded bytes at logical handoff. Finite modeled control traces refuse further signing after pause; clearing does not resume payments.
  • Audit all eight original Host premises and retain lying-ack, old-state replay and disagreeing-codec counterexamples. Reuse the admitted Attackers family and shared checked-writer Scenario. The disclosed-chain replay has fourteen checkpoints and three lanes: unchecked, guarded-clean and guarded-prior-exposure, with computed new-intent counts 4/0/0. Previously signed/delegated exposure remains visible; a legitimate signer dispatches once and refuses repeat.
  • Keep the source-classified Org/D2/SVG/PNG views, all 42 computed checkpoints, 37 deterministic Quint controls, four depth-12 safety checks and seven required depth-4 countermodels. The undisclosed infection/AI mechanics and native multichain/signing premises remain explicit. No new image codec, tracked trace artifact or dependency is introduced.

Research and proof boundaries

The research review distinguishes continuation-aware delegated review, FAPI protocol goals, semantic-inference limitations, AAT/experimental ARCP runtime assumptions and RIFL completion-metadata requirements. The contribution is finite modeled safety; it does not inherit a discounted-utility theorem, prove liveness or exactly-once delivery, authenticate arbitrary well-formed replacement snapshots, or establish physical power-loss/external-IO atomicity. Current-head selection, protected storage, signature verification, complete mediation/key custody and chain finality remain independently qualified boundaries. Full-domain replay is a regression gate, not a claim of a complete application invariant for every domain.

Concurrent reconciliation re-crash at e9a33e2

The native subprocess replay stops two workers after the winner's receiver commit, restarts them after revocation and two writer/receiver takeovers, and kills worker B inside reconciliation at either staged or durable persistence. Worker A confirms that the OAuth writer lock is held by another process and attempts a correctly signed conflicting outcome. After B is killed, a third writer/receiver takeover fences the old writer and replica. Restarted workers then exercise conflict-first and original-first schedules followed by a concurrent repeat phase with independent original-receipt reconciliation, conflict attempts and duplicate submissions.

The Lean Contract proves that a completed independent receiver reconciliation retains the exact committed outcome across a later handoff. Four finite staged/durable and order combinations each compare eight Lean-derived snapshots with the Rust subprocess replay. The staged boundary leaves reconciliation unresolved; the durable boundary retains the original outcome. This is local simulated persistence and SIGKILL under controlled schedules, not a proof for every interleaving, physical power loss, or an external payment rail.

Exact head e9a33e2220d84c6129cda6c0ae48acc9b943702b passed 16 automatic CI jobs; manual history-comparison was skipped. Ubuntu executed all four new subprocess trajectories and the full Gateway gate; the 51-domain continuous replay covered 1,253 Cases and 28,989 lifecycle outcomes in 101.25 seconds under the unchanged 120-second limit. Local focused Lean, all four new trajectories, ASP and strict Clippy passed. Three local full-Gateway attempts did not close: two failed the existing 10-second worker-marker wait and one hit the existing 120-second recovery watchdog. Those failures are retained; no threshold, assertion or negative control was relaxed.

Concurrent restarted payment recovery at 4a4a548

After a winner's durable OAuth reservation or receiver commit, two worker processes are stopped and restarted following revocation and two writer/receiver takeovers. They independently obtain receiver evidence. Four finite schedules cover each crash boundary with conflict-first and original-first ordering, followed by a shared release for concurrent repeated reconciliation, conflict attempts and duplicate submissions. The conflicting outcome is correctly provider-signed and differs from the original. The original receiver receipt remains exact and idempotent; absent evidence remains unresolved; stale writers and replicas are fenced and duplicate submission does not resend.

The Lean Contract proves an independently committed receiver outcome cannot be replaced by an unobserved outcome. Each of the four schedules compares six Lean-derived snapshots with the native subprocess replay. The scheduler controls two finite orders and releases the repeat phase concurrently; it does not establish all possible interleavings or physical power-loss or external payment-rail atomicity.

Exact head 4a4a548c0f2facb70588f5e3a3a87737be4d267a passed all 16 automatic CI checks; the manually dispatched history-comparison job was skipped. Ubuntu's 51-domain continuous replay covered 1,253 Cases and 28,989 lifecycle outcomes in 59.40 seconds under the unchanged 120-second limit. The clean local full Gateway gate passed: the four new subprocess schedules took 6.27 seconds and the existing bounded recovery checks took 103.78, 29.06 and 45.22 seconds. Two preceding local attempts hit the existing 120-second watchdog in the older recovery trace; those failures remain evidence. No timeout, assertion, or negative control was relaxed.

Restarted payment workers at 66263b8

After the winner's durable OAuth reservation or receiver commit, two separately identified worker processes observe the protected state and are killed. The authority promotes a receiver and rotates the writer. Restarted worker A independently reconciles: for committed receiver evidence it is killed after the OAuth reconciliation is durable but before the response; for missing evidence the operation remains unresolved. Following revocation and a second receiver promotion and writer rotation, restarted worker B independently reconciles or preserves the missing outcome. A subsequent restart with A's old writer is fenced. The original signed receipt cannot be replaced by a conflicting valid receipt, the charge and hold remain, and retries cannot resend after revocation.

The Lean Contract proves two accepted recovery steps preserve existing holds and budget reservations and cannot reopen a burned operation. For each of the two crash boundaries, the native subprocess replay compares eight Lean-derived snapshots including event, worker, writer, receiver cut, charge, receiver commitment and reconciliation status. This is local simulated persistence with SIGKILL; it does not establish physical power-loss or external payment-rail atomicity.

Exact head 66263b8b9ef63bb1b235dfa29d4a4d912cbc3d17 passed 16 automatic CI checks; the manual history-comparison job was skipped. The Ubuntu 51-domain continuous replay covered 1,253 Cases and 28,989 lifecycle outcomes in 85.50 seconds under the unchanged 120-second limit. The full local Gateway gate passed, with bounded recovery checks in 108.09, 20.05 and 35.68 seconds. No existing timeout or negative control was relaxed.

Post-winner contenders at ddb9cca

The Lean Contract proves that a later admitted payment retains a prior OAuth hold and that refreshing the OAuth effect view cannot make a stale shared-budget revision current. The finite fixture prepares two distinct operations and sender observations against the first winner's exact OAuth image and budget, verifies each is individually admissible, and tests the losing revision against the second winner's updated image. A refreshed budget revision is admissible in the ample-capacity case. DPoP uses fresh proof IDs; mTLS uses its channel identity.

The native local-store replay commits a 30-unit payment with a lost receiver acknowledgment, then starts two workers from its current OAuth pin and budget, each attempting a 60-unit purchase under a 100-unit root cap. One is admitted; the other remains unreserved, and its retry with a refreshed pin is refused by the remaining cap. The first receiver receipt remains available for idempotent independent reconciliation. These are finite model and local simulated-storage observations, not evidence of physical power-loss or external payment-rail atomicity.

Exact head ddb9cca58528d88b330b60a06c2444c087dcf1fa passed 16 automatic CI jobs; the manual history-comparison job was skipped. Its Ubuntu 51-domain continuous replay covered 1,253 Cases and 28,989 lifecycle outcomes in 101.22 seconds under the unchanged 120-second limit. A clean local checkout of this exact head passed the full Gateway gate, with bounded recovery checks in 104.08, 26.54 and 42.02 seconds.

The earlier 8987b78 Core CI failed the repository's file-responsibility gate; the replay was split into an owner module, and the final head passed the unchanged ASP and CI gates. A local full Gateway run at f14a08c timed out in the original recovery trace under the unchanged 120-second watchdog; that failure is retained. Another local pass was made while concurrent, uncommitted edits entered the workspace and recompiled later tests; it is not treated as a clean final-head result. No timeout, assertion, or negative control was relaxed.

Payment recovery and validation at afa5d1e

At afa5d1e292fc9e16e456917beaea530cb118ced4, a two-worker delegated payment race retains one charge after a lost receiver acknowledgment, then exercises two receiver promotions and writer rotations, stale-writer and stale-replica fencing, independent receipt recovery, missing and conflicting signed receipts, and idempotent reconciliation. The Lean Contract proves the losing shared-budget revision is refused; a finite Contract fixture checks both budget views after a winning reservation, with sufficient remaining capacity and a refreshed-revision positive control. An audit-requested native control revokes only the OAuth grant while leaving the Commerce mandate active and budget sufficient, then refuses a fresh operation and proof without a new reservation or charge.

The exact head passed 16 automatic CI jobs; the manually triggered history-comparison job was skipped. Ubuntu's continuous 51-domain replay covered 1,253 Cases and 28,989 lifecycle outcomes in 84.69 seconds under the unchanged 120-second limit. The same head's Ubuntu Gateway job passed both process-crash windows and all original recovery gates; the main two-order recovery trace completed in 92.70 seconds.

Local focused Lean and Rust controls passed, and a mutation that omitted OAuth revocation made the new refusal assertion fail as expected. Local full Gateway attempts at this head timed out under the existing 120-second recovery watchdog or failed an existing worker-marker wait; those failures remain evidence. A later local full Gateway rerun on the unchanged head passed all gates; its three bounded recovery checks completed in 91.28, 25.78 and 43.45 seconds. A separate original recovery trace passed in 93.62 seconds. Earlier failed samples are retained; these passing reruns do not identify the cause of the failures. A buffered-read experiment was discarded after a later sample timed out; no threshold or control was weakened. The simulations use trusted local persistence, test threads, and subprocess SIGKILL rather than physical power-loss or an external payment rail.

The earlier validation below is retained as historical evidence for its stated revision, not as proof for the current head.

Historical validation

  • Exact head d916928 passes all 16 automatic CI checks, including Ubuntu/macOS rendering and Python bindings, complete Lean/Rust, Healthcare recovery-replay, native performance/resources and all security/full-domain gates. The optional manually dispatched history comparison is skipped. Actual Ubuntu logs contain the new inventory/interleaving laws, all 3 native restoration controls, 137 passing library tests, full 51-domain counters, all 125 recovery observations and all 22 receipt-restoration observations; no earlier head is substituted.
  • Local concrete Lean models, structural/negative Contract Cases and final interleaving laws pass, including direct checks under the original 120-second, 2048-MiB and heartbeat limits. No new axiom or sorry is introduced.
  • Local runtime validation passes 137 library tests; the 9 default-ignored controls remain explicitly separate. The new 3 native restoration tests and strict Clippy pass. Both omitted-field defects have retained failing pre-fix evidence.
  • Original dedicated recovery gates pass in 81.05, 23.48 and 45.33 seconds, preserving all 125 recovery observations and 22 receipt-restoration observations, source identities, fencing, missing/conflict refusal and no resend.
  • Local full-domain replay passes 51 entries, 211 groups, 1,253 Cases, 39 refusals, 28,989 continuous outcomes, 3,759 publications and 208 gains. The full continuous batch exits naturally in 75.80 seconds with 114,524,160-byte peak RSS under the original 120-second resource gate. This is whole-suite evidence, not a single-call latency or speedup claim.
  • Original process/drain, heap/heartbeat, worker-wait, fault-round, fingerprint and negative controls remain unchanged. Prior failed/non-winning samples are retained. Documentation stays English only; the PR remains draft, open and unmerged.

@GTrunSec GTrunSec changed the title Bind scoped symbolic receipts and clarify baseline policy identities Bind scoped receipts and verify wallet containment across recovery Nov 5, 2026
@GTrunSec GTrunSec changed the title Bind scoped receipts and verify wallet containment across recovery Bind scoped receipts and constrain wallet Host handoff Nov 5, 2026
@GTrunSec GTrunSec changed the title Bind scoped receipts and constrain wallet Host handoff Strengthen Zero Trust safety, receipt recovery and wallet Host contracts Nov 5, 2026
@GTrunSec
GTrunSec marked this pull request as ready for review November 7, 2026 14:45
@GTrunSec
GTrunSec merged commit dbe3efd into main Nov 7, 2026
17 checks passed
@GTrunSec
GTrunSec deleted the feat/scoped-receipt-realization branch November 7, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant