fix: skip re-sanitization of already-sanitized UTXOs in fetchAndSanit… - #15
fix: skip re-sanitization of already-sanitized UTXOs in fetchAndSanit…#15ipseonet-dev wants to merge 2 commits into
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@Ipseonet can you describe your organization and how you use it, who are your clients? |
|
The new check decides the entire UTXO list is sanitized solely because the first entry has
Those normally fetch by xpub/address and still sanitize Blockbook results. However, the validation bypass could become exploitable in any consumer accepting caller-controlled explicit UTXOs. The proper fix is to make sanitization idempotent per UTXO—normalizing every entry and always applying current confirmation/asset policy. Merely checking every entry for Also:
|
sanitizeBlockbookUTXOs assumed every entry was a raw Blockbook record. Passing an already-sanitized object back in (as callers do when supplying explicit UTXOs) read utxo.txid on an object that only has txId, dropping the txId and breaking PSBT construction for WIF signers (syscoin#14). The previous approach guarded the call site and skipped sanitization when the first entry looked sanitized. That decided the whole list from one entry and bypassed policy filtering. Instead, normalize each entry independently and always apply confirmation and asset policy: - accept txId or txid, and BN or string values, per entry - carry confirmations through so excludeZeroConf re-applies on later passes - copy an already-sanitized assets Map through instead of re-parsing it as raw Blockbook records, which corrupted the guid key, maxsupply and precision - treat an empty assets Map as absent so it is not read as a legacy top-level assets collection Sanitizing is now idempotent: sanitize(sanitize(x)) deep-equals sanitize(x), and mixed raw/sanitized lists are fully normalized and fully policed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hNSHs6jMGmNSvTJ5wzr1t
1f58ff8 to
6f28082
Compare
|
Thanks for the detailed review — all three reproductions were correct, and I've reworked the PR along the lines you suggested. Force-pushed as I confirmed each failure against the old patch before changing anything. The guard decided the whole list from While making sanitization idempotent I hit a fourth failure worth flagging. Re-sanitizing an object whose The fix normalizes each entry independently and always applies confirmation and asset policy:
On the other points: the call-site guard in New |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f28082d08
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@ipseonet-dev pls answer #15 (comment) |
No clients. Single member entity incorporated in NM I am paying into. I have a more public facing site I am offering basic website SaaS. Aetolux.com |
Summary
Fixes #14
When
utxosare passed in already sanitized (e.g. when using WIF signing without a Signer),fetchAndSanitizeUTXOswas incorrectly re-sanitizing them viasanitizeBlockbookUTXOs.This caused
txIdto be silently lost becausesanitizeBlockbookUTXOsreadsutxo.txid(lowercase) which isundefinedon already-sanitized objects that use camelCasetxId.Error
Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]
Fix
Detect already-sanitized UTXOs by checking for the presence of a
.utxosarray withtxIdfields, and skip re-sanitization in that case.Testing
Verified by successfully building and broadcasting a
syscoinBurnToAssetAllocationtransaction using WIF signing on Tanenbaum testnet.TXID:
f131e672f31ef490c3e92cd78ee844abae711ff3d66b5383121d8e6e90b1e349