Files
ananaBMasterandClaude Opus 5.5 409b8edb09 feat(site-rules): update built-in site rules between releases (#2490)
* feat(site-rules): update built-in site rules between releases

Built-in site rules now also reach installed extensions from rules.readfrog.app
every six hours, so data-only rule fixes no longer wait for a store release.

CI signs rules.json (ECDSA P-256) on merges to main that change it and uploads
it to R2. The extension verifies the signature, keeps the newer revision, and
falls back to its bundled rules whenever the document is missing, older than
the build or invalid. A rule using a field the build does not know, needing a
newer minExtensionVersion, or carrying CSS that loads anything falls back to
that build's own copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(site-rules): drop minExtensionVersion from bundled rules

Only the remote parse removed the version gate, so a bundled rule carrying it
kept the key. The options page copies built-in rules as JSON, and the user
rules editor refuses keys it does not know, so such a rule could not be pasted
into user rules. Bundled rules now drop the key too and have the same shape as
remote ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(site-rules): read CR LF like CSS does in the remote CSS guard

CSS turns CR LF, a lone CR and FF into one LF before tokenizing, and a hex
escape then takes that LF as its terminating whitespace. The guard took only
the CR, so `\75` + CR LF + `rl(` read as "u" + LF + "rl(" and passed, while a
browser read url( and fetched it. Normalize the line breaks first, and cover
CR LF, CR, FF and LF after an escape in the refused cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(site-rules): refuse remote CSS that ends in an unfinished hex escape

The guard checked each CSS string alone, but the CSS of every rule matching a
page is joined with "\n" into one stylesheet, and a hex escape also takes the
whitespace after it. A string ending in `\75` took the joining newline, so it
and a following `rl(...)` read as url( even though each passed on its own,
within one rule or across two. Refuse strings that end in an unfinished hex
escape, and cover the split in a rule and across rules resolved for a page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(site-rules): read each remote CSS block with the newline that joins it

The guard refused a block ending in a bare hex escape, but it normalized
the block on its own, so a block ending in an escape and a lone CR still
got through, since alone the CR is the escape's whitespace.
resolveSiteRule joins blocks with "\n", where that CR and the joining LF
form one CR LF, which the escape takes, so `\75` + CR then `rl(` read as
url( in Chrome and Firefox.

Check each block followed by the newline it is joined with, which covers
both endings, and decode that same text. An escape followed by a space,
LF, CR LF, FF or two CRs still leaves the joining newline and stays
allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:16:17 -07:00
..
2025-11-08 22:29:35 -08:00