fix(studio): the copied render command carries no composition text a shell can run (#8012)

* fix(studio): the copied render command carries no composition text a shell can run

The Variables panel's "Copy render command" put every variable value inline,
quoted for POSIX shells only. A shared project's author chooses those values,
so in PowerShell, cmd.exe (including npx.cmd's re-parse) or fish a default
such as `x'; calc.exe; '` ran as commands when the command was pasted.

The command is now fixed text: `npx hyperframes render -c <composition>
--variables-file .hyperframes/render-variables.json`. Copying it saves the
previewed values to that file through a new PUT /projects/:id/render-variables
route, which refuses a link standing in for .hyperframes and replaces, rather
than writes through, a link at the file itself. A composition path that is not
one plain word in every shell (letters, digits, `_ . / -`) gets no command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scripts): the comment checker skips a template nested in a substitution

stripLiterals ended a template literal at the first backtick, including one
that opens a nested template inside `${...}`. On a line such as
`'${value.replace(/'/g, `'\\''`)}'` that left a backtick unmatched, so
scanCLike read the rest of the file as one template and counted none of its
comments. The ratchet then measured VariablesPanel.tsx on main at 1 comment
line instead of 31 and failed any change that removed that line.

A `${...}` is now scanned as code: strings, regexes and templates inside it
are skipped, and its closing brace returns to the outer template.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(studio-server): read the replaced render-variables record through one no-follow descriptor

The link test checked the record with lstat and then read it by path, two
lookups CodeQL reports as a file-system race. Opening it once with O_NOFOLLOW
fails if a link is still there and reads the file that open checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andy Cheigh
2026-11-17 05:05:28 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 8239fe4702
commit 19743ea094
10 changed files with 444 additions and 25 deletions
+3 -1
View File
@@ -124,7 +124,9 @@ Use **Edit** to change a variable's label, description, or saved default. For fo
At the bottom of the panel, **Use this template** can copy either:
- the effective values as JSON;
- a ready-to-run `npx hyperframes render ... --variables ...` command.
- a ready-to-run `npx hyperframes render -c <composition> --variables-file .hyperframes/render-variables.json` command.
Copying the command also saves the values you are previewing to `.hyperframes/render-variables.json`, so run it from the project folder. The values travel in that file rather than in the command, so no value can be read as shell syntax in bash, zsh, fish, PowerShell or Command Prompt. If the composition's file name has characters other than letters, digits, `_`, `.`, `/` and `-`, the browser editor offers only the JSON; rename the file to get the command.
This keeps the values you just reviewed attached to the render request instead of asking the next person to reconstruct them.