Repository navigation
fix: bind native placeholders to their chain (M-365); never replay writes after re-login (M-366) - #22
Merged
Merged
Conversation
…er re-login M-365: token lookup with a chain kept every EVM native placeholder (0x0…0 / 0xE…E) from any chain, relabelled it as the requested chain and kept its symbol, and assertTokenOnChain let placeholders through. `$POL --chain base` could therefore be confirmed as POL and executed as Base ETH; Solana accepted EVM placeholders too. - a placeholder entry is only kept when its symbol is the requested chain's native coin (ETH listed on Ethereum may be used on Base, POL may not); never on Solana; assertTokenOnChain enforces the same rule - placeholder entries are ranked and shown on the chain they execute on, so a foreign native entry no longer sorts ahead of real tokens - typing the placeholder itself with a chain resolves directly to that chain's native token M-366: after a 401 the interactive re-login replayed the original request whatever it was, and the same-account check only blocked when both identities were known and differed. - only read-only requests are retried: GET, plus POST endpoints marked `replayable` (swap quote, activities, statuses, price analysis); a trade, transfer, order, cancellation or account change is never re-sent, and the user re-runs the command to confirm it with current prices - the account check fails closed: user ids, else server-returned emails, must match; with nothing to compare there is no retry - after a same-account renewal, later requests of the same command use the new token instead of prompting again (they are sent for the first time after the re-login, not replayed) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the two minara-cli v0.5.2 findings from the December 3 bounty batch. Both were confirmed against
main(3d75b6f).M-365: another chain's native placeholder accepted as a token on the requested chain
Before:
lookupToken(…, { chain })kept every EVM native placeholder (0x0…0/0xE…E) from any chain. It relabelled the entry as the requested chain but kept the entry's symbol and name, andassertTokenOnChainskipped placeholders. Soswap -t '$POL' --chain basecould be confirmed as POL and executed as Base ETH. Solana accepted EVM placeholders too.Now:
NATIVE_SYMBOLStable). ETH listed on Ethereum may be used on Base; POL may not. Placeholders are never kept on Solana.assertTokenOnChainenforces the same rule. It throws "$POL (0x0…0) would execute as the native token of Base ($ETH), not $POL".M-366: blind replay after re-login; account check fails open
Before: after a 401, the interactive re-login replayed the original request with the new token, whatever the request was: a swap, a transfer, an order, a cancellation or an account change. Nothing was re-confirmed and no quote was refreshed. The same-account check only blocked a replay when both identities were known and differed.
Now:
replayable(swap quote, activities, statuses, price analysis). For anything else the user sees "Signed in again … NOT sent automatically. Run the command again to review and confirm it with current prices." and the command exits. The rejected request never executed, so nothing is lost.Testing
npx vitest run: 438 passed (425 on main). New tests cover:assertTokenOnChain.npx tsc --noEmitreports no errors, and the build succeeds.Behavior changes
--chain Xwith a native ticker from another chain (for example$POL --chain base) now errors instead of trading the chain's native coin.Generated by Claude Code