What changed, and why it matters
This commit only adds new test cases to an existing Rust test file. It checks that the Ed25519 key derivation function correctly rejects invalid or non-hardened derivation paths and that a path missing the leading 'm/' still produces the expected key. No production code was changed, so this is a routine test improvement rather than a security fix or vulnerability.
No action required; this is a benign test-only commit. Continue normal review and testing practices.
Security signals we found
No production code changes
Only test coverage added
Tests validate existing error handling for invalid derivation paths
Evidence from the diff
The diff adds unit tests in rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs. It verifies: (1) a path without the ‘m/’ prefix (‘0’/1’) still derives the same private key as the canonical ‘m/0’/1’ path; (2) a malformed path ‘x/y’/z’/1’ returns KeystoreError::InvalidDerivationPath; and (3) a non-hardened final component ‘m/0’/1’/2’ returns the same error with the message ‘non hardened derivation is not supported for slip10-ed25519’. No implementation logic was modified.
Changed components
rust/keystore/src/algorithms/ed25519/slip10_ed25519.rsInspect captured patch +19 / −0
diff --git a/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs b/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs
index aa315ee..992ef82 100644
--- a/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs
+++ b/rust/keystore/src/algorithms/ed25519/slip10_ed25519.rs
@@ -97,6 +97,12 @@ mod tests {
"e8ad866785e4152c7e7533454cf69a5c30761002f18ac268d20860e5ecdba44a",
hex::encode(key)
);
+ let path_missing_m = "0'/1'".to_string();
+ let key_missing_m = get_private_key_by_seed(&seed, &path_missing_m).unwrap();
+ assert_eq!(
+ "e8ad866785e4152c7e7533454cf69a5c30761002f18ac268d20860e5ecdba44a",
+ hex::encode(key_missing_m)
+ );
}
{
let path = "m/0'/1'/2'".to_string();
@@ -107,6 +113,19 @@ mod tests {
hex::encode(key)
);
}
+ {
+ let wrong_path = "x/y'/z'/1'".to_string();
+ let seed = hex::decode("5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4").unwrap();
+ let result = get_private_key_by_seed(&seed, &wrong_path);
+ assert!(result.is_err());
+ assert!(matches!(result, Err(KeystoreError::InvalidDerivationPath(_))));
+
+ let none_harden_path = "m/0'/1'/2".to_string();
+ let seed = hex::decode("5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4").unwrap();
+ let result = get_private_key_by_seed(&seed, &none_harden_path);
+ assert!(result.is_err());
+ assert!(matches!(result, Err(KeystoreError::InvalidDerivationPath(e)) if e == "non hardened derivation is not supported for slip10-ed25519"));
+ };
}
#[test]
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.