This repository was archived by the owner on Oct 22, 2026. It is now read-only.
Repository navigation
Conversation
`get_key` for a `KeyRequest::Bip32` on an extended private key relied solely on `DescriptorXKey::matches()`, which drops the last element of the requested path for wildcard keys without looking at it. As a result a wildcard key would hand out keys outside its key space: - `xprv/0/*` returned the key at `m/0/1h` - `xprv/0/*h` returned the key at `m/0/1` - `xprv/*` returned the master key for an empty request path Check the wildcard step in `get_key`: return `Ok(None)` if the request has no wildcard step, and `GetKeyError::NotSupported` if its hardenedness does not match the descriptor's wildcard. Fixes rust-bitcoin#1068 Assisted-by: Claude Opus 5.5
Member
|
who the hell are these people? Violates LLM policy. |
Contributor
Author
|
@apoelstra, I’m so sorry. I used an AI tool as a guide while working on this and noted it in the commit trailer, but I should have read the project’s LLM policy before opening the PR. I understand why it was closed and won’t reopen it. I’ll read the policy carefully before contributing again. |
Member
|
For future reference -- there was another poster in this PR who was also posting slop. Github has removed those comments without a trace. I will prioritize moving this repo off of Github. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #1068.
This PR fixes an issue where
get_keycould return a key that didn't match the descriptor's allowed key path.The problem was that wildcard paths weren't fully checked, so requests with the wrong hardenedness could still return a key.
I've added checks in
get_keyto reject unsupported paths while keeping the existing matching logic unchanged. Requests with an empty path now returnNone, since there is no matching key to return.The same behavior applies to
MultiXPrvkeys. I also added tests covering wildcard paths, key origins, and multipath keys to make sure the issue is handled correctly.