diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index c5f41e2b94e8..130367f2c1f3 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -224,7 +224,7 @@ fi if [[ "${RUN_IWYU}" == true ]]; then # TODO: Consider enforcing IWYU across the entire codebase. - FILES_WITH_ENFORCED_IWYU='/src/((bench|common|consensus|crypto|index|init|kernel|primitives|rpc|script|univalue/(lib|test)|util|zmq)/.*|node/(block_template_manager|blockstorage|interfaces|miner|mining_args|utxo_snapshot)|test/fuzz/(kitchen_sink|minisketch|parse_univalue)|clientversion|core_io|rest|signet|init)\.cpp' + FILES_WITH_ENFORCED_IWYU='/src/((bench|common|consensus|crypto|index|init|kernel|primitives|rpc|script|univalue/(lib|test)|util|zmq)/.*|node/(block_template_manager|blockstorage|interfaces|miner|mining_args|utxo_snapshot)|test/fuzz/(kitchen_sink|minisketch|parse_univalue)|clientversion|core_io|external_signer|rest|signet|init)\.cpp' jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json" jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json" diff --git a/doc/external-signer.md b/doc/external-signer.md index 8b02edd6b8ab..5e904f50959d 100644 --- a/doc/external-signer.md +++ b/doc/external-signer.md @@ -148,6 +148,10 @@ A future extension could add an optional return field `reachable`, in case `` and MUST return a JSON object. On success, it MUST contain `{"psbt": ""}` updated to include any new signatures. On failure, it SHOULD contain `{"error": ""}`. Presence of a key `error` with value `null` is not considered an error. +The returned PSBT MUST use the same PSBT version as the request. + +The returned PSBT MUST NOT contain finalized inputs (`PSBT_IN_FINAL_SCRIPTSIG` or `PSBT_IN_FINAL_SCRIPTWITNESS`). Signatures MUST remain in the partial signature or Taproot signature fields so Bitcoin Core can check their sighash types. + PSBT SHOULD include BIP32 derivations. The command SHOULD fail if none of the BIP32 derivations match a key owned by the device. The command SHOULD fail if the user cancels. @@ -224,3 +228,30 @@ It then imports descriptors for all supported address types, in a BIP44/49/84/86 The `walletdisplayaddress` RPC obtains the inferred descriptor for the provided address. It then calls ` --fingerprint 00000000 --chain displayaddress --desc `. For external-signer wallets, spending uses `send` or `sendall`, and fee-bumping uses `bumpfee`. Bitcoin Core builds a PSBT, adds key origin information, checks whether any input key origin fingerprint matches the signer, calls ` --stdin --fingerprint 00000000 --chain `, and sends `signtx ` over stdin. If signatures are sufficient, it finalizes the transaction and, for broadcasting RPCs, broadcasts it. If signing cannot complete, the call fails with an error. For manual fee-bumping, use `psbtbumpfee` to obtain a PSBT for signing. + + +## Interactive Taproot anti-exfil (experimental) + +`-signerantiexfil` requires the single-signer BIP-EXFIL protocol for unsigned +Taproot key-path inputs. The signer must support this protocol; unsupported +signers fail closed. Existing signing without this option is unchanged. + +Core invokes `signtx` twice. Per-input proprietary keys have prefix +`fc026165`, one subtype byte, and the 32-byte Taproot output key. Subtype 0 +carries the host commitment (32 bytes), subtype 1 the original compressed public +nonce (33 bytes), and subtype 2 the host entropy (32 bytes). The first request +contains only subtype 0; its reply adds subtype 1 and no signatures. The second +request adds subtype 2; its reply adds the normal Taproot key-path signature. + +Core independently computes the original Taproot sighash and verifies each +signature and nonce proof before accepting any signatures. It retains the +original transaction and removes the transcript from the resulting PSBT. +Only DEFAULT and ALL are supported; script-path and multiparty signing are not. + +There is no automatic retry after a failed exchange. A failure after commitment +is reported explicitly: repeated fresh attempts can permit selective-abort +exfiltration. This initial implementation does not persist interrupted transcripts +across RPC calls or restarts. Applications must not automatically resubmit failed +signing RPCs with fresh randomness, and must not publish intermediate transcripts. +The domain tags and proprietary fields are provisional and must change together +if the draft protocol changes. diff --git a/src/dummywallet.cpp b/src/dummywallet.cpp index f9415458f394..e30cd267b19c 100644 --- a/src/dummywallet.cpp +++ b/src/dummywallet.cpp @@ -40,6 +40,7 @@ void DummyWalletInit::AddWalletOptions(ArgsManager& argsman) const "-maxfeerate=", "-mintxfee=", "-signer=", + "-signerantiexfil", "-spendzeroconfchange", "-txconfirmtarget=", "-wallet=", diff --git a/src/external_signer.cpp b/src/external_signer.cpp index cb49cedc69c2..e61cd40862e4 100644 --- a/src/external_signer.cpp +++ b/src/external_signer.cpp @@ -4,16 +4,36 @@ #include -#include #include #include +#include #include +#include +#include +#include