Skip to content

fix(core): the static-page policy sees tags inside <noscript> - #682

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/622-noscript-policy
Oct 15, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/622-noscript-policy

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

validateHtml parsed pages in parse5's default scripting-enabled mode, where <noscript> holds raw text, so a <form>, <iframe> or javascript: link inside it passed the static-page policy. Tier 0 frames run with scripts off, so the browser reads that text as real elements.

validateHtml now parses with scriptingEnabled: 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 of validateHtml checks 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 team environment 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.
  • The same page posted straight to POST /api/publish, bypassing the CLI → 422 {"ok":false,"error":"Blocked <form> tag found."}.
  • pnpm seed:dev still publishes all four accept fixtures.

The rebase onto #678 only moved scriptingEnabled: false onto its bounded parser; the policy test and the fail-without-it check were rerun after it.

Surfaces

  • Fixtures: the new reject fixture is read by the policy test; seed:dev reads only accept fixtures.
  • CLI validate, file-mode publish and the server publish route share validateHtml. No message, flag or exit code changed, so the README, ADR-0004, docs/API.md and the skill stay as they are.
  • Not applicable: wire contract, dev loop, vocabulary, migrations, company resources, served pages, reverse states, repo layout.

Closes #622

Made by Claude Opus 5.5 in Claude Code, running in T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

GPT 6.1 Sol (xhigh) reviewed this change against #622: no findings. It checked every validateHtml caller (CLI validate, file-mode publish, repo build, the server publish route, the dev server), the title now read from a <noscript> that matches the served DOM, the fixture surfaces and the docs. The rebase onto #678 only moved scriptingEnabled: false onto its bounded parser.

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
allisonmahmood force-pushed the fix/622-noscript-policy branch from 182f799 to eab7c16 Compare October 15, 2026 17:10
@allisonmahmood
allisonmahmood merged commit f45512f into main Oct 15, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the fix/622-noscript-policy branch October 15, 2026 17:20
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Touches the core area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core): tags inside <noscript> skip the static-page policy

1 participant