fix(protocol): domain-separate loc/prf/inv/rcp signatures #20

Merged
sirius merged 1 commit from wt/t_ce5649ac into main 2026-09-12 03:53:43 +00:00
Owner

Summary

  • Bind loc / prf / inv / rcp signatures to a type tag so a signature cannot be reinterpreted as another application frame.
  • Encode signs tag || 0x00 || field… (onionwire-loc-v1, onionwire-prf-v1, onionwire-inv-v1, onionwire-rcp-v1).
  • Verify tries tagged first, then the legacy untagged LF-joined layout. Do not emit legacy.
  • Wire frames are otherwise unchanged: same loc /prf /inv /rcp prefixes, field order, field count, hex signature, freshness/verify semantics.
  • Invite stays onionwire-invite-v1 (untouched src/qr.rs).
  • Tests in tests/app_sig.rs: tagged round-trip for all four types, hand-built legacy still verifies, prf and inv signatures do not verify as rcp.

Tradeoff (mixed-version fleets)

Older builds verify only the untagged bytes, so they reject new tagged signatures — fail closed, no downgrade. Outbound application frames from a new sender to an old receiver break until both sides are updated. That is accepted here rather than emitting a compatibility layer that would keep cross-type collisions on the wire.

Verification

  • cargo test --locked — green (including 10/10 in tests/app_sig.rs)
  • cargo clippy --locked --all-targets -- -D warnings — green
  • Cross-type regression: prf_signature_does_not_verify_as_rcp / inv_signature_does_not_verify_as_rcp fail if the type tag is dropped because dual-accept would then treat the colliding untagged field layout as valid.

Do not merge; leaving for review.

## Summary - Bind `loc` / `prf` / `inv` / `rcp` signatures to a type tag so a signature cannot be reinterpreted as another application frame. - Encode signs `tag || 0x00 || field…` (`onionwire-loc-v1`, `onionwire-prf-v1`, `onionwire-inv-v1`, `onionwire-rcp-v1`). - Verify tries tagged first, then the legacy untagged LF-joined layout. Do not emit legacy. - Wire frames are otherwise unchanged: same `loc `/`prf `/`inv `/`rcp ` prefixes, field order, field count, hex signature, freshness/verify semantics. - Invite stays `onionwire-invite-v1` (untouched `src/qr.rs`). - Tests in `tests/app_sig.rs`: tagged round-trip for all four types, hand-built legacy still verifies, `prf` and `inv` signatures do not verify as `rcp`. ## Tradeoff (mixed-version fleets) Older builds verify only the untagged bytes, so they **reject** new tagged signatures — fail closed, no downgrade. Outbound application frames from a new sender to an old receiver break until both sides are updated. That is accepted here rather than emitting a compatibility layer that would keep cross-type collisions on the wire. ## Verification - `cargo test --locked` — green (including 10/10 in `tests/app_sig.rs`) - `cargo clippy --locked --all-targets -- -D warnings` — green - Cross-type regression: `prf_signature_does_not_verify_as_rcp` / `inv_signature_does_not_verify_as_rcp` fail if the type tag is dropped because dual-accept would then treat the colliding untagged field layout as valid. Do not merge; leaving for review.
fix(protocol): domain-separate loc/prf/inv/rcp signatures
All checks were successful
ci / test (pull_request) Successful in 2m30s
c8e69732c7
Sign application frames as tag || 0x00 || fields (onionwire-loc-v1,
onionwire-prf-v1, onionwire-inv-v1, onionwire-rcp-v1). Verify accepts
that form first, then the legacy untagged LF-joined layout. Encode still
emits only the tagged signature; wire prefixes and field layout are
unchanged.

Older builds verify untagged bytes only, so they reject new tagged
signatures (fail closed). Mixed-version fleets break outbound app frames
from a new sender to an old receiver until both sides are updated.
sirius merged commit f9395ee070 into main 2026-09-12 03:53:43 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!20
No description provided.