Repository navigation
fix(docs): check catalog link values and keep them out of copied commands - #7783
Merged
Merged
Conversation
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>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 103 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (2)
|
6 of 7 tasks
… 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>
miguel-heygen
approved these changes
Nov 15, 2026
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
approved these changes
Nov 15, 2026
miguel-heygen
left a comment
Collaborator
There was a problem hiding this comment.
Re-approve at a8130a0: diff against main unchanged except the merged test:scripts line, which is the right merge.
4 of 5 tasks
Merged
Merged
3 of 4 tasks
This branch was successfully deployed
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.
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
<or>. Anything else opens at its default, and a variable's declared default always passes.sandbox-origin="opaque", so the composition gets an origin of its own and cannot reach the docs page.chatgpt-exchangesets its editable text withtextContentand DOM nodes instead of buildinginnerHTMLfrom it.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 intest: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:Related work
None. Converting the other 24 listed files to
textContentis follow-up work, and the check keeps that list from growing.How
Preview
declaredValuesindocs/snippets/catalog-detail.jsxnow takes the declared variables rather than only their ids, and checks each value withfitsVariable. The thresholds are 10,000 characters for text and 2,048 for an image address. Image addresses must behttp(s)or a relative path, with no whitespace, quotes, brackets or backslashes. Colours must be hex, a name, orrgb()/hsl(). Values typed into the panel are unaffected; this only applies to what is read back from the URL.ready,seek,play,currentTime) and receives edits viapostMessage. Every asset under/public/catalog/is served withAccess-Control-Allow-Origin: *, so fonts and the GSAP vendor file still load from the opaque frame. The payloads'localStorage/indexedDBuses are already behindtry/typeofguards.docs/public/catalog/..., the generated.mdx) are left to the publish automation, as source PRs require.Copy buttons
catalog-detail.jsxtracks which variables the reader set on the page (edited) and which ones the link opened it with. The edited list is published aswindow.__hfEditedVars[<item>]before the existinghf-vars-changedevent, so the separate install-command component can read it.// >>> copied valuessection addsplainLinkValueandcopiedValues:. , : _ # + - / @ ( ) ?. None of these is syntax inside the argument in bash, zsh, fish, PowerShell or cmd.exe.install-command.jsxvarsArgument(raw, edited)applies the same command rule.custom.css:.hf-install-command codewraps (white-space: pre-wrap; overflow-wrap: anywhere) in place of theoverflow-x-auto whitespace-nowraputilities.Test plan
node --import tsx --test scripts/catalog-detail.test.ts scripts/check-registry-innerhtml.test.mjsat the combined head: 35 pass.Preview
catalog-detail.jsxrestored, the three link-value and preview tests fail. With the oldchatgpt-exchange.htmlrestored, the check's "passes this repository" test fails (6 writes, 4 allowed).chatgpt-exchangeloaded with a stubbedgetVariables:#cge-screenDOM is byte-identical before and after.row1Use,tableHeadUseandprompt, the old file created<img>elements and ran theironerror. The new file shows the text as written and creates no elements.chatgpt-exchange,auroraandfrost-sequence-camera-orbit, old versus new:ready,currentTimeadvances, and a posted edit remounts and resumes from the current time.allow-scriptsonly, and the docs page can no longer read its document.aurorarenders 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.jsonandlint-registry-itemsare 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:
Both new tests fail with this PR's
catalog-detail.jsxandinstall-command.jsxreverted.generate-catalog-pages,check-docs-snippet-motionandcheck-comment-citationstests pass (188 total, together with the file above).oxfmt --check .,oxlint .andtsc --noEmit -p scripts/tsconfig.jsonare 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-actionbutton.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