Repository navigation
fix: close/market orders, token lookup and config hardening (bug bounty follow-up) - #19
Merged
Merged
Conversation
`pnpm install --lockfile-only` in #17 bumped vitest but kept the old transitive resolutions (vite 8.0.3, postcss 8.5.8, nanoid 3.3.11, source-map-js 1.2.1), which is what the 16 open Dependabot alerts point at. Regenerating the lockfile resolves them to the same versions as package-lock.json (vite 8.4.0, postcss 8.5.34, nanoid 3.3.20, source-map-js 1.3.0). `pnpm audit`: no known vulnerabilities. Dev-only dependencies; the published package is unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
… balance - close: read positions through normalizeWalletSummary(), so sub-account summaries in Hyperliquid's raw shape (marginSummary + assetPositions) are recognised instead of reporting "No open positions" (M-172) - market open / close / ask quick order: send an IOC limit order at the slippage-bounded price instead of a TP trigger order, which only fires once the trigger price is crossed, so "closed" positions could stay open (based on #13 by @tae9898) - order: --tpsl is now rejected with a clear error rather than silently turning an intended stop-loss into an immediate market fill - sweep: check and display the selected wallet's live withdrawable balance instead of the cached equityValue; explain when funds are locked as margin Co-authored-by: tae_98 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
…-chain tokens Addresses M-191, M-291, M-170 and M-208: - `$TICKER` lookups no longer fall back to fuzzy results when no symbol matches exactly; they fail with the similar results listed - a single search result is only accepted without prompting when its symbol or address matches the input exactly; anything else is shown for explicit selection - transfer / withdraw / limit-order / swap --chain pass the chosen chain to lookupToken, which only offers candidates on that chain (and picks the right one when the same address exists on several chains); EVM native placeholders stay chain-agnostic - the picker shows the full contract address (CLAUDE.md display rule) and market cap, sorts by chain gas cost then market cap so the real token is first, and warns when one chain has several tokens with the same symbol - third-party symbol / name are capped at 24 / 64 characters (M-199) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
… tables - `minara config`: turning off Touch ID or transaction confirmation now requires Touch ID verification when Touch ID is enabled on macOS (M-250 / M-254 / M-278 / M-200). On other platforms Touch ID cannot run (fund operations already fail closed there), so it can still be switched off. Editing ~/.minara/config.json directly remains possible: a client-side check cannot stop a process running as the same user. - token / stock / spot tables, token labels and the transaction confirmation cap third-party symbols / names at 24 / 64 characters, limiting how much text a token can inject into terminal or agent context (M-199) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
…ookup Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
kuzane
pushed a commit
that referenced
this pull request
Nov 30, 2026
Ships #19 (perps execution and token lookup fixes) together with this PR's release hardening, pinned dependencies, response sanitization and Hyperliquid order formatting / result checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
kuzane
added a commit
that referenced
this pull request
Dec 2, 2026
…checks, December bounty fixes; release v0.5.2 (#20) * ci: harden the npm release workflow and add PR checks publish.yml - pin actions/checkout (v7.0.1) and actions/setup-node (v7.1.0) to full commit SHAs instead of movable tags - empty workflow-level permissions; the job gets contents:read + id-token:write only - run in a protected `npm-publish` environment (add required reviewers in repo settings so a release can't publish on its own) - Node 24 with an npm >= 11.5.1 check, so npm trusted publishing (OIDC) works as soon as it is configured on npmjs.com; until then npm falls back to NPM_TOKEN - `npm publish --provenance --access public` - fail if the release tag doesn't match package.json version - `npm ci --ignore-scripts` (no dependency needs install scripts), no dependency cache and no persisted git credentials in the release job ci.yml (new) - type check, tests, build and production `npm audit` on Node 20/22/24 for every pull request and push to main; read-only token, no secrets (pull_request, not pull_request_target), so fork PRs are safe Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * build: publish npm-shrinkwrap.json so installs use pinned dependencies `npm i -g minara` used to resolve chalk / commander / inquirer / ora / cli-table3 and their dependencies fresh at install time, so a compromised upstream release could reach users without any change in this repo. `npm shrinkwrap` turns package-lock.json into npm-shrinkwrap.json, which npm honours for consumers. It is added to `files` so it ships in the tarball (verified: a packed install gets exactly the pinned versions). `npm ci` in CI keeps working unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * fix(output): sanitize every API response at the boundary - move sanitizeTerminal / sanitizeDeep to a dependency-free src/sanitize.ts (re-exported from utils.ts, so imports are unchanged); sanitizeDeep gains a `multiline` option - the API client now strips terminal control sequences, C1 and bidi override characters from every string in every response (JSON and non-JSON, success and error), keeping line breaks; Hyperliquid public API responses (coin names, leverage, fills, orders) get the same treatment. Display paths can no longer forget to sanitize server data. - names shown on a single line (wallets, strategies, subscription plans, checkout URLs, order errors, token address in limit-order) are also sanitized in single-line mode so a newline can't fake extra rows Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * docs: document pinned dependencies, provenance, boundary sanitization and client-side limits Also drops the stale note about the OAuth callback server (removed in #17). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * fix(perps): follow Hyperliquid tick/lot rules and check per-order results Market orders, closes and the ask quick order priced the IOC limit with `(mark * 1.01).toPrecision(5)`. That gives "3535.0" (a trailing zero changes the signed payload) and "1.0201e+5" once a price passes 100,000, and it ignored the `6 - szDecimals` decimal limit. Hyperliquid also answers status "ok" when an individual order is rejected, so an IOC that found no liquidity was reported as "submitted" / "closed" (the original symptom in #13). - new src/hl-format.ts: price formatting per the official SDK (5 significant figures, then 6 - szDecimals decimals, plain decimal string), size formatting, user price/size validation, and a parser for per-order statuses wherever the backend nests them - order / close / ask use it; user-entered --price / --size are checked against the asset's tick and lot size before anything is sent (with the nearest valid price as a hint) and sent without trailing zeros - new orders under Hyperliquid's $10 minimum are refused up front - after submitting, the CLI reports the filled size and average price, warns on partial fills, and exits non-zero when Hyperliquid rejected the order; `perps close --all/--symbol` lists partial or rejected closes as failures and sets exit code 1 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * chore: release v0.5.2 Ships #19 (perps execution and token lookup fixes) together with this PR's release hardening, pinned dependencies, response sanitization and Hyperliquid order formatting / result checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * ci: publish from the tag-only "release" environment Folds in #21. NPM_TOKEN moves to an environment secret of "release", which only v* tags may deploy to (tags are admin-only), so a workflow pushed on a branch can no longer read it. The trusted-publisher setup on npmjs.com should name this environment too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * fix: close the remaining CLI findings from the December bounty table - perps cancel / limit-order cancel (M-316): cancelling may remove a stop-loss or take-profit, so both now use the transaction confirmation (single prompt, full order details) and Touch ID like placing an order; perps cancel reads frontendOpenOrders and warns when the order is reduce-only or a TP/SL trigger - perps order on a sub-wallet: leverage is read from that wallet's address, never the default wallet's; the preview and confirmation show the wallet and its leverage - damaged config.json (M-353): an unreadable or non-object config no longer falls back to defaults silently; fund operations fail closed until it is fixed or rewritten via `minara config`. Config and credentials are written atomically (temp file + rename) - logout (M-352): a failed server-side revocation is reported as a failure and local credentials are kept so it can be retried; `--local` clears them anyway; a 401 counts as already logged out and no longer triggers the re-login flow - swap (M-333 / M-337 / M-348): the quote is always fetched and shown, also with -y (not printed with -y --json); quotes with slippage tolerance or price impact above 10% are refused (--max-slippage / --max-price-impact); an unattended -y swap is never sent without a quote - Solana recipients (M-351): must base58-decode to a 32-byte key; off-curve (non-wallet) keys get a warning - terminal sanitization (M-332): also strips zero-width characters, soft hyphen, BOM, word joiner, variation selectors, Unicode tag characters and other invisible format characters, and treats U+2028/U+2029/NEL as line breaks; token picker addresses are sanitized explicitly too - base URL (M-316): loopback hosts are only accepted with MINARA_DEV=1, so a development base URL left in the config cannot send the token to whatever later listens on that local port Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 --------- Co-authored-by: Claude <[email protected]>
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 remaining minara-cli items from the full bug-bounty table (checked against v0.5.1). Each commit covers one area and can be reviewed on its own.
1. Close / market orders actually execute —
d139239(M-172, based on #13)perps closenow reads positions throughnormalizeWalletSummary(). Before, sub-account summaries in Hyperliquid's raw shape (marginSummary+assetPositions) were reported as "No open positions", so the position could not be closed.perps askquick order are now sent as IOC limit orders at the slippage-bounded price (mark ±1%, or--price). Before, they were sent as TP trigger orders (isMarket: true), which only fire once the trigger price is crossed, so a "closed" position could stay open. The idea comes from fix : close command fails to execute on Hyperliquid #13 by @tae9898, who is credited as co-author.--tpslis now rejected with a clear error. With IOC it no longer has a meaning, and silently accepting it would turn an intended stop-loss into an immediate market fill.perps sweepchecks and shows the selected wallet's live withdrawable balance instead of the cachedequityValue, and explains when funds are locked as margin.2. Token lookup can't silently pick a lookalike or off-chain token —
071fddb(M-191, M-291, M-170, M-208)$TICKERlookups no longer fall back to fuzzy results when no symbol matches exactly. They fail and list the similar results.transfer/withdraw/limit-order/swap --chainpass the chosen chain tolookupToken, which then only offers candidates on that chain. When the same address exists on several chains, it picks the one on the chosen chain. EVM native placeholders stay chain-agnostic.3. Lowering protections needs Touch ID; token text is length-capped —
e6203a4(M-250, M-254, M-278, M-200, M-199)minara config, turning off Touch ID or transaction confirmation requires Touch ID verification while Touch ID is enabled on macOS. On other platforms Touch ID can't run (fund operations already fail closed there), so it can still be switched off.4. Dev dependency alerts —
049cb8epnpm-lock.yamlis regenerated. fix: close remaining validation gaps and bound AI quick orders #17 had only bumped vitest there, so vite / postcss / nanoid / source-map-js stayed on vulnerable versions. This clears the 16 open Dependabot alerts.pnpm auditreports no known vulnerabilities. These are dev-only dependencies; the published package is unchanged.5. Docs —
d7327f9README covers IOC market orders, the config re-auth and the stricter token lookup.
Behaviour changes
perps order --tpsl …now errors.$TICKERwith no exact symbol match now errors instead of picking a fuzzy result.-yshould pass contract addresses.Not addressed here (needs server-side work)
~/.minara/config.jsondirectly can still disable confirmations: a client-side check can't stop a process running as the same user.Testing
npx vitest run: 362 passed (was 343). New tests cover:assetPositionsshape--tpslrejection and the sweep live balancenpx tsc --noEmitclean; the build and the--helpoutput were smoke-tested.minara perps close, and confirm it is actually closed on Hyperliquid. The order-type change can't be exercised against the live exchange in unit tests.Generated by Claude Code