Files
ObsidianDragon/tools/__pycache__/chat_regtest.cpython-310.pyc
T
DanSandClaude Opus 4.8 6bb72f9878 fix(input): strip Unicode/CJK whitespace across address, key, and URL inputs
Follow-up to the key-import fix: an audit found the same ASCII-only-trim pattern
across the input layer, where a pasted value carrying CJK full-width (U+3000),
NBSP, zero-width, or BOM whitespace survived trimming and then failed validation
or an RPC. Most paths failed closed (same value validated and acted on → "won't
work" rather than a wrong send), but several mattered — above all the Lite
Import Key path, the exact recurrence of the reported bug on the Lite variant.

Single-token inputs (keys, addresses, URLs) now go through
util::stripAllWhitespaceForKey; path/label inputs use the new
util::trimUnicodeWhitespace (edge-trim, preserves internal spaces):

- Lite Import Key (settings_page) — strip-all before importKeyAsync. [fund recovery]
- Lite wallet path (open/restore) — edge-trim the request path AND the empty gate
  (they had diverged: gate trimmed, request used raw).
- Contacts — gate on and save the cleaned label/address; clean on paste; an
  address never persists with stray whitespace (which silently broke every later
  use + defeated duplicate detection).
- Send recipient — strip-all on paste and on field edit, so a CJK-pasted valid
  address validates and sends.
- Chat new-conversation z-address — validate and send the cleaned value.
- Chat restore-by-address — strip-all (the old trim even missed '\r'), so a
  padded address matches the deleted list instead of broadcasting a junk memo.
- Mining pool URL + payout — strip-all at persist and in the payout check.
- Validate-address dialog — strip-all before classify.
- Lite custom server URL — strip-all; its label edge-trimmed.
- Payment URI — strip-all the parsed address.
- Defense-in-depth: importPrivateKey / sweepPrivateKey strip-all the key;
  importWalletFile edge-trims the path.

Adds trimUnicodeWhitespace coverage to testKeyInputSanitization. Build + tests +
hygiene green. (Deferred, noted for follow-up: the console tokenizer treating
Unicode whitespace as a separator, and repairing already-polluted address-book
entries on load.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-15 12:11:54 -06:00

8.5 KiB