Repository navigation
fix(algo): surface rekey and block blind signing of rekeyed txs - #10162
Conversation
|
|
a288d90 to
98ea89a
Compare
|
@claude review |
98ea89a to
a220cf6
Compare
|
@claude re-review |
|
@claude review |
a220cf6 to
05cdbd1
Compare
|
@claude review and share verdict |
There was a problem hiding this comment.
The latest push fixes both points from my earlier review, and this pass found no new bugs. Because the change sits on the ALGO signing path, a human from the module's code owners should still look at it.
What was reviewed:
allowReKeyTois now a string compared againstencodeAddress(txn.reKeyTo.publicKey)from the exact hex being signed. A mismatched or missing value throws.- Explain and sign now both prefer
halfSigned.txHex, so the operator sees the same bytes that get signed. - Both online and offline keyreg builders now pass
this._reKeyTo, whichfrom()fills in. The rekey therefore survives the rebuild in both explain and sign.
Extended reasoning...
The change touches the ALGO coin module: explainTransaction, signTransaction, Transaction.toJson, the keyreg builders and the unit tests. Its security-sensitive surface is the signing path: a new guard that refuses to sign rekeyed transactions unless the caller passes the approved rekey address. The latest commit addresses the two earlier inline findings (keyreg dropping the rekey, and the boolean opt-in plus the explain/sign hex mismatch). New tests cover rejecting a rekeyed transaction, rejecting a mismatched address and signing with the matching one. I deferred instead of approving because the signing guard is security-critical and /modules/sdk-coin-algo/ has a CODEOWNERS entry.
Still open from earlier reviews (1):
- Unresolved: 1 minor or pre-existing.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
05cdbd1 to
2123b21
Compare
- explainTransaction now includes reKeyTo in the explanation and displayOrder for pay, axfer and keyreg transactions carrying a rekey - toJson() emits reKeyTo so decoded rekeys are visible to all consumers - signTransaction throws InvalidTransactionError when the decoded transaction sets reKeyTo unless the caller passes allowReKeyTo: true - unit tests cover explain (pay/axfer) and sign (reject + opt-in) Ticket: CSHLD-2171 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2123b21 to
1220edf
Compare
|
Review verdict: Approve (static review of the diff; tests not run locally, CI is green on
Non-blocking follow-ups:
A human code owner should still sign off, since this touches the ALGO signing path. |
Summary
Fixes a "what you see is not what you sign" gap in ALGO:
explainTransactionnever reportedreKeyTo, andsignTransactionsigned the rebuilt transaction including the rekey. An attacker who controls the removable-drive file could swap in apay/axferthat keeps the displayed sender/recipient/amount but rekeys the account, getting operators to approve a hidden transfer of account authority.Transaction.toJson()andTxDatanow emitreKeyTo(encoded address) for any decoded transaction that carries it.Algo.explainTransactionsurfacesreKeyToin the explanation anddisplayOrderfor pay, axfer, and keyreg transactions, and now prefershalfSigned.txHexovertxHexso it explains the exact bytessignTransactionwill sign. (acfg/afrzalready fail closed withNotSupportedin the builder factory.)Algo.signTransactionthrowsInvalidTransactionErrornaming the rekey target when the decoded transaction setsreKeyTo, unless the caller passesallowReKeyTowith the exact approved rekey address (newstringoption on algo'sSignTransactionOptions); a mismatched address also throws. Covers the half-signed path. Flows that never rekey (includingrecover()unsigned sweeps) are unaffected.buildOnlineKeyRegTransaction,buildOfflineKeyRegTransaction) now passthis._reKeyToso rebuilt bytes preserve the rekey.Follow-up (separate repo, offline-vault-console): display
explanation.reKeyToprominently on the OVC review screen. The sign-side guard already makes the OVC flow fail closed without it.Ticket: https://linear.app/bitgo/issue/CSHLD-2171/high-bitgojs-algo-explaintransaction-omits-rekeyto-so-ovc-signs-a
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com