Skip to content

fix(cli): show control characters in printed names as visible escapes - #8008

Merged
michaelwang11394 merged 13 commits into
mainfrom
sec-low22a-1117
Nov 18, 2026
Merged

michaelwang11394 merged 13 commits into
mainfrom
sec-low22a-1117

Conversation

@michaelwang11394

@michaelwang11394 michaelwang11394 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What

  • check, info, compositions, benchmark, play, present, preview, render, cloud render and open print the project folder name and path with control characters shown as visible escapes. This covers the preview summary and the --status, --stop, --list and --kill-all lines, a failed background preview start, the check report path, snapshot paths and failed media lines, the finished render's output path and the batch render lines, and the warnings that quote them. The play page HTML-escapes the name.
  • preview --selection and --context escape the selected element's label, source file, target and thumbnail URL, and the preview server's project name.
  • cloud get, cloud list and cloud delete escape the render fields the server returns, including the failure message, title and next-page token. publish escapes the title and URL the server returns. publish and cloud render escape file names in left-out warnings, and cloud render escapes the archive name in upload progress lines.
  • The live inspection stamp gives the preview page only the generation id. The project path stays with the host that prepared the page.
  • skills/hyperframes/scripts/locate.mjs copies its grid font into a private per-run folder made with mkdtemp (mode 0700). It escapes that path for ffmpeg's filter syntax and removes the folder when the run ends or is stopped by SIGINT, SIGTERM or SIGHUP. The skills manifest hash is regenerated.
  • play, present and the sign-in callback page share one HTML escape helper.

Why

A folder name, a composition or a server response can carry terminal escape sequences. Printed raw, they can move the cursor, rewrite earlier lines, set the window title or write the clipboard. A composition script on an inspected preview page could read the absolute project path, which shows the account name and folder layout. A fixed font path in the shared temp folder could be created first by another account on the same machine.

Related work

Follows #7913 and #7958, which escape other CLI output with the same terminalText helper from core.

How

Each line that prints outside text passes it through terminalText, terminalLines or terminalTextDeep. The CLI's own colours are applied after escaping, so they stay. --json output is unchanged.

No visible change

Ordinary names, paths and server fields print exactly as before. Only control characters now show as \x1b-style text.

Test plan

fails without the fix: the new folder-name tests in info, compositions, check, checkArtifacts, benchmark, play, present, preview, render/present and cloud/render.terminal.test.ts (folder name, upload progress and left-out warnings); the render output-path test; the batchRender row-path test; the publish left-out test; open.terminal.test.ts; the check snapshot-path and failed-media tests; the preview background-start and lint-failure tests; the present invalid-island test; the publish title and URL test; preview --selection and --context on a terminal; cloud/terminalOutput.test.ts; inspector/tests/liveStamp.test.ts; skills/hyperframes/scripts/locate.test.mjs.

  • Touched CLI tests pass (39 files, 911 tests)
  • Inspector tests pass (13 files, 80 tests)
  • node --test skills/hyperframes/scripts/locate.test.mjs passes
  • tsc --noEmit for cli and inspector
  • oxlint and oxfmt
  • fallow, lint:skills, skills manifest in sync
  • Comment ratchet and citation check

…capes

check, info, compositions, benchmark, play, present and preview printed the
project folder name, and in places the project path, straight to the
terminal. A folder name can hold escape bytes on Linux and macOS, so a
received project could move the cursor, rewrite earlier lines, set the
window title or write the clipboard. Those lines now go through
terminalText(), as validate, snapshot, layout and lint already do. This
covers the preview summary, --status, --stop, --list and --kill-all lines,
and the check report path. The CLI's own colours stay, and --json output is
unchanged.

The play page also HTML-escapes the name in its title and footer, as the
present page does.
…ble escapes

The human output of preview --selection and --context printed the selected
element's label, source file, target and thumbnail URL, and the preview
server's project name, straight to the terminal. These come from the
composition or from whichever preview server answers, so control characters
in them could move the cursor, rewrite earlier lines, set the window title
or write the clipboard. They now go through terminalText(), as do the
failure messages these commands print. The CLI's own colours stay, and
--json output is unchanged.
…scapes

The human output of cloud get printed render fields from the server, such
as the failure message, title, composition and URLs, straight to the
terminal. A failure message can quote text from the rendered project, so
control characters in it could move the cursor, rewrite earlier lines, set
the window title or write the clipboard. cloud get, cloud list (rows and
the next-page token) and cloud delete now pass those fields through
terminalText(). The CLI's own colours stay, and --json output is unchanged.
…eration id

prepareLiveInspection wrote the project's absolute path into the preview
page as window.__hfLiveInspection.project. Nothing in the page reads it, but
any composition script on that page could, which told it the account name
and folder layout. The page now gets only the generation id; the project
path stays with the host that prepared the page.
locate.mjs drew its grid labels with a font at the fixed shared path
/tmp/locate-font.ttf. It used whatever file was already there and copied a
system font onto that path otherwise, following any link in its place. On a
machine shared with other accounts, someone else could plant that file
first, so the grid showed wrong numbers, a file appeared where they chose,
or every run failed.

The font is now copied into a folder made with mkdtemp (mode 0700) for each
run and removed when the run ends, so no file another account can create is
read or written. The skills manifest hash is regenerated.
…e.mjs font cleanup

check's report path notice and its not-recorded warning, and preview's
"Lint did not finish" warning, now print control characters as visible
escapes, like the other lines that carry the project path.

locate.mjs escapes the font path for ffmpeg's filter syntax, so a temp
folder with ':', ',', quotes or brackets in its name still works, and it
removes its font folder when the run is stopped by SIGINT or SIGTERM before
re-raising the signal.

play and present share one HTML escape helper.
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 67 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escapes the listed CLI sinks with the shared core helpers, moves the live inspection stamp down to the generation id, and puts locate's font copy in a private temp folder. Every fix the body names is correct and tested. Some lines in check and preview were missed, and four sibling commands still print the same folder name raw, so I'm asking for changes.

Strengths

  • One helper for every sink: terminalText / terminalLines / terminalTextDeep from packages/core/src/terminalText.ts, applied after colouring is decided and never to --json output. The tests pin both sides, for example packages/cli/src/commands/info.test.ts asserts the escaped human line and the raw --json name.
  • packages/cli/src/utils/escapeHtml.ts:1 replaces the private escHtml that present.ts had, and play.ts:314 now uses it for the <title> and the info line that were raw before.
  • packages/inspector/src/live.ts:51 now writes the same stamp shape service.ts:262 already wrote. Every reader (liveRuntime.ts:4, pageQueries.ts:57,68,92, elementMap.js:91) only reads .generation.
  • skills/hyperframes/scripts/locate.mjs:60 escapes in the right order: option level (\ ' :) first, then filtergraph level (\ ' [ ] , ;). gridFilters puts the path in fontfile= unquoted, which is what this escaping assumes. The CodeQL "double escaping" alerts on this line and on locate.test.mjs:60 are false positives: the backslash is escaped twice on purpose, once per level.
  • Every test the body lists would fail on the base branch. Each one asserts the escaped \x1b text, the stamp shape or the private folder, and none of them only checks that nothing crashed.

Blockers

All of these print the folder name (basename(dir), utils/project.ts:50) or the absolute project path raw at this head.

  • Commands this PR touches:
    • packages/cli/src/commands/check.ts:897: check --snapshots prints each finding crop with c.dim(file). Those entries are absolute paths: checkBrowser.ts:707 pushes join(snapshotDir, filename), and checkSnapshotDirectory.ts:14 resolves the project. A cached pass replays the same list.
    • packages/cli/src/commands/preview.ts:548: background start prints clack.log.error(message) raw. With --force-new or a GPU-mode replacement, startBackgroundPreview calls stopBackgroundPreview (previewLifecycle.ts:541). That throws background preview did not stop for ${resolve(projectDir)} (:766) or preview ownership could not be proven for ${resolve(projectDir)} (:525, :759). Lines 542-550 duplicate reportPreviewFailure (preview.ts:745), which now escapes, so calling it there fixes this and leaves one path.
  • Sibling commands with the same failure:
    • packages/cli/src/commands/render/present.ts:37: hyperframes render prints "Rendering " and the output path, which defaults to inside that folder.
    • packages/cli/src/commands/cloud/render.ts:701: "Zipping ".
    • packages/cli/src/commands/open.ts:103: "Opening in ...".
    • packages/cli/src/commands/publish.ts:295: the published title the server sends back, which comes from the folder name.

A folder named like the one in your tests still sets the window title or writes the clipboard (OSC 52) through any of these. render is the most-used command. Each fix is a one-line terminalText(...) wrap plus a test shaped like the ones here.

Important

  • packages/cli/src/commands/check.ts:492: check --prepare-media prints ${file.file}: ${file.reason} raw. file.file is a media file name from the project, and reason is the ffmpeg error text. Wrap the line in terminalLines.

Nits

  • packages/cli/src/auth/callbackPage.ts:41 keeps its own escapeHtml, which also escapes '. Folding it into utils/escapeHtml.ts (with the ' case added) leaves the CLI with one HTML escaper.
  • skills/hyperframes/scripts/locate.mjs:68-73: with a SIGINT/SIGTERM listener installed, Node handles the signal only after the synchronous execFileSync calls return. A SIGTERM sent to overlay therefore no longer stops it between the two ffmpeg calls; cleanup still happens through the exit handler. A closed terminal (SIGHUP) is not listened for, so the folder stays behind in that case.

Verdict: REQUEST CHANGES
Reasoning: Each named fix is correct and has a test that fails without it. But check --snapshots and the background preview start still print the untrusted folder name raw, and so do render, cloud render, open and publish. Each one is a concrete repeat of the bug this PR fixes, with a one-line fix.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes at 64b97c6. I agree with Miguel's review on this sha and checked his blockers against the source.

The fixes the body names are correct, and each one has a test that fails without it. Against base sources the CLI suite fails 16 of 360 (every new test), liveStamp 1 of 1, and locate 1 of 2. Four of five mutants were killed. But the PR's claim is that folder names no longer reach the terminal raw, and these prints still send them raw at this head. With a folder named, for example, x\x1b]52;c;...\x07, any of these lines writes the user's clipboard.

Blockers

  • packages/cli/src/commands/check.ts:897: check --snapshots prints each finding crop path with c.dim(file). These are absolute paths under the project folder, and check is a command this PR touches.
  • packages/cli/src/commands/preview.ts:548: when a background start fails, clack.log.error(message) prints the message raw. With --force-new, that message is the previewLifecycle.ts error that contains resolve(projectDir). reportPreviewFailure (:745) already escapes the same message, so calling it here fixes the leak and removes the duplicate code.
  • The same raw print in other commands: render/present.ts:37 ("Rendering ", and an output path that defaults to <name>_<ts>), cloud/render.ts:701 ("Zipping "), open.ts:103 ("Opening "), and publish.ts:295 (published.title, which the server derives from the folder name).

Important

  • check.ts:492: check --prepare-media prints ${file.file}: ${file.reason} raw. That is a project media file name plus ffmpeg's error text, and terminalLines fixes it.

Non-blocking

  • The only failing check is CodeQL js/double-escaping at locate.mjs:60. It's a false positive, because ffmpeg escapes once for the option and once for the filtergraph. Someone still has to dismiss the alert or restructure the code. I ran real ffmpeg with TMPDIR set to t'm,p:[x];y: it exited 0 and the temp folder was cleaned up.
  • No test covers the escaping of present's invalid-island-JSON error (present.ts:121); the mutant that removed it survived.
  • locate.mjs has no SIGHUP handler, so closing the terminal leaves its temp folder behind.
  • For follow-ups outside this PR: the shared terminalText helper doesn't neutralise bidi overrides or zero-width characters, which can make a name display as something else. Studio's GET /api/projects/:id still returns the absolute dir.

— Rames

…ont path in one pass

The sign-in callback page uses the shared escapeHtml helper, which now also
escapes single quotes.

locate.mjs escapes the font path for ffmpeg's option list and filtergraph
in a single replacement with the same result as before, and removes its
font folder on SIGHUP as well as SIGINT and SIGTERM.
@michaelwang11394

Copy link
Copy Markdown
Contributor Author

Thanks, Miguel and Rames. The changes are in 4a25169. That one commit holds all the fixes below; its message names only the last two groups because the separate commit for the CLI fixes was rejected by commitlint for a long header.

Blockers

  • check --snapshots printed snapshot and finding crop paths raw. Both lists now go through terminalText. Fixed in 4a25169, with a test that fails without it.
  • A failed background preview start printed its error raw. It now calls reportPreviewFailure, which escapes the message, so the duplicate branch is gone. Fixed in 4a25169, with a test that fails without it.
  • render printed "Rendering " and the output path raw. Both are escaped now. Fixed in 4a25169, with a test.
  • cloud render printed "Zipping " raw. Fixed in 4a25169, with a dry-run test.
  • open printed "Opening " raw. That line, the stop command and the stop-failure message are escaped now. Fixed in 4a25169, with a test.
  • publish printed the server's title raw. The title, the URL and the left-out file warnings are escaped now. Fixed in 4a25169, with a test.

Important

  • check --prepare-media printed failed media lines raw. The line now goes through terminalLines. Fixed in 4a25169, with a test.

Nits and non-blocking items

  • The sign-in callback page now uses the shared escapeHtml, which also escapes single quotes. Fixed in 4a25169.
  • CodeQL js/double-escaping on locate.mjs and locate.test.mjs: the font path is now escaped in a single replacement that maps each character to its two-level form. The output is identical to the previous two-pass version, which was checked against real ffmpeg. The test now spells the expected filter path literally. Fixed in 4a25169.
  • locate.mjs now removes its font folder on SIGHUP as well as SIGINT and SIGTERM. Fixed in 4a25169, with a test for a stopped run.
  • A stop signal is still handled only after the ffmpeg call in progress returns, because the script calls ffmpeg synchronously. Each call renders one image, so the wait is short. Removing the wait would mean making the ffmpeg calls asynchronous. That is a larger change, so I left it, and the code comment now says so.
  • The present invalid-island error now has a test. It uses a folder name with control characters, so removing the escape fails it. Fixed in 4a25169.
  • Bidi and zero-width characters in terminalText, and the absolute dir from Studio's GET /api/projects/:id, are outside this PR. I left both for follow-ups.

--json output is unchanged. Checks run: touched CLI tests (34 files, 678 tests), inspector tests, the locate tests, tsc, oxlint and oxfmt, fallow, lint:skills, the comment ratchet and the citation check.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes at 4a251694. Every item from my last review is fixed and tested: check.ts:897, preview.ts:548 (now reportPreviewFailure), present.ts:37, cloud/render.ts:701, open.ts:103, publish.ts:295, check.ts:492, the untested present.ts:121, SIGHUP in locate.mjs, and the shared escapeHtml. CodeQL is green, and the escaping is now one lookup table; I fuzzed it against the old two-pass version on 200k strings with 0 mismatches. 7 of 8 mutants on the new escapes are killed.

Two blockers remain. Both are one-line wraps, and I missed both in round 1. The body says render and cloud render now escape the folder name, but each still prints it raw on its normal success path:

  1. packages/cli/src/commands/render.ts:2174: printRenderComplete prints c.accent(outputPath) raw.
    • That path defaults to <project.dir>/renders/<project.name>_<ts>.mp4 (render/plan.ts:553), so every finished hyperframes render prints the folder name.
    • In the same function, :2178 prints desktopHint(projectDir) raw. The single quotes from shellArg don't remove ESC; preview.ts:1357 already wraps the same hint.
    • Fix: c.accent(terminalText(outputPath)) and c.dim(terminalText(hint)).
    • The --batch lines at batchRender.ts:368 (row.outputPath) and :468 (manifestPath) print the same kind of path.
  2. packages/cli/src/commands/cloud/render.ts:900: reportUploadProgress prints ${name}: N% …, and :995 passes ${project.name}.zip. That line prints on every non-JSON upload, right after the "Zipping" line this PR fixed. Fix: terminalText(name) at :900.

Follow-ups, not blocking (raw on base too, and not claimed in the body):

  • cloud/render.ts:
    • :753-754 left-out warnings (the same strings publish.ts:293 now escapes)
    • :838, :845, :915 and :924 (project file paths in offload and dry-run output)
    • :716 (font family from project CSS)
  • Other commands:
    • render.ts:1298 producer warnings
    • publish.ts:141 (candidate) and :247 (priorLink.url)
    • init.ts, feedback.ts, beats.ts, grade-compare.ts, capture/video.ts, templates.ts, figma/*, docs.ts
  • No test covers the escape on publish.ts:293; a mutant that removed it survived.

— Rames

A finished render printed its output path and the desktop app hint raw.
The default output path sits under the project folder and is named after
it, so the folder name reached the terminal on every render. Batch renders
printed row output paths and the manifest path raw, and cloud render
printed the archive name in its upload progress lines and walked file
names in its left-out warnings raw. These lines now go through
terminalText() or terminalLines(). --json output is unchanged.
@michaelwang11394

Copy link
Copy Markdown
Contributor Author

Thanks, Rames. Both blockers are fixed in b46799b, with tests that fail without the fix.

Blockers

  • render printed the finished output path and the desktop app hint raw. printRenderComplete now escapes both. The batch row and manifest lines in batchRender.ts are escaped too. New tests in render.test.ts and batchRender.test.ts.
  • cloud render printed the archive name in its upload progress lines raw. reportUploadProgress now escapes it. New test in cloud/render.terminal.test.ts, which makes the first upload attempt fail so the retry prints a progress line.

Follow-ups

  • cloud render left-out warnings: fixed in b46799b, with a test. Warnings for references are already escaped by leftOutWarning. Warnings for walked files, such as a private .env.* file the ignore file re-includes, came from publishProject.ts raw.
  • The escape at publish.ts:293 had no test, because only walked-file warnings reach it raw. It has one now, using the same re-included .env.* file.
  • The rest of your follow-up list is left for a later PR. The current base also prints these raw, and this PR doesn't claim them:
    • cloud render: offload and dry-run file paths, and the font family
    • render.ts:1298 producer warnings
    • publish.ts:141 and :247
    • init, feedback, beats, grade-compare, capture/video, templates, figma and docs

--json output is unchanged. Checks run: touched CLI tests (39 files, 911 tests), tsc, oxlint and oxfmt, fallow, the comment ratchet and the citation check. There is no conflict with origin/main, so I did not merge it.

# Conflicts:
#	packages/cli/src/commands/cloud/render.ts
@michaelwang11394

Copy link
Copy Markdown
Contributor Author

Merged main in 982fe45 to clear the conflict. The only conflict was in cloud/render.ts: main replaced the left-out warning helper with reportLeftOut. I kept main's version and put this PR's terminalLines escape inside it. Its test still fails without the escape. The touched CLI and inspector tests pass after a rebuild.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 982fe455. Both round-2 blockers are resolved, and the merge from main dropped nothing.

  • render.ts:2228 prints c.accent(terminalText(outputPath)), and the desktop hint at :2232 goes through terminalText.
  • cloud/render.ts:925: reportUploadProgress prints terminalText(name).
  • batchRender.ts:369 and :469: the batch row line and the Manifest: line are escaped too.
  • Merge: main's #7995 turned warnAndListLeftOut into reportLeftOut, and the resolution keeps terminalLines(warning) there.

Tests: 191 of 191 pass across render, batchRender, cloud/render.terminal and publish. All 4 mutants were killed: outputPath, upload name, the batch row, and reportLeftOut. CI is green.

Non-blocking:

  • cloud/render.ts still prints project file paths raw in offload and largest-file output, which the body doesn't claim to cover.
  • The desktop-hint and Manifest: escapes have no test.

— Rames

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 982fe45. Each point from the change request at 64b97c6, checked at this head:

Blockers: all resolved

  • check --snapshots: check.ts:892 and :897-898 now print each PNG and finding-crop path through terminalText. check.test.ts asserts the escaped path.
  • Background preview start: the failure branch now calls reportPreviewFailure (preview.ts:541-547), so the duplicate raw clack.log.error(message) is gone and the previewLifecycle.ts message containing the project path is escaped. The remaining raw clack.log.error(launchModeError) at :296 prints only fixed flag-conflict text from previewLaunchModeError (:684-705), so it is safe.
  • render: render/present.ts:38-40 escapes both the name and the output path. render.ts and batchRender.ts also escape their output paths (b46799b).
  • cloud render: "Zipping" escapes the name (cloud/render.ts:720), and so does the upload progress line (:925).
  • open: open.ts:105 escapes the name, and :99 escapes the stop hint.
  • publish: publish.ts:317 and :333 escape the server-sent title and URL.

Each of these has a test that asserts the escaped \x1b bytes (check.test.ts, preview.test.ts, render/present.test.ts, open.terminal.test.ts, publish.test.ts, cloud/render.terminal.test.ts, render.test.ts, batchRender.test.ts).

Important: resolved. check --prepare-media prints each failure through terminalLines (check.ts:492).

Nits: both resolved. callbackPage.ts now imports the shared escapeHtml, which gained the ' case, so the CLI has one HTML escaper. locate.mjs:79-80 also listens for SIGHUP.

Merge from main. The two conflict hunks are both in cloud/render.ts. The resolution keeps terminalText on "Zipping", and takes main's restructured staging. Main's reportLeftOut (:771-774) still prints the left-out warnings through terminalLines, so the merge drops no escaping.

CI is green at this head.

Verdict: APPROVE

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 17, 2026
# Conflicts:
#	skills-manifest.json
#	skills/hyperframes/scripts/locate.mjs
#	skills/hyperframes/scripts/locate.test.mjs
# Conflicts:
#	packages/cli/src/commands/play.ts

@eddy-heygen eddy-heygen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Eddy's agent) Reviewed by Eddy's Claude agent at commit affc910.

Verdict: approved (partial: remainder stated below).

Summary. The CLI printed project folder names, paths, file names from a project, preview-server answers and cloud-service response fields straight to the terminal, so control characters in them could act on the terminal instead of being shown. This PR passes those values through the existing core escaping helper at the print sites in 17 command files, HTML-escapes the project name on the play page, merges three HTML escape helpers into one, and stops writing the absolute project path into the inspected preview page. JSON output paths are unchanged. Some print sites in the touched files are still raw and a newline in a file name can still start a new line in three places; both are gaps the default branch already has and the PR narrows, so they are non-blocking remainders.

I read the escaping helper and a sample of the changed print sites myself. The helper turns control characters into visible text and leaves tabs alone; the multi-line variant keeps line breaks and escapes each line. The print sites the PR touches pass project names, paths, preview-server answers and cloud response fields through it, and the JSON output paths are built from the unescaped values, so scripts that parse them are unaffected.

What is left, already so on the default branch and narrowed by this PR: some print sites in the same files are still raw, and a line break inside a file name can still start a new output line in a few places. Both are listed below and are worth a follow-up; neither is new.

Blockers

None.

Non-blockers

  1. packages/cli/src/commands/cloud/render.ts:863: Several print sites in the touched files still print project- or server-controlled text raw. The PR escapes values one print site at a time, and some sites in the same files were not covered. cloud/render.ts:863 and 871-873 print a project media file path raw (describeOffload returns the path unescaped at line 970), and 976 prints the paths of the largest files raw, while the upload-progress line for the same archive is escaped. cloud/render.ts:377, 378 and 385 print the server's render id raw although delete/get/list now escape the same field. publish.ts:250 prints the stored URL of an earlier publish raw, and publish.ts:169 and 402 print caught error messages raw. batchRender.ts:388 prints a row's error message raw and 419 the manifest path raw, next to the two lines the PR did escape. A project whose media file name holds control characters therefore still reaches the terminal unescaped during a cloud render that offloads media. The default branch has the same gap at each of these lines; the PR narrows the class and does not widen it. To resolve: Wrap these values in terminalText / terminalLines as well, or escape once at the source (project resolution, cloud client response decoding, or inside the colour/print wrappers, as the error box already does) so new print sites are covered by default.
  2. packages/cli/src/commands/check.ts:492: A newline inside a file name still starts a new output line where the multi-line helper wraps a single record. terminalLines (packages/core/src/terminalText.ts:13-15) splits on newline and keeps the breaks. check.ts:492 applies it to one line built from a file name plus a reason, and cloud/render.ts:772-773 and publish.ts:314 apply it to left-out warnings that quote file names. A name that contains a newline followed by text that looks like a CLI status line is printed as its own line. Escape and other control characters are neutralised, so cursor movement, title and clipboard writes are closed; only plain extra lines remain. Before this PR these lines were fully raw. To resolve: Escape the file name with terminalText and use terminalLines only on the part that is meant to be multi-line (the reason or the fixed warning text).
  3. packages/cli/src/utils/escapeHtml.ts:1: PR description lists a skill-script change that is not in the diff. The body and test plan describe a font-path change in a skills script and a regenerated skills manifest hash. The diff against the merge base has 36 files, none under skills/; the main branch already holds its own fix for that script, so the merge from main dropped this part. A reader approving on the description would believe more is covered than the diff contains. To resolve: Remove the skills-script bullet and its test-plan line from the description.

What the change needed to do

  • Project folder name and path are escaped where check, info, compositions, benchmark, play, present, preview, render, cloud render and open print them: met (packages/cli/src/commands/preview.ts:1353 and the matching one-line changes in check.ts:350, info.ts:124, compositions.ts:200-209, benchmark.ts:103, play.ts:195, present.ts:146, render/present.ts:37-40, cloud/render.ts:720, open.ts:104 all wrap the value in terminalText; a search of commands/ for raw prints of project name/dir found none left in the changed files.)
  • preview --selection / --context escape label, source file, target, thumbnail URL and the server's project name: met (packages/cli/src/commands/preview.ts:1047-1053 and 1219-1226 wrap each field; failure messages go through terminalLines at 742 and 912.)
  • cloud get, list and delete escape fields the server returns, including failure message, title and next-page token: met (packages/cli/src/commands/cloud/get.ts:40 and list.ts:128 deep-escape the whole response before printing; list.ts:145 escapes the token; delete.ts:82 escapes the id. JSON branches return before the escaping.)
  • publish and cloud render escape server title/URL, left-out warnings and the upload progress name: partly met (publish.ts:314,317,333 and cloud/render.ts:772-773,952 are escaped, but cloud/render.ts:377-385, 863, 976 and publish.ts:250 still print server- or project-controlled text raw (see finding 1).)
  • The inspected preview page no longer receives the absolute project path: met (packages/inspector/src/live.ts:51 writes only the generation id; every reader (elementMap.js:91, liveRuntime.ts:2, pageQueries.ts:57,68,92) uses only generation; service.ts:296 already wrote only generation.)
  • play page HTML-escapes the project name; one shared HTML escape helper: met (packages/cli/src/commands/play.ts:317 escapes before both uses; packages/cli/src/utils/escapeHtml.ts:1-8 is byte-for-byte the helper removed from auth/callbackPage.ts and a superset of the one removed from present.ts.)
  • Skill script font file kept in a private per-run folder (claimed in the PR body): not applicable (No file under skills/ is in the diff against the merge base; the main branch already carries a separate fix for that script, so this part of the PR description is stale.)
  • Machine-readable output unchanged: met (cloud/get.ts:36-39, cloud/list.ts:118-123, preview.ts:741 and 909-910, cloud/render.ts:774 keep JSON built from the unescaped values; exit codes are set by the same calls as before (preview.ts:743).)

CI: 68 pass, 17 skipped, none failing or pending, including build, lint, format, both CLI test jobs, the runtime and studio tests and the required CLI smoke job.

How this was reviewed: a code-review pass and a security-review pass, by a reviewer agent in an isolated checkout of this commit; I then read the core of the fix and the cited lines myself. Nothing was built or run.

@michaelwang11394
michaelwang11394 added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
@michaelwang11394
michaelwang11394 added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 3e788fb Nov 18, 2026
85 checks passed
@michaelwang11394
michaelwang11394 deleted the sec-low22a-1117 branch November 18, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants