fix: sanitize terminal hints and hide secret values

FE
2mo ago
+29-10

Fixes #246. Fixes #283.

API-provided approval and next-action hints could emit terminal controls, and a secrets.set hint could print the secret value. Reuse the existing C0/C1/DEL sanitizer for human-readable hints and always render <value> for a secret-setting command. The JSON response and ordinary hint text remain unchanged.

Validation: the nine new regressions fail on the baseline and pass with the fix; typecheck, 1,993 tests across 100 files, and whitespace checks passed. Independent review and four mutations covered secret disclosure and approval/next-action/C1 sanitization. No formatter or linter scripts are configured. No cloud QA needed for these local formatters.


Summary by cubic

Fixes #246 and #283 by sanitizing terminal control characters from API-provided approval and next-action hints, and preventing secrets.set hints from printing secret values.

  • Moves the C0/C1/DEL sanitizer into src/util.ts and applies it to approval and next-action hint text.
  • Renders secrets.set commands with <value> instead of the actual secret.
  • The JSON response and ordinary hint text are unchanged.
  • Adds regression tests for control-character removal across all hint types and secret value redaction.