`compile` doesn't validate keys and returns unusable descriptors
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Rust
- Stelle
- 143
- Fork
- 98
- Merge medio
- 5g 21h
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bitcoindevkit/bdk-cli
-
Remove "wallet" field from `WalletConfigInner`Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bitcoindevkit/bdk-cli#332 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
bitcoindevkit/bdk-cli#349 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
bitcoindevkit/bdk-cli#340 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Enforce Core-compatible OP_RETURN / datacarrier and standard tx-size limits in create_txForse già presa @tvpeter l’ha presa 17 giorni fa. Apertaenhancement
bitcoindevkit/bdk-cli#339 · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
bitcoindevkit/bdk-cli#338 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di bitcoindevkit/bdk-cli
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
RustCrypto/SSH#596 ·
-
proxy: SQL-over-HTTP turns empty arrays into [""] or [false], or HTTP 500 for int and float arraysAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
neondatabase/neon#12965 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
goauthentik/authentik#26867 ·
I maintainer di solito rispondono entro 1 giorno
-
api bug macos maintainer-needed p2 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
area::tern difficulty::easy good first issue kind::cleanup triage::ready
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100