fix: Lock EIP-712 type system at FILT_ACTIVATE to prevent post-hash schema injection
handle_eip712_filtering() under P2_FILT_ACTIVATE computes the schema hash that downstream filter signatures are issued against, but left the EIP-712 type system unlocked: the host could continue sending INS_EIP712_STRUCT_DEF APDUs after the activate, append fields or even entire structs to the schema, and then sign a typed message whose actual schema differs from the one the filter metadata was issued for. Compute the schema hash first, and only on success switch the UI into filtering-full mode and set struct_state to DEFINED so subsequent handle_eip712_struct_def() calls are refused by the existing gate at commands_712.c:94. The whole branch is inside the `!N_storage.verbose_eip712` check (verbose mode never computes the hash). All three state changes (hash, filtering mode, type-system lock) move together, so a transient compute_schema_hash() failure leaves the handle clean and the host can retry the activate. (cherry picked from commit bc18ee062adf0a821656701c7a6faf1f3a790ad7)
C
Charles-Edouard de la Vergne committed
e1a550a47c93ff53dcd42238e64510b7cc660cb2
Parent: 497af6f
Committed by Alexandre Paillier <alexandre.paillier@ledger.fr>
on 8/25/2026, 3:04:01 PM