-
Notifications
You must be signed in to change notification settings - Fork 42
Safer boarding input signature validation #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughChanges improve commitment transaction signing and verification: adds debug logging for boarding input signing with updated error messages, refactors Taproot signature verification to use commitment-transaction-derived verification with stricter input filtering, and enhances wallet signing error messages to include outpoint information. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
internal/core/application/service.go(1 hunks)internal/infrastructure/tx-builder/covenantless/builder.go(1 hunks)pkg/arkd-wallet/core/application/wallet/service.go(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T10:58:41.042Z
Learnt from: louisinger
Repo: arkade-os/arkd PR: 691
File: internal/core/application/service.go:557-562
Timestamp: 2025-08-19T10:58:41.042Z
Learning: In the arkd SubmitOffchainTx method, using the checkpoint PSBT input's tapscript (forfeit path) for the VtxoInput.Tapscript field is the correct behavior, not a bug as initially thought. The system correctly handles the relationship between checkpoint inputs and Ark transaction inputs.
Applied to files:
internal/infrastructure/tx-builder/covenantless/builder.gopkg/arkd-wallet/core/application/wallet/service.go
🧬 Code graph analysis (2)
internal/core/application/service.go (1)
pkg/errors/errors.go (1)
INTERNAL_ERROR(208-208)
internal/infrastructure/tx-builder/covenantless/builder.go (1)
pkg/ark-lib/intent/proof.go (1)
Verify(53-128)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build and Scan
- GitHub Check: integration tests
- GitHub Check: unit tests
🔇 Additional comments (4)
pkg/arkd-wallet/core/application/wallet/service.go (1)
542-543: LGTM! Improved error message with outpoint information.The enhanced error message now includes the previous outpoint, making it much easier to debug which specific input failed to sign. This aligns well with the PR's goal of improving logging and error messages.
internal/core/application/service.go (1)
2712-2712: LGTM! Enhanced logging for boarding input signing.The added debug log and more specific error message at line 2721 improve traceability of the boarding input signing flow, making it easier to diagnose issues when signing the commitment transaction.
internal/infrastructure/tx-builder/covenantless/builder.go (2)
1049-1055: Excellent security improvement: commitment-tinned verification.Using the commitment transaction's prevout fetcher ensures that signature verification is computed against the server-built transaction, preventing malicious users from supplying forged witnessUtxo fields to create seemingly valid signatures. This addresses the core security concern described in the PR objectives.
1059-1066: Stricter validation improves robustness—comment approved.The code correctly validates boarding inputs with exactly one
TaprootLeafScript(line 1059) rather than checking> 0. This strict check is appropriate given the architectural design: boarding inputs have a single forfeit path and therefore only one valid tapscript leaf. Taking the first signature (line 1069) is consistent with this single-signature-per-input constraint. TheVerifyAndCombinePartialTxfunction returnsINVALID_BOARDING_INPUT_SIGerrors, confirming it's specifically used for boarding input signature verification, and the codebase maintains this invariant throughout.
This PR ensures that
VerifyAndCombinePartialTxis using the commitment tx built by the server to compute the signature hashes. Thus, a malicious user modifying witnessUtxo fields cannot provide fake valid signatures.Also improve logging and error message of boarding input signature flow.
@altafan please review
Summary by CodeRabbit