Skip to content

test(evidence): signer-key-resolution authority-loop reference verifier#90

Merged
amavashev merged 2 commits into
mainfrom
test/evidence-jwks-authority-loop
Jun 15, 2026
Merged

test(evidence): signer-key-resolution authority-loop reference verifier#90
amavashev merged 2 commits into
mainfrom
test/evidence-jwks-authority-loop

Conversation

@amavashev

Copy link
Copy Markdown
Contributor

What

The signer-key-resolution authority loop, validated end-to-end on REAL artifacts — and a runnable reference for the consumer (APS) side. Test-only.

This closes the "in the meantime" integration-testing gap while APS builds their did:cycles resolver: it proves a key resolved from the published JWKS authenticates the envelopes the signer actually produces (the v0.2 layer: getEvidenceJwks shipped in runcycles/cycles-protocol#113 + runcycles/cycles-server#194; design on #103 / aeoess#43).

Changes (test-only)

  • JwksAuthorityVerifier (test util) — given an envelope + a resolved JWK Set, reports exactly one of the five dispositions, reusing the production CyclesEvidenceCanonicalizer (re-derive evidence_id + signing bytes) and EnvelopeSigner (Ed25519 verify). Implements the normative raw-hex resolution, the window gate, and deterministic single-match selection. It is a spec-faithful reference the APS resolver can be checked against.
  • JwksAuthorityLoopTest — runs it over the 13 golden fixtures (already byte-validated against the APS verifier) + a new cycles-jwks.json publishing their signer. All 13 → authentic; plus all four failure modes: binding_only (no JWKS — valid-but-unpinned and pinned), signer_resolution_failed (set unreachable/unparseable), signer_authority_failed (out-of-window / absent key / mismatched pin / malformed window value), signature_invalid (tampered signature; tampered payload → evidence_id mismatch).
  • cycles-jwks.json fixture — doubles as the concrete key set APS can point their resolver at.

This is the live authority loop a deployment runs (emit/sign → publish JWKS → resolve window-covering key → verify), as durable regression coverage rather than a one-time smoke.

Review

codex-reviewed; two Mediums addressed:

  1. Integral-numeric validation — window members (cycles_nbf_ms/cycles_exp_ms) + issued_at_ms must be integral numbers (no asLong() coercion of "not-a-number"/{} to 0 slipping past the window gate), and x must decode to exactly 32 bytes.
  2. binding_only semantics — kept the behavior (per the v0.2 spec, binding_only subsumes "valid-but-unpinned"; the signer_pin_matched companion records the pin separately), fixed the misleading javadoc, and added null-pin / mismatched-pin / malformed-window tests.

22 tests, all green. Test-only — verifier lives in src/test; no production/wire/spec change, no jacoco-main impact.

Refs: #113, runcycles/cycles-protocol#113, runcycles/cycles-protocol#103, aeoess#43.

End-to-end validation that a key RESOLVED FROM THE PUBLISHED JWKS authenticates
the envelopes the signer actually produces (the v0.2 layer shipped in
cycles-protocol#113 getEvidenceJwks + cycles-server#194; design #103 / aeoess#43).

- JwksAuthorityVerifier (test util): a runnable, spec-faithful reference for the
  consumer/APS side. Given an envelope + a resolved JWK Set it reports exactly
  one of the five dispositions, reusing the PRODUCTION CyclesEvidenceCanonicalizer
  (re-derive evidence_id + signing bytes) + EnvelopeSigner (Ed25519 verify), with
  the normative raw-hex resolution, the window gate
  (cycles_nbf_ms <= issued_at_ms AND (cycles_exp_ms absent/null OR issued_at_ms <
  cycles_exp_ms)), and deterministic single-match selection.
- JwksAuthorityLoopTest: runs it over the 13 golden fixtures (already byte-
  validated against the APS verifier) + a new cycles-jwks.json publishing their
  signer. All 13 → authentic; plus binding_only (no JWKS; valid-but-unpinned and
  pinned), signer_resolution_failed (set unreachable/unparseable),
  signer_authority_failed (out-of-window / absent key / mismatched pin), and
  signature_invalid (tampered signature; tampered payload → evidence_id mismatch).

This is the live authority loop a deployment runs (emit/sign → publish JWKS →
resolve window-covering key → verify), as durable regression coverage; the
cycles-jwks.json fixture doubles as the concrete key set APS can resolve against.

codex review: two Mediums addressed — (1) integral-numeric validation for the
window members + a 32-byte x check (no asLong() coercion to 0); (2) clarified
binding_only covers valid-but-unpinned per spec (kept behavior; fixed the doc;
added null-pin / mismatched-pin / malformed-nbf tests). 22 tests; test-only
(verifier in src/test; no production/wire/spec change).
…90 review)

The 3 codex-hardening tests added after the initial entry (null-pin,
mismatched-pin, non-integral-window) bumped 19→22; the AUDIT entry still said 19.
Synced the count and the failure-mode descriptions (binding_only valid-but-unpinned;
authority_failed mismatched-pin / non-integral window) + noted the codex fixes.
@amavashev amavashev merged commit 01809e0 into main Jun 15, 2026
6 checks passed
@amavashev amavashev deleted the test/evidence-jwks-authority-loop branch June 15, 2026 14:47
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