Repository navigation
fix(core): the static-page policy sees tags inside <noscript> - #682
Merged
Merged
Conversation
Owner
Author
|
GPT 6.1 Sol (xhigh) reviewed this change against #622: no findings. It checked every |
validateHtml parsed with parse5's default scripting-enabled mode, where <noscript> holds raw text, so blocked tags inside it were never checked. Tier 0 pages run with scripts off, so a browser reads that text as markup. Parse with scripting disabled, as the repo bundle check already does for tier 0, and add a reject fixture. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
force-pushed
the
fix/622-noscript-policy
branch
from
October 15, 2026 17:10
182f799 to
eab7c16
Compare
allisonmahmood
added a commit
that referenced
this pull request
Oct 15, 2026
…the source (#685) Stacked on #682 A static page whose `@font-face` loads from `https://…`, or whose CSS uses `@import`, published with `warnings: []`. Tier 0's content policy blocks both (`font-src data:`, `style-src 'unsafe-inline'`), so the page quietly fell back to another font and the agent never heard why. `validateHtml` now reads each `<style>` with css-tree, which core already uses for looks, and adds one warning per blocked source, naming it: - `@font-face source "<source>" won't load: static pages load fonts only from data: URLs. Embed the font as a data: URL or use a system font stack.` - `@import "<source>" won't load: static pages can't load other stylesheets. Inline its CSS, with any fonts embedded as data: URLs.` The page still validates. `data:` and in-page `#fragment` sources, `local()` and `format()` strings, `url()` outside a font `src` (an https `background-image` is allowed) and `<template>` content stay quiet. Escaped names such as `\73rc` count as the browser reads them. css-tree recurses, so CSS nested too deeply to parse is skipped rather than failing the page. The new accept fixture `remote-font.html` joins the corpus, and the policy test now asserts exact warnings for every accept fixture; the others expect `[]`. The global `patchy` skill's HTML safety rules now say fonts load only from `data:` URLs and `@import` never loads, and its hash in `skills-lock.json` is refreshed. ## Tried by hand In a `pnpm dev up team` environment built from this branch before it was rebased onto #678, using the environment's CLI on a page with `@import url("https://example.test/theme.css")`, `@font-face { src: local("Brand"), url("https://example.test/brand.woff2") format("woff2") }` and an https `background-image`: - `patchy validate` → `HTML passed Patchy Cloud validation.` and exactly two `Warning:` lines, the import and the font URL, exit 0. With `--json`: `{"ok":true,"warnings":[…the same two…]}`. - `patchy publish`, text and `--json` → published, with the same two warnings. - The same page posted straight to `POST /api/publish` → `201` with the same two warnings. - `pnpm dev shot ada /acme/remote-font` → the page renders in serif. The browser reports `Loading the font 'https://example.test/brand.woff2' violates … "font-src data:"` and `Loading the stylesheet 'https://example.test/theme.css' violates … "style-src 'unsafe-inline'"`, the two sources the warnings name. The background image passes the policy; only its made-up host fails to resolve. - `pnpm seed:dev` publishes all five accept fixtures, `remote-font.html` included. The rebase onto #678 changed no behaviour here; the policy tests and each fail-without-fix check were rerun after it. ## Surfaces - Fixtures: the new accept fixture is read by the policy test and `pnpm seed:dev`. - CLI `validate`, file-mode `publish` and the server publish route already surface `warnings`. No flag, exit code or API description changed, so the README, ADR-0004 and `docs/API.md` stay as they are. - Global skill: HTML safety rules updated, hash refreshed. - Not applicable: wire contract, dev loop, vocabulary, migrations, company resources, served pages, reverse states, repo layout. Closes #586 Made by Claude Opus 5.5 in Claude Code, running in T3 Code.
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
…u when they fail (#720) Release 13's What's new entry, written from `c9b8fc4`, ahead of deploying it. `patchy` and `CURRENT_RELEASE` move to `0.13.0`, so CLIs and patch repos installed before this deploy are told to upgrade. | Change | PRs | | --- | --- | | New: Home puts the patches you use first | #713, #716, #719 | | New: Every patch in one list | #715 | | Improved: Each patch's page leads with Open | #717 | | New: See when your tools are failing | #718 | | Fixed: Everyone has a name | #687 | | Improved: Your company's look is easier to get right | #697, #696, #703, #688 | | Improved: Forms follow your look's error states | #691, #692 | | Improved: Clearer answers when a publish goes wrong | #686, #685, #689 | | Fixed: Your agent's Patchy commands are steadier | #695, #704, #680, #681 | | Behind the scenes: stricter checks on static pages and tools' database requests; malformed requests are logged | #682, #693, #683 | | Behind the scenes: usage numbers count every publish, sharing change and restore | #698, #699, #700, #690 | | Test and tooling only, no line | #705, #702, #701, #694, #684, #607 | Made by Claude Opus 5.5 in Claude Code, running in T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
validateHtmlparsed pages in parse5's default scripting-enabled mode, where<noscript>holds raw text, so a<form>,<iframe>orjavascript:link inside it passed the static-page policy. Tier 0 frames run with scripts off, so the browser reads that text as real elements.validateHtmlnow parses withscriptingEnabled: false, as the repo bundle check already does for tier 0. A new reject fixture,noscript-blocked-tag.html, puts a<form>inside<noscript>. Every caller ofvalidateHtmlchecks tier 0 pages, so this matches how they are served; a page that hid blocked tags in<noscript>is refused on its next publish.Tried by hand
In a
pnpm dev up teamenvironment built from this branch before it was rebased onto #678, using the environment's CLI on a page whose only<form>sits inside<noscript>:patchy validate→HTML failed Patchy Cloud validation:/- Blocked <form> tag found., exit 1. With--json:{"ok":false,"error":"HTML failed Patchy Cloud validation:\n- Blocked <form> tag found.","kind":"local"}.patchy publish --json→ the same refusal, exit 1.POST /api/publish, bypassing the CLI →422 {"ok":false,"error":"Blocked <form> tag found."}.pnpm seed:devstill publishes all four accept fixtures.The rebase onto #678 only moved
scriptingEnabled: falseonto its bounded parser; the policy test and the fail-without-it check were rerun after it.Surfaces
seed:devreads only accept fixtures.validate, file-modepublishand the server publish route sharevalidateHtml. No message, flag or exit code changed, so the README, ADR-0004,docs/API.mdand the skill stay as they are.Closes #622
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.