feat(clear_signing): AddressName formatter updated
What changed, and why it matters
This commit adds a new optional feature to Trezor's Ethereum clear-signing system. When a transaction field is marked as an address name and its type is 'contract' or 'token', the device can now ask the connected computer (host) to look up a friendly name for that address. If the host provides a name, the device shows that name to the user instead of the raw address. The change is a feature addition, not a direct fix for a known security bug, but it touches the code that decides what text users see on their device screen during transaction approval.
Treat this as a feature commit with security-relevant UI implications rather than an active vulnerability. Reviewers should verify that `lookup_known_address` validates the host response, that the lookup cannot be triggered by untrusted transaction metadata, and that the broad exception handler does not hide integrity failures. Consider whether host-supplied names require the same trust assumptions as other clear-signing metadata.
Security signals we found
New host-query path during transaction formatting: `lookup_known_address` is invoked while the user is reviewing a transaction.
Broad exception suppression: all non-UnexpectedMessageException errors from the host lookup are silently ignored, which could mask failures or unexpected behavior.
User-displayed data now depends on host-provided name lookup, creating a potential UI spoofing surface if the host or lookup source is untrusted or compromised.
The feature is gated by a new protobuf flag, so existing definitions default to the prior behavior (lookup_address=false).
No changelog entry is present, but the commit title describes a feature update, not a security fix.
Evidence from the diff
The commit extends the EthereumERC7730FieldInfo protobuf message with a new optional bool field lookup_address (field 15, default false). In core/src/apps/ethereum/clear_signing.py, the AddressNameFormatter class now accepts this flag. When lookup_address is true and the address value is bytes, the formatter calls lookup_known_address(msg.chain_id, address, msg) to query the host for a known name. If a name is returned, it is displayed; otherwise the code falls back to the existing address_from_bytes formatting. The exception handler deliberately re-raises UnexpectedMessageException (host abort) and silently swallows all other exceptions, returning address_name = None. Generated protobuf bindings are updated for Python, Rust, and the core message module.
Changed components
core/src/apps/ethereum/clear_signing.pycommon/protob/messages-definitions.protocore/src/trezor/messages.pypython/src/trezorlib/messages.pyrust/trezor-client/src/protos/generated/messages_definitions.rsInspect captured patch +69 / −5
### common/protob/messages-definitions.proto
@@ -204,6 +204,11 @@ message EthereumERC7730FieldInfo {
// EnumFormatter params
repeated EthereumERC7730EnumEntry enum_values = 12;
+
+ // AddressNameFormatter params
+ // https://eips.ethereum.org/EIPS/eip-7730#address-types-and-sources
+ // True when the addressName has `types` parameter in (contract, token)
+ optional bool lookup_address = 15 [default = false]; // whether to lookup the address in the token list
}
/**
### core/src/apps/ethereum/clear_signing.py
@@ -3,6 +3,7 @@
from trezor import TR
from trezor.wire import DataError
+from trezor.wire.context import UnexpectedMessageException
from .definitions import Definitions
from .helpers import (
@@ -299,10 +300,13 @@ async def format(
class AddressNameFormatter(FieldFormatter):
+ def __init__(self, lookup_address: bool = False) -> None:
+ self.lookup_address = lookup_address
+
async def format(
self,
address: AnyValue,
- _msg: MsgInSignTx,
+ msg: MsgInSignTx,
defs: Definitions,
_path_walker: PathWalker,
) -> FormattedValue:
@@ -313,6 +317,18 @@ async def format(
else:
if not isinstance(address, bytes):
raise InvalidFormatDefinition
+ if self.lookup_address:
+ try:
+ address_name = await lookup_known_address(
+ msg.chain_id, address, msg
+ )
+ except UnexpectedMessageException:
+ # the host may abort the workflow by sending a new message
+ raise
+ except Exception:
+ address_name = None
+ if address_name is not None:
+ return address_name, None, None
return address_from_bytes(address, defs.network), None, None
@@ -868,7 +884,7 @@ def decode_path(p: EthereumERC7730Path) -> Path:
fmt_type = info.formatter
if fmt_type == FT.FORMATTER_ADDRESS_NAME:
- formatter = AddressNameFormatter
+ formatter = AddressNameFormatter(info.lookup_address)
elif fmt_type == FT.FORMATTER_AMOUNT:
formatter = AmountFormatter
elif fmt_type == FT.FORMATTER_TOKEN_AMOUNT:
### core/src/trezor/messages.py
@@ -3432,6 +3432,7 @@ class EthereumERC7730FieldInfo(protobuf.MessageType):
callee_path: "EthereumERC7730Path | None"
selector: "AnyBytes | None"
enum_values: "list[EthereumERC7730EnumEntry]"
+ lookup_address: "bool"
def __init__(
self,
@@ -3450,6 +3451,7 @@ def __init__(
const_token_address: "AnyBytes | None" = None,
callee_path: "EthereumERC7730Path | None" = None,
selector: "AnyBytes | None" = None,
+ lookup_address: "bool | None" = None,
) -> None:
pass
### python/src/trezorlib/messages.py
@@ -4925,6 +4925,7 @@ class EthereumERC7730FieldInfo(protobuf.MessageType):
10: protobuf.Field("callee_path", "EthereumERC7730Path", repeated=False, required=False, default=None),
11: protobuf.Field("selector", "bytes", repeated=False, required=False, default=None),
12: protobuf.Field("enum_values", "EthereumERC7730EnumEntry", repeated=True, required=False, default=None),
+ 15: protobuf.Field("lookup_address", "bool", repeated=False, required=False, default=False),
}
def __init__(
@@ -4944,6 +4945,7 @@ def __init__(
const_token_address: Optional["bytes"] = None,
callee_path: Optional["EthereumERC7730Path"] = None,
selector: Optional["bytes"] = None,
+ lookup_address: Optional["bool"] = False,
) -> None:
self.native_currency_address: Sequence["bytes"] = native_currency_address if native_currency_address is not None else []
self.enum_values: Sequence["EthereumERC7730EnumEntry"] = enum_values if enum_values is not None else []
@@ -4959,6 +4961,7 @@ def __init__(
self.const_token_address = const_token_address
self.callee_path = callee_path
self.selector = selector
+ self.lookup_address = lookup_address
class EthereumERC7730EnumEntry(protobuf.MessageType):
### rust/trezor-client/src/protos/generated/messages_definitions.rs
@@ -1677,6 +1677,8 @@ pub struct EthereumERC7730FieldInfo {
pub selector: ::std::option::Option<::std::vec::Vec<u8>>,
// @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumERC7730FieldInfo.enum_values)
pub enum_values: ::std::vec::Vec<EthereumERC7730EnumEntry>,
+ // @@protoc_insertion_point(field:hw.trezor.messages.definitions.EthereumERC7730FieldInfo.lookup_address)
+ pub lookup_address: ::std::option::Option<bool>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.definitions.EthereumERC7730FieldInfo.special_fields)
pub special_fields: ::protobuf::SpecialFields,
@@ -1969,8 +1971,27 @@ impl EthereumERC7730FieldInfo {
self.selector.take().unwrap_or_else(|| ::std::vec::Vec::new())
}
+ // optional bool lookup_address = 15;
+
+ pub fn lookup_address(&self) -> bool {
+ self.lookup_address.unwrap_or(false)
+ }
+
+ pub fn clear_lookup_address(&mut self) {
+ self.lookup_address = ::std::option::Option::None;
+ }
+
+ pub fn has_lookup_address(&self) -> bool {
+ self.lookup_address.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_lookup_address(&mut self, v: bool) {
+ self.lookup_address = ::std::option::Option::Some(v);
+ }
+
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
- let mut fields = ::std::vec::Vec::with_capacity(14);
+ let mut fields = ::std::vec::Vec::with_capacity(15);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, EthereumERC7730Path>(
"path",
@@ -2042,6 +2063,11 @@ impl EthereumERC7730FieldInfo {
|m: &EthereumERC7730FieldInfo| { &m.enum_values },
|m: &mut EthereumERC7730FieldInfo| { &mut m.enum_values },
));
+ fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
+ "lookup_address",
+ |m: &EthereumERC7730FieldInfo| { &m.lookup_address },
+ |m: &mut EthereumERC7730FieldInfo| { &mut m.lookup_address },
+ ));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<EthereumERC7730FieldInfo>(
"EthereumERC7730FieldInfo",
fields,
@@ -2131,6 +2157,9 @@ impl ::protobuf::Message for EthereumERC7730FieldInfo {
98 => {
self.enum_values.push(is.read_message()?);
},
+ 120 => {
+ self.lookup_address = ::std::option::Option::Some(is.read_bool()?);
+ },
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
@@ -2189,6 +2218,9 @@ impl ::protobuf::Message for EthereumERC7730FieldInfo {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len;
};
+ if let Some(v) = self.lookup_address {
+ my_size += 1 + 1;
+ }
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
@@ -2237,6 +2269,9 @@ impl ::protobuf::Message for EthereumERC7730FieldInfo {
for v in &self.enum_values {
::protobuf::rt::write_message_field_with_cached_size(12, v, os)?;
};
+ if let Some(v) = self.lookup_address {
+ os.write_bool(15, v)?;
+ }
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
@@ -2268,6 +2303,7 @@ impl ::protobuf::Message for EthereumERC7730FieldInfo {
self.callee_path.clear();
self.selector = ::std::option::Option::None;
self.enum_values.clear();
+ self.lookup_address = ::std::option::Option::None;
self.special_fields.clear();
}
@@ -2287,6 +2323,7 @@ impl ::protobuf::Message for EthereumERC7730FieldInfo {
callee_path: ::protobuf::MessageField::none(),
selector: ::std::option::Option::None,
enum_values: ::std::vec::Vec::new(),
+ lookup_address: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
@@ -3397,7 +3434,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\
h\x18\x02\x20\x01(\x0e2<.hw.trezor.messages.definitions.EthereumERC7730C\
ontainerPathR\rcontainerPath\x12\x1f\n\x0bconst_value\x18\x03\x20\x01(\t\
R\nconstValue\x12\x1f\n\x0bslice_start\x18\x04\x20\x01(\x11R\nsliceStart\
- \x12\x1b\n\tslice_end\x18\x05\x20\x01(\x11R\x08sliceEnd\"\xf6\x05\n\x18E\
+ \x12\x1b\n\tslice_end\x18\x05\x20\x01(\x11R\x08sliceEnd\"\xa4\x06\n\x18E\
thereumERC7730FieldInfo\x12G\n\x04path\x18\x01\x20\x02(\x0b23.hw.trezor.\
messages.definitions.EthereumERC7730PathR\x04path\x12\x14\n\x05label\x18\
\x02\x20\x02(\tR\x05label\x12_\n\tformatter\x18\x03\x20\x02(\x0e2A.hw.tr\
@@ -3413,7 +3450,8 @@ static file_descriptor_proto_data: &'static [u8] = b"\
w.trezor.messages.definitions.EthereumERC7730PathR\ncalleePath\x12\x1a\n\
\x08selector\x18\x0b\x20\x01(\x0cR\x08selector\x12Y\n\x0benum_values\x18\
\x0c\x20\x03(\x0b28.hw.trezor.messages.definitions.EthereumERC7730EnumEn\
- tryR\nenumValues\"B\n\x18EthereumERC7730EnumEntry\x12\x10\n\x03key\x18\
+ tryR\nenumValues\x12,\n\x0elookup_address\x18\x0f\x20\x01(\x08:\x05false\
+ R\rlookupAddress\"B\n\x18EthereumERC7730EnumEntry\x12\x10\n\x03key\x18\
\x01\x20\x02(\rR\x03key\x12\x14\n\x05value\x18\x02\x20\x02(\tR\x05value\
\"\xfa\x02\n\x19EthereumDisplayFormatInfo\x12\x19\n\x08chain_id\x18\x01\
\x20\x02(\x04R\x07chainId\x12\x18\n\x07address\x18\x02\x20\x02(\x0cR\x07\Why this scored 26/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.