Skip to content

fix(docs): check catalog link values and keep them out of copied commands - #7783

Merged
jrusso1020 merged 3 commits into
mainfrom
fix/docs-catalog-link-values
Nov 15, 2026
Merged

jrusso1020 merged 3 commits into
mainfrom
fix/docs-catalog-link-values

Conversation

@jrusso1020

@jrusso1020 jrusso1020 commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What

This PR now carries two docs catalog fixes. The copy-button change from #7785 was squash-merged into this branch.

Link values in the preview

  • Catalog pages restore variable values from the link they were opened with. A link value is now kept only when it fits its variable: a finite number, a boolean, one of an enum's options, a colour, an image address, or text with no < or >. Anything else opens at its default, and a variable's declared default always passes.
  • The preview player runs the composition with sandbox-origin="opaque", so the composition gets an origin of its own and cannot reach the docs page.
  • chatgpt-exchange sets its editable text with textContent and DOM nodes instead of building innerHTML from it.
  • New check:registry-innerhtml (scripts/check-registry-innerhtml.mjs). It fails any registry file that reads composition variables and adds markup writes (innerHTML, outerHTML, insertAdjacentHTML, document.write). The 25 files that do this today are listed with their current counts, which may only go down. Its test runs in test:scripts.

Link values in the copy buttons

Catalog pages now keep values that came from a shared link out of the copied install command, render command and agent request until the reader sets them on the page. A page opened with link values says so and offers Reset to defaults. The install command wraps instead of scrolling sideways.

Why

Preview: A shared link decides what values the preview composition receives, and several registry items write variable values as markup. The type checks keep a link to values that a control could have produced, and the opaque origin keeps whatever the composition does inside the preview. The new check stops new items from adding markup writes, so the remaining items can be converted over time.

Copy buttons: A catalog page restores tuned values from its vars-<item> query string, and the copy buttons treated those values as if the reader had typed them:

  • The install and render commands quote values for bash and zsh only. PowerShell, cmd.exe and fish read the same quoting differently.
  • The agent request is pasted into a coding agent as the reader's own request, so any text in it reads as an instruction.
  • Values from the link were restored without any sign they came from the link, and the install command was one line that scrolled, so a long value could hide the rest of the command.

Related work

None. Converting the other 24 listed files to textContent is follow-up work, and the check keeps that list from growing.

How

Preview

  • declaredValues in docs/snippets/catalog-detail.jsx now takes the declared variables rather than only their ids, and checks each value with fitsVariable. The thresholds are 10,000 characters for text and 2,048 for an image address. Image addresses must be http(s) or a relative path, with no whitespace, quotes, brackets or backslashes. Colours must be hex, a name, or rgb()/hsl(). Values typed into the panel are unaffected; this only applies to what is read back from the URL.
  • Opaque mode was chosen because the bootstrap already drives the player only through its public API (ready, seek, play, currentTime) and receives edits via postMessage. Every asset under /public/catalog/ is served with Access-Control-Allow-Origin: *, so fonts and the GSAP vendor file still load from the opaque frame. The payloads' localStorage/indexedDB uses are already behind try/typeof guards.
  • Catalog outputs (docs/public/catalog/..., the generated .mdx) are left to the publish automation, as source PRs require.

Copy buttons

  • catalog-detail.jsx tracks which variables the reader set on the page (edited) and which ones the link opened it with. The edited list is published as window.__hfEditedVars[<item>] before the existing hf-vars-changed event, so the separate install-command component can read it.
  • A new // >>> copied values section adds plainLinkValue and copiedValues:
    • Commands (install and render) keep a link value the reader has not set only if it is a number, a boolean, or text of at most 200 characters made of letters, digits, spaces and . , : _ # + - / @ ( ) ?. None of these is syntax inside the argument in bash, zsh, fish, PowerShell or cmd.exe.
    • The agent request keeps such a value only if it is a number, a boolean or one of the item's declared enum options. A link's free text never goes in.
    • Values the reader set on the page are kept as before.
  • install-command.jsx varsArgument(raw, edited) applies the same command rule.
  • A notice above the action bar lists the link-set values the reader has not touched yet. Its Reset to defaults button resets the values, the notes and the query string; the panel's Reset now does the same.
  • custom.css: .hf-install-command code wraps (white-space: pre-wrap; overflow-wrap: anywhere) in place of the overflow-x-auto whitespace-nowrap utilities.

Test plan

  • node --import tsx --test scripts/catalog-detail.test.ts scripts/check-registry-innerhtml.test.mjs at the combined head: 35 pass.

Preview

  • Before the copy-button change, the same two files: 33 pass.
  • With the old catalog-detail.jsx restored, the three link-value and preview tests fail. With the old chatgpt-exchange.html restored, the check's "passes this repository" test fails (6 writes, 4 allowed).
  • Headless Chrome, chatgpt-exchange loaded with a stubbed getVariables:
    • With default values, the #cge-screen DOM is byte-identical before and after.
    • With markup in row1Use, tableHeadUse and prompt, the old file created <img> elements and ran their onerror. The new file shows the text as written and creates no elements.
  • Headless Chrome, the docs bootstrap served locally against the committed payloads for chatgpt-exchange, aurora and frost-sequence-camera-orbit, old versus new:
    • In both, the player reaches ready, currentTime advances, and a posted edit remounts and resumes from the current time.
    • With the change, the inner frame's sandbox is allow-scripts only, and the docs page can no longer read its document.
    • aurora renders blank in both versions because the headless browser has no GPU. Frost's "no WebGPU adapter" error appears in both versions for the same reason.
  • oxfmt --check ., oxlint ., tsc -p scripts/tsconfig.json and lint-registry-items are clean.

Copy buttons

  • On the copy-button branch, node --import tsx --test scripts/catalog-detail.test.ts: 30 pass.

  • New "a link's text that a shell could read as syntax stays out of the install command": quotes, &, |, $(), %VAR%, !x!, newlines, curly quotes and text over 200 characters are dropped; plain text, numbers and booleans are kept; a value the reader set is kept with the existing quoting.

  • New happy-dom test mounts the catalog page and the install command from a link whose text value carries a command and an instruction:

    • The notice names the link values.
    • The install command, render command and agent request carry the number and enum values but not the text.
    • After typing into the field, the typed text is in all three and the notice drops that value.
    • Reset to defaults clears the notice, the command suffix and the query string.
  • Both new tests fail with this PR's catalog-detail.jsx and install-command.jsx reverted.

  • generate-catalog-pages, check-docs-snippet-motion and check-comment-citations tests pass (188 total, together with the file above).

  • oxfmt --check ., oxlint . and tsc --noEmit -p scripts/tsconfig.json are clean.

  • Not checked: the deployed page in a real browser with Mintlify's styles. The notice uses the panel's existing tokens and hf-ve-action button.

  • Unit tests added/updated

  • Manual testing performed

  • Documentation updated (if applicable)

  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

Rames (hf-security)

🤖 Generated with Claude Code

A catalog page restores its variable values from the query string, so a
shared link decides what the preview composition is given. Values from a
link are now kept only when they fit the variable they name: a finite
number, a boolean, one of an enum's options, a colour, an image address,
or text with no angle brackets. Anything else opens at its default.

The preview player now runs the composition with an opaque origin
(sandbox-origin="opaque"), so a composition cannot reach the docs page.
The bootstrap already drives the player only through its API and
postMessage, and every docs asset is served with CORS, so playback,
seek-on-remount and edits behave as before.

chatgpt-exchange sets its editable text with textContent instead of
building innerHTML from it. A new check, check:registry-innerhtml, fails
any registry file that reads variables and adds markup writes; the files
that do so today are listed with their current counts and may only go
down.

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

mintlify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 15, 2026, 1:51 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 103 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 (8)

Unstable (2)

  • seqrepeat-none-center-r0-nested-z100: tracking 0.05, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true
  • seqrepeat-none-px-r0-root-z100: tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

… sets it (#7785)

A catalog page restores tuned values from its link, and the install
command, the render command and the agent request carried those values
as if the reader had typed them. The commands quote only for bash and
zsh, and the agent request is pasted as the reader's own words.

The page now tracks which variables the reader set on it. A value that
only came with the link goes into a command when it is a number, a
boolean, or short text of letters, digits, spaces and plain punctuation,
and into the agent request only when it is a number, a boolean or one of
the item's own options. A page opened with values from its link says so
and offers "Reset to defaults", and the install command wraps instead of
scrolling so the whole line is visible.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@jrusso1020 jrusso1020 changed the title fix(docs): check catalog link values by type and isolate the preview fix(docs): check catalog link values and keep them out of copied commands Nov 15, 2026

@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.

Approve at a0d2533 (with #7785 folded in). The docs embed the published player, which drops allow-same-origin when sandbox-origin is set, so a hostile link value runs isolated. Nits only.

Resolves the test:scripts conflict with the docs image upload fix: keeps
main's list (which adds check-symlinks and upload-docs-images) and adds
this branch's check-registry-innerhtml test after check-large-files.

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

@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-approve at a8130a0: diff against main unchanged except the merged test:scripts line, which is the right merge.

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 7c7ff6d Nov 15, 2026
92 checks passed
@jrusso1020
jrusso1020 deleted the fix/docs-catalog-link-values branch November 15, 2026 03:19

This branch was successfully deployed

1 active deployment
staging - docs — a8130a04 Deployed Nov 15, 2026 by mintlify[bot]
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.

2 participants