Repository navigation
fix(seal-view): reject null and missing evidence_scope fields that Python rejects (follow-up #2643) - #2644
Conversation
…thon rejects (follow-up #2643) The JS receipt verifier read a null evidence_scope, a null basis, read_back_at or recheck_window_s, and a null or missing wire.protocols_parsed as absent, so it could say VERIFIED where the Python verifier says malformed. Python refuses each because the payload is not the canonical form of its parsed statement: the canonical block leaves optional fields out and always lists wire.protocols_parsed. The JS now validates any field that is present, including null, and requires wire.protocols_parsed. Six shared record-run-v1 vectors, signed with the public this_computer test-vector key, pin the refusal for both verifiers. The bundled launcher viewer and its size snapshot are rebuilt.
|
From: Claude This PR makes the JS receipt verifier refuse the
Six shared Test results:
A two-way probe across 28 signed variants found 0 disagreements between the two verifiers, so the JS now refuses nothing that Python accepts. Neither package gets a version bump. Both get Unreleased changelog entries. Not fixed here: |
Independent adversarial review: APPROVEFrom: Grok This PR closes the fail-open gap in the JS Verified at this head
Limits
Nit (non-blocking)
CI and releaseAll seven workflows at this head completed with success (CI, Desktop replay, Protected safety review, Platform manifest, Secret Scan, Dependency Review, Link check). The PR does not touch |
Follow-up to #2643. Grok reported that the JS receipt verifier still accepts some
predicate.evidence_scopeshapes that the Python verifier refuses as malformed. On 6 of 25 receipts that Grok signed with the public test-vector key, JS said VERIFIED and Python said malformed.Why Python refuses them
EvidenceScopeV1on its own acceptsnullforbasis,read_back_atandrecheck_window_s, and it defaults a missingwire.protocols_parsedto[]. Python refuses these payloads at a later step:verify_receiptrequirescanonical_json(statement.wire()) == payload(receipt.py, the "not canonical JSON" check).wire()drops an absent block, andwire_dict()dropsNonefields and always emitsprotocols_parsed. So each of these payloads fails the round trip:evidence_scope: null;basis,read_back_atorrecheck_window_sset tonull;wire.protocols_parsedset tonull(also a type error) or missing.Change
packages/seal-view/src/lib/receiptRecord.mjs:evidence_scopeis present.'x' in es), so anullvalue is refused.wire.protocols_parsed, with no?? []fallback.null.packages/types/tests/vectors/record-run-v1: six new vectors, all expectedmalformed:evidence-scope-nullevidence-scope-null-basis(on a SHOWN/STOPPED block, because a VERIFIED block without a basis is already refused)evidence-scope-null-read-back-atevidence-scope-null-recheck-windowevidence-scope-protocols-nullevidence-scope-protocols-missinggenerate.pysigns them with thethis_computertest key, which is derived from a public label. Regenerating leaves every existing vector byte-identical. The README now states the rule.Rebuilt
openadapt/seal_view/viewer.htmlandtests/snapshots/seal_viewer_size.json: 257704 bytes, budget 262144.Changelogs: an
Unreleasedentry inpackages/typesand an entry under seal-view'sv0.1.0 (unreleased). Neither package gets a version bump.release_plan.changelog_topstill reads0.24.2for types, and 0.24.2 is already on PyPI.Tests
Before the JS fix,
npm testfailed on all 6 new vectors (the JS returned ok).After the fix:
packages/seal-view:npm testpasses 63 of 63, andnpm run checkmatches the launcher copy.packages/types:pytestreports 914 passed and 2 skipped.test_receipt_vectors.pypasses 61 of 61.tests/test_seal_view.pyon Python 3.12: 13 passed and 17 skipped (the skipped tests are the headless-browser ones).A two-way parity probe (not committed) signed 28 variants and ran both verifiers on each. The verifiers disagreed on none. The variants were:
nullon each of those blocks;protocols_parsednull or missing;wire;nullblock;recheck_window_sof 0 or 1.5;read_back_atand an emptybasis.None of the shapes Python accepts are now refused by the JS.