`compile` doesn't validate keys and returns unusable descriptors
Mantenedores costumam responder em até 4 dias
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 52/100
Direção de pesquisa
Start from the compile subcommand, where the policy string is parsed as Concrete<String>, and reproduce with bdk-cli compile "pk(ABC)". The fix changes the parse type to Concrete<DescriptorPublicKey> and adds an --allow-placeholders flag that keeps the old behaviour. Done when placeholder keys and hashes are rejected by default, real keys and xpubs still compile, and existing tests and docs that use placeholders are updated.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
compile doesn't check that keys in the policy are actual keys. It succeeds and returns a descriptor that fails only later, when someone tries to use it:
$ bdk-cli compile "pk(ABC)"
{
"descriptor": "wsh(pk(ABC))#8gmtcnaw"
}
$ bitcoin-cli deriveaddresses "wsh(pk(ABC))#8gmtcnaw"
error code: -5
error message:
pk(): key 'ABC' is not valid
The policy is parsed as Concrete<String>, and a String key accepts anything.
Came up before in #225 and in the #317 review.
Proposed fix
Parse as Concrete<DescriptorPublicKey> by default. Keys are validated at parse time, so placeholders are rejected while real keys and xpubs keep working. Hashes are typed too, so sha256(H) is rejected the same way.
Keep the current behavior behind a flag, e.g. --allow-placeholders, since pk(A) style policies are handy to see what a policy compiles to, and in tests where only the policy shape matters, not the keys. This breaks existing calls with placeholders, docs and tests would need the flag or real keys.
# placeholder key is rejected
$ bdk-cli compile "pk(ABC)"
Error: Generic error: Invalid policy: unexpected «Key too short (<66 char), doesn't match any format»
# placeholder hash is rejected
$ bdk-cli compile "and(pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f),sha256(H))"
Error: Generic error: Invalid policy: unexpected «failed to parse hex»
# real keys and xpubs compile
$ bdk-cli compile "or(pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f),pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8/0/*))"
{
"descriptor": "wsh(or_b(pk(02e5b88fdb71c696e1a473f309a47535b7190e21a22bd25e7fc8bd055db3bba12f),s:pk(xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8/0/*)))#t459ja6u"
}
# placeholders still work with the flag
$ bdk-cli compile "pk(ABC)" --allow-placeholders
{
"descriptor": "wsh(pk(ABC))#8gmtcnaw"
}
See
- DescriptorPublicKey in rust-miniscript
- Linguagem predominante
- Rust
- Estrelas
- 143
- Forks
- 109
- Merge médio
- 7d 20h
- PRs com merge (30d)
- 6
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de bitcoindevkit/bdk-cli
-
key generate subcommand silently coerces any word count other than 12 to 24 wordsTalvez já em andamento @Olorunshogo assumiu há 9 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
bitcoindevkit/bdk-cli#362 · 3 comentários ·
Mantenedores costumam responder em até 4 dias
-
create_tx accepts recipient addresses from the wrong networkTalvez já em andamento @emma31-dev assumiu há 3 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
bitcoindevkit/bdk-cli#360 ·
Mantenedores costumam responder em até 4 dias
-
Expose remaining SignOptions fields in the wallet sign commandTalvez já em andamento @emma31-dev assumiu há 12 dias. Abertaenhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
bitcoindevkit/bdk-cli#358 · 1 comentário ·
Mantenedores costumam responder em até 4 dias
-
wallet sign command returns generic error for decoding failuresTalvez já em andamento @emma31-dev assumiu há 12 dias. Abertachore good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
bitcoindevkit/bdk-cli#357 · 1 responsável ·
Mantenedores costumam responder em até 4 dias
-
enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
bitcoindevkit/bdk-cli#359 · 1 comentário ·
Mantenedores costumam responder em até 4 dias
Todas as issues de bitcoindevkit/bdk-cli
Issues semelhantes
-
example
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
rust-lang-nursery/rust-cookbook#954 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 70/100
OpenZeppelin/openzeppelin-relayer#967 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
DecisionOutcome::label() / n_dosed(): engine-side mapping so downstream needs no wildcard armAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
src/runs.rs:1987: a missing --source-run-id now answers 400 "Source run ... does not exist", not 404Abertanightly-audit
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
antithesishq/snouty#602 ·
Mantenedores costumam responder em até 1 dia