Skip to content

fix(rpc): validate a stored transaction encryption key on decode - #2411

Open
Xowiek wants to merge 1 commit into
0xMiden:nextfrom
Xowiek:enc-key-deser-validation
Open

fix(rpc): validate a stored transaction encryption key on decode#2411
Xowiek wants to merge 1 commit into
0xMiden:nextfrom
Xowiek:enc-key-deser-validation

Conversation

@Xowiek

@Xowiek Xowiek commented Aug 17, 2026

Copy link
Copy Markdown

TransactionEncryptionKey documents verify as its only constructor, so a key that
reaches the seal path has been vouched for by a chain-recognized validator.
Deserializable is a second constructor and it skipped both checks verify makes,
the IES scheme and the key id bounds.

The key is cached in the store after verification and read back through
Deserializable, and the cached value is never re-verified, so a corrupt row
decoded into a key the seal path treated as verified.

The attestation itself cannot be rechecked on decode, since it is not serialized
and the trust anchors are not there, but the invariants that do not depend on it
are now enforced. The key id length is bounded before the read so a corrupt
length cannot ask for a large allocation.

Three tests: a verified key still round-trips, an unsupported scheme is
rejected, and an empty or oversized key id is rejected. The last two fail on next.

TransactionEncryptionKey documents verify() as its only constructor, so a key
reaching the seal path has been vouched for by a chain-recognized validator.
Deserializable is a second constructor and skipped both checks verify() makes:
the IES scheme and the key id bounds.

The key is cached in the store after verification and read back through
Deserializable, and the cached value is not re-verified, so a corrupt row
decoded into a key the seal path treated as verified.

The attestation cannot be rechecked on decode, since it is not serialized and
the trust anchors are not available there, but the invariants that do not
depend on it are now enforced. The key id length is bounded before the read so
a corrupt length cannot ask for a large allocation.
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