Repository navigation
fix(core): a static page with a remote font or @import warns, naming the source - #685
Merged
Merged
Conversation
Owner
Author
|
GPT 6.1 Sol (xhigh) reviewed this against #586 and its triage brief. Two findings, both addressed in the last commit:
A second Sol pass on the fix commit found nothing. |
allisonmahmood
force-pushed
the
fix/622-noscript-policy
branch
from
October 15, 2026 17:10
182f799 to
eab7c16
Compare
…the source Tier 0's content policy blocks @font-face sources other than data: URLs and every @import, but validateHtml never read <style> contents, so a page relying on either published with no warning and silently fell back to another font. validateHtml now parses each <style> with css-tree and adds one warning per blocked source. The page still validates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Decode CSS escapes before comparing at-rule and descriptor names, as a browser does, so `\73rc` counts as `src`. Append warnings one at a time rather than spreading them into push(), since a stylesheet can name tens of thousands of sources. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
force-pushed
the
fix/586-remote-font-warnings
branch
from
October 15, 2026 17:20
8082252 to
b141ee8
Compare
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.
Stacked on #682
A static page whose
@font-faceloads fromhttps://…, or whose CSS uses@import, published withwarnings: []. 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.validateHtmlnow 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#fragmentsources,local()andformat()strings,url()outside a fontsrc(an httpsbackground-imageis allowed) and<template>content stay quiet. Escaped names such as\73rccount 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.htmljoins the corpus, and the policy test now asserts exact warnings for every accept fixture; the others expect[]. The globalpatchyskill's HTML safety rules now say fonts load only fromdata:URLs and@importnever loads, and its hash inskills-lock.jsonis refreshed.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 with@import url("https://example.test/theme.css"),@font-face { src: local("Brand"), url("https://example.test/brand.woff2") format("woff2") }and an httpsbackground-image:patchy validate→HTML passed Patchy Cloud validation.and exactly twoWarning: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.POST /api/publish→201with the same two warnings.pnpm dev shot ada /acme/remote-font→ the page renders in serif. The browser reportsLoading the font 'https://example.test/brand.woff2' violates … "font-src data:"andLoading 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:devpublishes all five accept fixtures,remote-font.htmlincluded.The rebase onto #678 changed no behaviour here; the policy tests and each fail-without-fix check were rerun after it.
Surfaces
pnpm seed:dev.validate, file-modepublishand the server publish route already surfacewarnings. No flag, exit code or API description changed, so the README, ADR-0004 anddocs/API.mdstay as they are.Closes #586
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.