caelum0x 143ad32a84 fix(cli,tui): sanitize CardholderName on ration status/card list and the TUI Cards tab + adjust-limit modal
CardholderName is operator-authored free text (ration card issue
--cardholder, and the TUI's own issue-card form) — the same class of
terminal-escape-injection risk already closed for Trigger/Rationale/
PolicySnapshotJson. card.go's printCard (card issue/get/adjust-limit/
close) already sanitized it, but status.go's printCards (used by both
`ration status` and `ration card list`) printed it raw, and the TUI's
Cards tab table (view/cards.go) and the adjust-limit modal's infoLine
(model/cardform.go) did too. A cardholder name containing an ANSI
escape sequence would inject into `ration status` output — the single
most commonly run command in this whole repo's demo flow — and into
the TUI dashboard a judge/operator is meant to watch live.

Fixed all three raw render sites to go through the same
sanitizeControlChars/format.SanitizedCell/textsanitize.StripControlChars
helpers already used everywhere else free text is displayed.

Verified live against the real bare-metal 8-service stack: issued a
card with a cardholder name containing a real ESC (0x1b) byte +
"[31;1mINJECTED[0m", confirmed `ration status` and `ration card list`
output now contain zero raw ESC bytes (byte-counted, not just visual),
and drove the real TUI through a tmux pty — both the Cards tab table
and the adjust-limit modal's header render the literal bracket text
with no live escape sequence. go build/go vet/go test clean for cli
and tui, gofmt clean, 0 regressions.
2026-10-29 13:36:20 +03:00
..