Skip to content

WIRE-291: prevalidate underwriter UIC signatures - #543

Open
huangminghuang wants to merge 1 commit into
masterfrom
fix/wire-291-uic-signature-prevalidation
Open

WIRE-291: prevalidate underwriter UIC signatures#543
huangminghuang wants to merge 1 commit into
masterfrom
fix/wire-291-uic-signature-prevalidation

Conversation

@huangminghuang

@huangminghuang huangminghuang commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Prevalidate each required source and destination UIC before winner selection.
  • Accept only the canonical packed K1 shape: variant tag 0 plus the 65-byte compact signature body.
  • Construct the K1 signature variant directly, recover the key without an attacker-controlled generic signature deserializer, and authorize only owner or active permission keys.
  • Log a stable UIC_SIGNATURE_REJECTED marker, disqualify only the malformed or unauthorized candidate, and continue processing the envelope and remaining candidates.
  • Fail underwriter startup when the configured WIRE provider declares a non-K1 key, returns a non-K1 self-test signature, or produces a non-canonical packed signature.

Behavior and security model

Malformed UIC data is isolated at the candidate boundary. Missing, truncated, oversized, unsupported-type, invalid-curve, digest-encoding, recovery, and unauthorized-key failures return typed results instead of aborting consensus dispatch. A disqualified candidate remains reclaimable: a new matching commit re-arms it for validation.

The rejection marker records the candidate claim as claimed_underwriter and includes the proven outpost id and leg. It does not claim that the candidate field identifies an authenticated depot submitter.

The plugin and depot now share the same K1-only contract. Startup exercises the configured provider before cron registration, while runtime UIC construction defensively rechecks the provider and packed output before paying outpost gas.

Tests and validation

  • Full Release default build with Clang 18, BUILD_SYSTEM_CONTRACTS=ON, BUILD_TEST_CONTRACTS=ON, ENABLE_TESTS=ON, x64-linux-release host/target triplets, 32 jobs: passed.
  • Underwriter plugin unit suite: 49/49 passed, including valid K1, declared R1, and K1-declared/R1-returning provider cases.
  • sysio_dispatch_tests: 43/43 passed on sys-vm, sys-vm-jit, and sys-vm-oc.
  • Added real-envelope coverage for malformed source signatures, malformed destination signatures, wrong signing keys, and a malformed record followed by a valid attestation in the same envelope.
  • Checked-in and Release-build sysio.uwrit.wasm SHA-256: 9c1c5ffa629bf2dd22c734d524116e8a0138f4e8cd687413876144b35c37278f.
  • sysio.uwrit ABI is unchanged.
  • PR CI: all required Linux variants and Apple Silicon passed.
  • Platform E2E Flow Tests, Release with BRANCH_WIRE_SYSIO=fix/wire-291-uic-signature-prevalidation: passed.
  • Independent correctness/security review: approved.
  • Independent architecture review: approved.
  • Fresh post-rebase project rule/style compliance review: approved for push.

Known unrelated baseline failures

The broader contract run passed 508/509 tests; sysio_msig_tests/big_transaction remains the existing base_per_transaction_net_usage schema-drift failure. The broader CTest sample passed 311/339; the remaining existing failures cluster around the freshly compiled sysio.system init/schema and RAM-baseline drift and are not changed by this PR.

Jira

WIRE-291

Disqualify malformed or unauthorized UIC candidates without
aborting consensus dispatch.

Fail underwriter startup when its WIRE provider cannot emit the
canonical K1 shape accepted by the depot.

Refs: WIRE-291
Change-Id: Ife7e32511f93ae7600bca8ef640deb8367884206
@huangminghuang
huangminghuang marked this pull request as ready for review July 30, 2026 21:32
@huangminghuang
huangminghuang requested review from a team and heifner July 30, 2026 21:32
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