What changed, and why it matters
This commit only adds new automated tests for the Sui blockchain app in the Keystone hardware wallet firmware. It checks that address generation rejects invalid or wrong-length public keys and that transaction-intent parsing rejects empty input and invalid scope bytes. No production code behavior was changed.
No security action needed; this is a test-only change. Routine review/merge is sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds four Rust unit tests to rust/apps/sui/src/lib.rs. Two tests exercise generate_address() with a non-hex ‘invalid’ string and a 64-hex-character public key (wrong length for the expected 33-byte compressed key). Two tests exercise parse_intent() with an empty byte slice and a 4-byte intent payload starting with 0xff (invalid scope). All assertions expect Err results. No implementation code is modified.
Changed components
rust/apps/sui/src/lib.rsInspect captured patch +27 / −0
diff --git a/rust/apps/sui/src/lib.rs b/rust/apps/sui/src/lib.rs
index eaf137e..cd7cb27 100644
--- a/rust/apps/sui/src/lib.rs
+++ b/rust/apps/sui/src/lib.rs
@@ -217,4 +217,31 @@ mod tests {
let expected_signature = hex::decode("f4b79835417490958c72492723409289b444f3af18274ba484a9eeaca9e760520e453776e5975df058b537476932a45239685f694fc6362fe5af6ba714da6505").unwrap();
assert_eq!(expected_signature, signature);
}
+
+ #[test]
+ fn test_generate_address_invalid_length() {
+ let pub_key = "invalid";
+ let result = generate_address(pub_key);
+ assert!(result.is_err());
+ }
+
+ #[test]
+ fn test_generate_address_wrong_length() {
+ let pub_key = "edbe1b9b3b040ff88fbfa4ccda6f5f8d404ae7ffe35f9b220dec08679d5c336f";
+ let result = generate_address(pub_key);
+ assert!(result.is_err());
+ }
+
+ #[test]
+ fn test_parse_intent_empty() {
+ let result = parse_intent(&[]);
+ assert!(result.is_err());
+ }
+
+ #[test]
+ fn test_parse_intent_invalid_scope() {
+ let bytes = hex::decode("ff000000").unwrap();
+ let result = parse_intent(&bytes);
+ assert!(result.is_err());
+ }
}
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.