Adding few more tests including for Electrum and BIP-45 paths
What changed, and why it matters
This commit only adds and updates automated tests for the Ledger Bitcoin app's extended public key feature. It does not change any application code, cryptographic logic, or security behavior. The tests verify that certain Bitcoin derivation paths (including Electrum and BIP-45 style paths) are accepted or rejected as expected. There is no indication of a security fix or vulnerability being patched.
No security action required. This is a test-only change. Reviewers may optionally confirm the new test expectations match the app's intended path validation policy.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_get_extended_pubkey.py only. It adds one new test case for a BIP-45/Unchained Capital-compatible path with display enabled, adds a new test function for an Electrum-style non-standard path with display disabled, and expands the list of paths expected to be rejected when display=False. It also removes a misleading comment calling a test path a ‘root pubkey’. No source code in the app itself is changed.
Changed components
tests/test_get_extended_pubkey.pyInspect captured patch +19 / −1
diff --git a/tests/test_get_extended_pubkey.py b/tests/test_get_extended_pubkey.py
index 864804e..443fdb8 100644
--- a/tests/test_get_extended_pubkey.py
+++ b/tests/test_get_extended_pubkey.py
@@ -21,6 +21,8 @@ def test_get_extended_pubkey_standard_display(navigator: Navigator, firmware: Fi
"m/49'/1'/1'/1/3": "tpubDGnetmJDCL18TyaaoyRAYbkSE9wbHktSdTS4mfsR6inC8c2r6TjdBt3wkqEQhHYPtXpa46xpxDaCXU2PRNUGVvDzAHPG6hHRavYbwAGfnFr",
"m/84'/1'/2'/0/10": "tpubDG9YpSUwScWJBBSrhnAT47NcT4NZGLcY18cpkaiWHnkUCi19EtCh8Heeox268NaFF6o56nVeSXuTyK6jpzTvV1h68Kr3edA8AZp27MiLUNt",
"m/86'/1'/4'/1/12": "tpubDHTZ815MvTaRmo6Qg1rnU6TEU4ZkWyA56jA1UgpmMcBGomnSsyo34EZLoctzZY9MTJ6j7bhccceUeXZZLxZj5vgkVMYfcZ7DNPsyRdFpS3f",
+ # the following path tests compatibility with Unchained Capital's multisig setup
+ "m/45'/2'/0'/1'": "tpubDFL11pFAgsKed5bv9Tkxe51xyB4qo1cPDwK6c8WZ4wiVEjtGDg5YuMXNk9yZcB6b47k2oaSWADJF3CRmk97qAwnaiRieT2ocWzh4rq2b3F3",
}
for path, pubkey in testcases.items():
@@ -56,6 +58,20 @@ def test_get_extended_pubkey_standard_nodisplay(client: RaggerClient):
)
+def test_get_extended_pubkey_exception_nodisplay(client: RaggerClient):
+ # as these paths are not standard, the app should reject immediately if display=False
+ testcases = {
+ # Electrum path exception
+ "m/4541509'/1112098098'": "tpubDAs3mrkQXkGyzp7Yo9SXiZNW7Tmia5EmdUpXjuBQvBDDGGr9CnVHehSB6P5RZFY3bwkYBweXir8MhmvPXqYHHVxKrFkm3mfZ5UkjG5ZH8Ui",
+ }
+
+ for path, pubkey in testcases.items():
+ assert pubkey == client.get_extended_pubkey(
+ path=path,
+ display=False
+ )
+
+
def test_get_extended_pubkey_nonstandard_nodisplay(client: RaggerClient):
# as these paths are not standard, the app should reject immediately if display=False
testcases = [
@@ -69,6 +85,8 @@ def test_get_extended_pubkey_nonstandard_nodisplay(client: RaggerClient):
"m/48'/1'/0'/0'", # script_type is 1' or 2' for BIP-0048
"m/48'/1'/0'/3'", # script_type is 1' or 2' for BIP-0048
"m/999'/1'/0'", # no standard with this purpose
+ "m/45'/2'/0'", # BIP-45 path with wrong COIN_TYPE
+ "m/45'/1'" # BIP-45 too short path
]
for path in testcases:
@@ -103,7 +121,7 @@ def test_get_extended_pubkey_non_standard(navigator: Navigator, firmware: Firmwa
# The below part does not raise exception when built with COIN=bitcoin_recovery as all paths are permitted
with pytest.raises(ExceptionRAPDU) as e:
pub_key = client.get_extended_pubkey(
- path="m/44'/2'/333'", # root pubkey
+ path="m/44'/2'/333'",
display=True,
navigator=navigator,
instructions=pubkey_instruction_approve(firmware),
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.