Skip to content

fix(core): a logo attribute whose url( isn't CSS is refused, not a crash - #728

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/722-logo-url-refusal
Oct 18, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/722-logo-url-refusal

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

A logo with an attribute that holds url( but doesn't read as a CSS value crashed checkLook. patchy look publish and patchy look preview died with an unexpected error, and a publish through the API was a 500 defect instead of invalid_look.

Fix

checkLogo reads any attribute containing url( as a CSS value to find what it points at. css-tree never calls onParseError in its value context; it throws instead. That's a SyntaxError on text it can't read (a url(x) b ;}, url("a" b, url(x)) {) and a RangeError once brackets nest past the stack (about 2,300 deep, a few KB). That one parse now catches both, and the logo is refused with a line naming the attribute:

logo.svg's aria-label has url( but does not read as CSS, so what it points at cannot be checked; take the url( out, or write plain CSS such as url(#paint).

The failure is cached like a successful parse, so a repeated attribute parses once. The stylesheet and declarationList parses still rethrow: they recover from bad syntax, so a throw there means something else.

Why refuse instead of ignoring non-presentation attributes. Ignoring them needs a list of every attribute browsers read as CSS, and a gap in that list would let a reference through unchecked. A malformed presentation attribute such as fill="url(x)) {" would still need this refusal. Refusing keeps the check conservative: it can only over-refuse free text that contains url( and also isn't CSS, which real logos rarely have, and the line says how to fix it.

Hit every surface

  • Tests: the three inputs from the issue plus the deep-bracket case are in look.test.ts, beside the other logo refusals. packages/core/fixtures/looks holds only accepted looks, so no fixture changes.
  • Wire contract: no shape change. Looks.publish already turns any non-empty checkLook result into InvalidLook, as LookApi.test.ts ("refuses a look that fails its checks") shows, so this logo now lands as 422 invalid_look.
  • CLI and docs: no command, flag or exit code changes. packages/patchy/README.md and the publishLook description already say every url() is a data: URL or a #fragment link. An unreadable one can't be shown to be either, so neither needs changing.
  • Dev loop, vocabulary, migrations, company resources, served pages, reverse states, repo layout: not touched.

Not in this PR

Deeply nested blocks, such as thousands of @media{ in look.css or a logo <style>, parse fine but overflow the stack in css-tree's walk/generate, so checkLook still throws RangeError there. That needs a nesting bound, not a catch. It's noted on #722 for its own issue.

Closes #722

Built by Claude Opus 5.5 in Claude Code, running in T3 Code; reviewed by GPT 6.1 Sol in Codex.

@github-actions github-actions Bot added area:core Touches the core area size:s Under 100 changed lines labels Oct 17, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review, round 1 (GPT 6.1 Sol, xhigh, in Codex): no findings. All four regression inputs throw on main and are refused with a line naming the attribute on this branch; the 38 focused look tests pass. Sol agreed the nested @media overflow in walk/generate is a fair scope cut for its own issue. Verdict: resolved.

checkLogo read any attribute holding url( as a CSS value, and css-tree's
value context throws on input it can't read: a SyntaxError for text such
as `a url(x) b ;}`, and a RangeError for brackets nested past the stack.
Both escaped checkLook, crashing `patchy look publish` and `look preview`
and turning a publish into a defect instead of InvalidLook.

The value parse now catches those two errors and the logo is refused with
a line naming the attribute. The failure is cached like any other parse.

Closes #722

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the fix/722-logo-url-refusal branch from d3926af to 64fe998 Compare October 18, 2026 12:01
@allisonmahmood
allisonmahmood merged commit 878bede into main Oct 18, 2026
13 checks passed
@allisonmahmood
allisonmahmood deleted the fix/722-logo-url-refusal branch October 18, 2026 12:10
allisonmahmood added a commit that referenced this pull request Oct 19, 2026
…ng Reconnecting (#783)

Release 14's What's new entry, written from \`7694bab\`. It covers
everything merged since release 13's \`through\` (\`c9b8fc4\`), and sets
the \`patchy\` release to \`0.14.0\` (\`packages/patchy/package.json\`
and \`CURRENT_RELEASE\`).

| Change | PRs |
| --- | --- |
| Improved: Tools with server code answer faster | #756, #764, #768,
#769, #771, #772, #773, #775, #778 |
| Improved: Your company's tools and pages open sooner | #759, #761,
#766, #770 |
| Fixed: Tools stop flashing Reconnecting while they load | #755, #776,
#780 |
| Improved: Publishing is quicker | #729 |
| Improved: New tools start with a tidy layout | #763 |
| Improved: Your usual is easier to scan | #721 |
| Fixed: A page that isn't there says what to do | #762 |
| Fixed: A logo Patchy can't read is refused, not a crash | #728 |
| Behind the scenes: richer logs for live data | #758 |

#720 is release 13's own entry, so it's left out.

Made by Claude Opus 5.5 via Claude 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): a logo attribute with an unparseable url( crashes the look check

1 participant