What changed, and why it matters
This commit fixes a small bug in the Python Trezor library that identifies which Trezor hardware model is being used. Previously, the code would crash when it saw a valid but unrecognized model identifier. The fix makes the parser accept any valid model identifier instead of rejecting unknown ones. This is a routine robustness improvement, not a clear security vulnerability, but it could affect how firmware updates or device interactions behave if a new model is introduced.
Treat as a normal bugfix. Review whether any downstream code relies on the previous strict rejection behavior, and ensure new model identifiers are properly validated elsewhere in the firmware pipeline. No urgent security action is indicated by this commit alone.
Security signals we found
No security-relevant keywords in commit title or message
No changelog entry provided
Change is a parsing/validation fix, not a memory-safety or cryptographic fix
No CVE, advisory, or researcher attribution present in commit
Evidence from the diff
The change is in python/src/trezorlib/firmware/models.py in the Model.from_hw_model() classmethod. The original code raised ValueError for any hardware model byte string other than the all-zeros legacy identifier. The patch adds a fallback that attempts to construct a Model enum member directly from the bytes, and only raises ValueError if that fails. This makes the parser forward-compatible with new model identifiers already defined in the enum. There is no evidence in the commit of a security bug, exploit, or disclosure.
Changed components
python/src/trezorlib/firmware/models.pyTrezor Python client library model detectionInspect captured patch +5 / −1
diff --git a/python/src/trezorlib/firmware/models.py b/python/src/trezorlib/firmware/models.py
index 8d81e95e..712d7afa 100644
--- a/python/src/trezorlib/firmware/models.py
+++ b/python/src/trezorlib/firmware/models.py
@@ -52,7 +52,11 @@ class Model(Enum):
return hw_model
if hw_model == b"\x00\x00\x00\x00":
return cls.T2T1
- raise ValueError(f"Unknown hardware model: {hw_model}")
+ try:
+ assert isinstance(hw_model, bytes)
+ return cls(hw_model)
+ except ValueError as e:
+ raise ValueError(f"Unknown hardware model: {hw_model}") from e
@classmethod
def from_trezor_model(cls, trezor_model: TrezorModel) -> Self:
Why this scored 20/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.