Skip to content

Commit 7ccc28f

Browse files
authored
fix(blocker): record the page corpus only from reviewed sites (#385)
2 parents f635d70 + ea05595 commit 7ccc28f

9 files changed

Lines changed: 1084 additions & 55 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ jobs:
216216
- name: Check the built-in scriptlet extension in WebKit
217217
timeout-minutes: 10
218218
run: scripts/blocker-scriptlets/run.sh
219+
# The page-corpus recorder against a loopback server: a redirect and a
220+
# frame to a host off the reviewed list are refused, logged and never
221+
# recorded.
222+
- name: Check the page-corpus recorder refuses off-list hosts
223+
timeout-minutes: 5
224+
run: scripts/blocker-corpus/test-record.sh
219225

220226
windows:
221227
name: Rust (Windows)

‎docs/adblock.md‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,17 @@ unsupported.
355355
is kept until the next refresh. An edit that only changes letter case emits
356356
the same rule, since url-filters are case-insensitive, and stays pruned.
357357
- The Windows runtime matcher has no such per-rule cost and compiles every rule.
358-
- The corpus covers the benchmark sites, YouTube, ad-heavy news and betting
359-
sites, the top sites, pages where exceptions apply
360-
(`scripts/blocker-corpus/pages/`), and the hosts the wildcard rules name.
361-
Adult sites are left out of every list.
358+
- The corpus covers the benchmark sites, YouTube, ad-heavy news sites, the top
359+
sites and pages where exceptions apply (`scripts/blocker-corpus/pages/`), and
360+
those hosts the wildcard rules name that are on the reviewed list. Only hosts
361+
listed exactly in `scripts/blocker-corpus/hosts-allowed.txt`, which holds
362+
well-known sites alone, are loaded: `cargo xtask blocker-prune admit`
363+
withholds every other page of every list and prints it for review, and the
364+
recorder cancels every navigation and redirect, in the page or in a frame, to
365+
any other host and logs it. Never added: piracy or unlicensed streaming;
366+
cracks, warez or free downloads; link shorteners; adult sites; gambling and
367+
betting, including odds sites; scams. Licensed services such as Netflix,
368+
Spotify, Twitch, Vimeo, Crunchyroll and YouTube are fine.
362369
- A rule is listed only when the replay could test it and nothing matched. A
363370
load WebKit did not check as its recorded type keeps every rule of that type
364371
whose url-filter matches it. Each visit is recorded as ok, failed, timeout or
@@ -367,7 +374,10 @@ unsupported.
367374
replay batch that never reports back, or a recorded load with no replay row,
368375
fails the pass.
369376

370-
Refreshing the list is a release step, not CI: it loads hundreds of real pages
377+
Refreshing the list is a release step, not CI, and runs only on a Mac whose
378+
macOS and Safari meet the engine security floor the app pins:
379+
`scripts/blocker-corpus/run.sh` starts with `cargo xtask blocker-prune
380+
host-floor`, which refuses below it. It loads hundreds of real pages
371381
in WebKit with the network on (about five hours), then replays every recorded
372382
load against the bundled lists through a local listener that answers nothing.
373383
After `cargo xtask update-blocker-seed`, on an otherwise idle Mac:

0 commit comments

Comments
 (0)