Repository navigation
Conversation
…eal key The tutorial and replay --demo-app run on MockMed, a synthetic app, but their receipt.json was signed with this computer's Seal key and could say VERIFIED. A record/run/v1 receipt has no field that marks a run as synthetic, and the receiver's registry decides what a key means, so a receiver that pins this computer would take it as proof about a real system. These runs are now signed with a separate demo key under <seal home>/demo (never the Seal key or OPENADAPT_SEAL_KEY). Receivers that pin this computer refuse them (unknown_signer), and pinning the demo key with the existing demo role shows 'Demo key: checks only in this demo'. A countersignature by the real key is refused as mixed_demo. No schema change: the demo role already exists in every verifier. write_receipt_record and receipt_after_run take synthetic=True; the tutorial and _finish_replay (when --demo-app) pass it. Passing another signer with synthetic=True is refused.
serve-execute signed every seal with the worker's key, including seeded synthetic MockMed projections (VERIFIED at independent system-of-record strength) and in-process web replays, which only ever drive the worker's bundled MockMed. A client pinning /health's issuer_key_fingerprint would take those as proof about a real system. The worker now holds a demo key under <data dir>/demo. A dispatch is demo-signed when the admission is synthetic or the result says it ran on the demo app (DispatchResult.demo_app, set by the synthetic runner and the in-process replay); faults after a synthetic admission too. /health adds demo_key_fingerprint; demo seals carry X-OpenAdapt-Demo and a banner on the seal page. serve-reward --seed-mockmed signed the synthetic contract's certificate and every reward receipt with the worker's data-dir key. Seeding and a worker serving a seeded contract now use <data dir>/demo.
Independent adversarial review: REQUEST CHANGESFrom: Grok The design is the right one: a receipt for a run on a synthetic app must not be signed with this computer's Seal key, or anyone who pins that key will treat a tutorial or MockMed result as proof about a real system. The unique work (against merge-base This head is not mergeable: required CI is red, including gitleaks and the engine-generality lint, and the branch is well behind Blockers
TestsIn this worktree I ran I am not merging. A release decision, if any, still sits with the maintainer after CI is green. |
Problem
openadapt-flow tutorialandreplay --demo-apprun on MockMed, a synthetic app. Theirreceipt.jsonwas signed with this computer's Seal key, and it could say VERIFIED. Arecord/run/v1receipt has no field that marks a run as synthetic, and a key's role comes from the receiver's registry. So anyone who pins this computer's key (for handoffs, say) would take a tutorial receipt as proof about a real system. (Found while closing the A2A handoff gaps in #2830.)Fix (run receipts)
Runs on a synthetic app are signed with a separate demo key, kept under
<seal home>/demo. It is never the Seal key and never a key fromOPENADAPT_SEAL_KEY. This uses thedemorole that every verifier already has, so there is no schema change:unknown_signer), and so doesopenadapt verifyby default.demosees "Demo key: checks only in this demo". The handoff verdict adds "A demo key signed it: it checks only inside that demo".mixed_demo), so a demo receipt can't be upgraded.write_receipt_recordandreceipt_after_runtakesynthetic=True. The tutorial passes it, and so does_finish_replaywhen--demo-appis set.synthetic=Truetogether with an explicitsigneris refused. The terminal note says "receipt (demo key, synthetic app; it proves nothing about a real system)".I chose this over adding a signed "synthetic" field to
record/run/v1because it closes the hole with no change to the shared format, and it fails closed for every existing receiver.Fix (Execute and reward workers)
serve-executesigned every seal with the worker's key, including the seeded synthetic MockMed projections. Those report VERIFIED at independent system-of-record strength. It also signed in-process web replays, which only ever drive the worker's bundled MockMed. A client that pinned/health'sissuer_key_fingerprintwould take those seals as proof about a real system.<data dir>/demo.synthetic, or when the result hasdemo_appset; the synthetic runner and the in-process replay both set it. Fault seals after a synthetic admission are demo-signed too./healthaddsdemo_key_fingerprint.X-OpenAdapt-Demo: synthetic-demo-app, and the seal page shows a "Demo key" banner.--configon another backend are unchanged and still signed with the worker's key.serve-reward --seed-mockmedsigned the synthetic contract's certificate and every reward receipt with the worker's data-dir key. Seeding now uses<data dir>/demo, and so does a worker that serves any seeded contract.Tests.
tests/test_execute_demo_key.pyhas 7 tests:serve-reward --seed-mockmedsigns with the demo key.The existing MockMed seal test now expects the demo key, and the in-process replay test asserts
demo_app. Negative control: with the service always signing with the worker key, 6 tests fail. All Execute, reward and JIT dispatch suites: 193 passed. ruff and mypy are clean.Tests (run receipts)
tests/test_synthetic_receipts.pyhas 7 tests:OPENADAPT_SEAL_KEYnever signs a synthetic run;mixed_demo.tests/test_tutorial_demo_app_replay.pyrunstutorialand thenreplay --demo-appheadless on MockMed, and asserts both receipts are demo-signed and refused by this computer's pin. Negative control: with the tutorial change undone, this test fails because the Seal key signed the receipt.test_cli_seal.py::test_a_qualified_bundle_seals_and_must_be_certified_again, a qualification frame check). It passed when run alone on this branch twice and on main twice, so I think it's a flake.Not covered
get_handoffrefuse them.