docs(sdk): document security properties of get_address_mac
What changed, and why it matters
This commit only adds documentation comments to an existing function. It does not change any code behavior. The new comments explain that the function computes a security tag (MAC) linking a wallet path, address string, and coin type, and warn callers that they must ensure the address and coin type are valid because the function itself does not verify them. The commit message even jokes that the docs are meant to reduce repeated security reports. There is no vulnerability being fixed here.
No action required. This is a documentation commit. If reviewing apps using this SDK, ensure they follow the documented contract: validate that the passed address matches the derivation path and that the SLIP44 coin ID belongs to the app.
Security signals we found
Documentation-only change
No code logic modified
No validation added or removed
Commit message explicitly states intent to document security properties
Evidence from the diff
The change is a pure documentation addition (+12 lines across two Rust files) to get_address_mac and its trait definition. It clarifies the security contract: address_n is validated against the app manifest, but slip44 and the address string are not validated. It instructs reviewers to verify that callers pass matching addresses and valid SLIP44 identifiers. No logic, validation, or API surface changed.
Changed components
sdk/crates/trezor-app-sdk/src/app_runtime/crypto.rssdk/crates/trezor-app-sdk/src/traits/crypto.rsInspect captured patch +12 / −0
### sdk/crates/trezor-app-sdk/src/app_runtime/crypto.rs
@@ -171,6 +171,12 @@ pub fn check_address_mac(
/// Computes a MAC binding `address_n` to `address` of the coin type `slip44`
/// (as the built-in coin apps do), so a cached `address` can later be
/// re-authenticated via [`check_address_mac`] without a full re-derivation.
+///
+/// `address_n` is validated against app manifest. `slip44` is not validated,
+/// and neither is the address string itself (there is really no way to do that).
+///
+/// Review MUST check that the app is only passing (a) addresses that match
+/// the `address_n`, and (b) valid SLIP44 id belonging to the app.
pub fn get_address_mac(address_n: &[u32], address: &str, slip44: u32) -> Result<[u8; 32]> {
get_crypto_or_die()
.get_address_mac(address_n.into(), address.into(), slip44)
### sdk/crates/trezor-app-sdk/src/traits/crypto.rs
@@ -158,6 +158,12 @@ pub trait CryptoV1: Send + Sync {
/// Computes a MAC binding `address_n` to `address` of the coin type
/// `slip44`, so a cached `address` can later be re-authenticated via
/// [`Self::check_address_mac`] without a full re-derivation.
+ ///
+ /// `address_n` is validated against app manifest. `slip44` is not validated,
+ /// and neither is the address string itself (there is really no way to do that).
+ ///
+ /// Review MUST check that the app is only passing (a) addresses that match
+ /// the `address_n`, and (b) valid SLIP44 id belonging to the app.
extern "C" fn get_address_mac<'a>(
&self,
address_n: Slice<'a, u32>,Why this scored 12/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.