Repository navigation
fix: validate BIP32 derivation path indices - #158
Harshil-1603 wants to merge 2 commits into
Conversation
|
tACK e7ae5ba Tested on top of
All of these now raise One small request: the new test uses Non-blocking, possibly for a follow-up: unmarked indices of 2^31 and above are still accepted, as before, so |
odudex
left a comment
There was a problem hiding this comment.
I approve this PR, regardless of whether the less significant points raised earlier have been resolved or not.
Apply the concrete reviewer request without changing runtime behavior. Assisted-by: OpenAI Codex
|
ACK at 7f78a55, intending to merge these 2 commits to "hardened" after pr169 Thank you harshil and odudex. and tanveer |
|
ACK at 7f78a55 |
Validate each BIP32 path segment before converting it or adding the hardened offset. Negative hardened indices currently derive a non-hardened child, oversized indices reach serialization, and empty segments raise
IndexError.Reject empty segments, signs, whitespace, non-ASCII digits, and indices outside the uint32 range with
ValueError. Hardened suffixes (h,H, and') accept only values below2**31. Preserve existing root paths, relative paths, the optional trailing slash, and raw uint32 indices.Add valid boundary and malformed-path cases, plus a regression through
HDKey.derive. Register the new test class with the existing test runner.Fixes #113.
Validation:
PYTHONPATH=src pytest -q: 126 passed, 17 skipped on CPython 3.14 using the Python secp256k1 fallback.git diff --checkpassed.