Drop ValueError message string to save flash space
What changed, and why it matters
This commit removes a human-readable error message from a ValueError exception to reduce the amount of flash storage used by the firmware. It is a minor code cleanup and does not change the security behavior of the code. The function still raises an exception when invalid JSON input is provided; only the descriptive text is dropped.
No security action required. This is a benign refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In shared/msgsign.py, the parse_msg_sign_request function previously raised ValueError(“not a JSON object”) when JSON input was valid but not a JSON object. The commit changes this to a bare raise ValueError, removing the message string. This is a flash-space optimization. The control flow and exception type remain unchanged; no security vulnerability is introduced or fixed by this diff.
Changed components
shared/msgsign.pyInspect captured patch +1 / −1
### shared/msgsign.py
@@ -314,7 +314,7 @@ def parse_msg_sign_request(data):
data_dict = ujson.loads(data.strip())
if not isinstance(data_dict, dict):
# valid JSON, but not an object (e.g. 123, "str", null, [1,2])
- raise ValueError("not a JSON object")
+ raise ValueError
text = data_dict.get("msg", None)
if text is None:
raise AssertionError("MSG required")Why this scored 15/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.