Repository navigation
fix: escape terminal controls and bound transcript ordinals - #76
Merged
Merged
Conversation
Render externally derived text in human output (owner arguments, cwd, TTY, lock and transcript paths, event types, blockers, warnings, reasons, and stderr error text) with visible escapes for C0, DEL, C1, and Unicode bidirectional or line-separator controls. Prompt text, directory names, or transcript content can no longer move the cursor, drive terminal features, or forge result lines. JSON output keeps the original values under standard JSON escaping. Emit transcript ordinals only when they are non-negative safe integers and null otherwise, so inspect, list, and unlock JSON always satisfy the v1 schema. Closes #54 Closes #56
abruption
force-pushed
the
fix/output-integrity
branch
from
September 29, 2026 00:33
4be72f0 to
d533981
Compare
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
#54 (terminal control sequences in human output,
src/cli.ts)terminalSafe()renders C0, DEL, C1 (including ESC) and Unicode bidi/line-separator controls (U+061C, U+200E/F, U+2028/9, U+202A–E, U+2066–9) visibly as\n,\r,\t,\xHH, or\uHHHH.LAST EVENTcolumn and empty-list Codex home inlist, blockers/warnings/reasons, the three stderr error paths, and thecheck-updatecache warning.listcolumn widths use the escaped length.#56 (non-integer transcript ordinals,
src/transcript.ts)ordinalis emitted only whenNumber.isSafeInteger(value) && value >= 0; otherwise it isnull. The schema is not widened.Closes #54
Closes #56
Type
Safety impact
No change to lock probing, owner validation, signaling, or safety decisions. Human output can no longer be used to forge lines (for example a fake
Safe to unlock: yes) or send terminal control sequences. JSON schema and types are unchanged; ordinal values that violated the schema are nownull.Checklist
npm run checkpassesnpm run lintpassesnpm testpasses (118 pass, 0 fail)npm run smoke:packagepassesTests
inspect,list, andunlockhuman output contain no raw C0/C1/\r, no forged line starting withSafe to unlock: yes, exactly twolistlines, and the escaped forms.3,1.5,-1,2^53,1e308, and"4":inspect,list, andunlockJSON validate against the schema with ajv.Notes
\x1bis indistinguishable from an escaped ESC in human output. Line forgery and terminal control are still prevented.ps/lsofalready render control characters in argv and cwd as^[, so the raw-byte path for those two fields is exercised on the Linux CI runners; transcript and stderr paths are raw on both platforms.no-control-regexlint suppression is scoped to the intended pattern with a justification comment.