S023: request headers (DNT, Sec-GPC, Save-Data) and third-party cookie blocking in the vendored servo-net
New vendor/servo-net/nacre.rs holds embedder-set state; http_loader and websocket_loader read it. Settings rows are working switches; privacy mode turns blocking on. Loopback smoke tests/smoke/privacy-net.txt, unit tests for site matching. Patch list in DESIGN.md, D-017. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
15fd1b21dc
commit
f5cb6f76f8
5 changed files with 357 additions and 34 deletions
|
|
@ -19,3 +19,4 @@
|
|||
- D-014 — 2026-11-12 — Two more Nacre patches in the vendored servo-net (D-012), marked "Nacre patch": `fetch/methods.rs` lets the certificate warning's `chrome:allowcert` request through (it ended as UnsupportedScheme, so "Open anyway" never worked); `http_cache.rs` `flush_to_disk` + `resource_thread.rs` Exit write the memory HTTP cache to the disk cache at quit (Servo only wrote evicted entries, so a session's cache was lost). — Both are Servo 0.7 bugs the embedder can't work around. — any plan that upgrades Servo: re-check both, re-run `tests/smoke/net-privacy.txt` and `cache.txt` + `cache-restart.txt`
|
||||
- D-015 — 2026-11-12 — MSE: go, option A (S022). Keep GStreamer's gst_mse library for parsing and coded frame processing; Nacre fixes its three 1.28.9 defects (early update-end, idle ticks, split A/V init segments) in its own copy of the library and plugin, plus a thin MSE DOM in the vendored `servo-script`/`servo-script-bindings`/`servo-media*` crates (`[patch.crates-io]`, like D-012). Option B (an own MSE core in Rust feeding appsrc) is the fallback only if bug 3 can't be fixed in msesrc. Plans S026–S030 run after S009 and before S023–S025. The prototype branch `s022-mse-proto` carries S026–S027 and merges into main in S028. — Decided by the orchestrator overnight on the user's standing OK; the user wants engine fixes, not workarounds (no yt-dlp). The spike showed gst_mse does the hard parts, and the blockers are concrete (docs/engine/mse-spike.md). — S026–S030, any Servo upgrade (drop the patches when Servo ships MSE)
|
||||
- D-016 — 2026-11-12 — Patched gst_mse loading (S026). Nacre ships its own `libgstmse-1.0.so.0` and `mse` plugin built from `vendor/gst-mse` (`tools/gst-mse.sh`). Release layout: library in `<exe dir>/lib/`, plugin in `<exe dir>/lib/gstreamer-1.0/`; a dev build uses `target/gst-mse/{lib,gstreamer-1.0}`. The binary's RUNPATH (`$ORIGIN/lib:$ORIGIN/../gst-mse/lib`, from `build.rs`) finds the library ahead of the system copy (same soname), and `main.rs` prepends the plugin dir to `GST_PLUGIN_PATH` before GStreamer starts (paths in GST_PLUGIN_PATH beat the system plugin of the same name). Windows: the DLLs sit next to `nacre.exe` / in `lib\gstreamer-1.0` (unverified). — RUNPATH needs no wrapper script or re-exec; LD_LIBRARY_PATH would have to be set before the process starts. — S030 packaging (AppImage, tarball, Windows), S028 merge
|
||||
- D-017 — 2026-11-12 — Request headers and third-party cookie blocking are Nacre patches in the vendored servo-net (S023): new module `nacre.rs` holds embedder-set state (extra headers, block switch, top-level site per webview); `http_loader.rs` and `websocket_loader.rs` read it. A request is third-party when its host's registrable domain differs from its webview's top-level site; blocking is on when the setting or privacy mode is on (`App::refresh_hub_config`). — Servo 0.7 has neither; the user wants engine fixes. `document.cookie` in cross-site frames stays uncovered (script isn't vendored). — S024 (privacy mode only needs `privacy_mode_on`), any Servo upgrade (re-apply from DESIGN.md "Vendored servo-net patches", re-run `privacy-net.txt`)
|
||||
|
|
|
|||
|
|
@ -145,6 +145,30 @@ picture-in-picture, extensions, password capture, printing.
|
|||
(`inject.rs`) copies each icon's computed colour into its `color` attribute (hover colours not followed).
|
||||
- CSS `mask-image` icons (e.g. Wikipedia's) paint as solid squares. HTTP/2 header limit: see D-012.
|
||||
|
||||
## Vendored servo-net patches
|
||||
|
||||
`vendor/servo-net` is servo-net 0.7.0 through `[patch.crates-io]` (D-012). Every Nacre change is marked
|
||||
`Nacre patch` in the code; a Servo upgrade re-applies the ones upstream still needs, then re-runs the smoke scripts named.
|
||||
|
||||
| File, function | What and why | Re-check |
|
||||
|---|---|---|
|
||||
| `connector.rs` `create_http_client` | `http2_max_header_list_size(256 KiB)`: hyper's 16 KiB default refuses YouTube's response headers (D-012) | `heavy-web.txt` |
|
||||
| `fetch/methods.rs` `main_fetch` (scheme fetch) | lets the certificate warning's `chrome:allowcert` request through; it ended as UnsupportedScheme (D-014) | `net-privacy.txt` |
|
||||
| `http_cache.rs` `flush_to_disk`, `resource_thread.rs` Exit | writes the memory HTTP cache to the disk cache at quit (D-014) | `cache.txt`, `cache-restart.txt` |
|
||||
| `nacre.rs` (new module, `pub mod nacre` in `lib.rs`) | embedder-set state the patches below read: extra request headers, the third-party cookie switch, the top-level site per webview, site matching (S023) | `privacy-net.txt` |
|
||||
| `http_loader.rs` `http_network_or_cache_fetch` (step 8.15) | appends the embedder's extra headers (`DNT`, `Sec-GPC`, `Save-Data`) unless the request already has them; records a `Document` request's site as its webview's top-level site; skips the `Cookie` header for a third-party request (S023) | `privacy-net.txt` |
|
||||
| `http_loader.rs` `http_network_fetch` (step 15) | doesn't store `Set-Cookie` from a third-party response (S023) | `privacy-net.txt` |
|
||||
| `websocket_loader.rs` `create_handshake_request`, `process_ws_response` | the same third-party rule for WebSocket handshakes (S023) | unit tests only |
|
||||
|
||||
Third-party rule (S023): a request is third-party when its host's site (registrable domain, eTLD+1; an IP address
|
||||
or a single-label host stands for itself) differs from the top-level site of its webview. Scheme and port don't
|
||||
count, so `a.example.com` on `example.com` stays first-party. The top-level site comes from the last `Document`
|
||||
request of that webview (net sees it before any subresource) and from the hub's `notify_url_changed` (history
|
||||
navigations without a request, downloads that didn't replace the page); `notify_closed` forgets it. Requests with no
|
||||
webview or no known top-level site are never blocked. `Document` requests are never blocked; `IFrame` documents are
|
||||
checked like any subresource. Not covered: `document.cookie` and the Cookie Store API in a third-party frame
|
||||
(script sends those to net with no webview id; servo-script isn't vendored).
|
||||
|
||||
## UI system (S015)
|
||||
|
||||
Everything the interface draws takes its colours, radii, sizes and springs from `src/theme.rs`; widgets live in
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ written.
|
|||
| Preload pages | written (DNS warm-up) |
|
||||
| Smooth scrolling | written (CSS) |
|
||||
| Still new tab background | written |
|
||||
| Save data | partial: JS hint, no request header |
|
||||
| Save data | verified S023 (privacy-net.txt): `Save-Data: on` header (vendored servo-net) plus the JS hint |
|
||||
| Hardware acceleration | written (software GL, restart) |
|
||||
|
||||
## Privacy
|
||||
|
|
@ -84,9 +84,9 @@ written.
|
|||
| HTTPS-only mode with fallback prompt and exceptions | verified S007 (net-privacy.txt: upgrade via the `location.replace()` page, certificate warning "Open anyway" (fixed: servo-net patch), fallback prompt + Open anyway, site stays http this session, local addresses never upgraded); "Always for this site" not tapped |
|
||||
| Site settings (defaults and per-site) | verified S008 (site-memory*.txt, restart): stored per site, applied again after a restart. Enforced: pop-ups, notifications, images (hub blocks image requests), sound (tab muted on load), Servo's own requests, open-other-apps. Shown as "Not available" (Servo 0.7): location (navigator.geolocation never answers), camera, microphone, device list (no navigator.mediaDevices), persistent storage (no navigator.storage), clipboard, JavaScript. Per-site privacy-mode flag does not exist (privacy mode is global; S024) |
|
||||
| Delete browsing data (+ on exit) | written |
|
||||
| Send Do Not Track and GPC | partial: JS only (no headers in Servo 0.7) |
|
||||
| Send Do Not Track and GPC | verified S023 (privacy-net.txt): `DNT: 1` + `Sec-GPC: 1` on every request (vendored servo-net), plus the JS properties |
|
||||
| Remove tracking parameters | verified S007 (net-privacy.txt: utm_*/fbclid removed, other parameters kept, off keeps all) |
|
||||
| Block third-party cookies | engine limit, shown as unavailable |
|
||||
| Block third-party cookies | verified S023 (privacy-net.txt): cross-site requests send and store no cookies (vendored servo-net), same-site subdomains keep theirs, on in privacy mode. `document.cookie` in a cross-site frame isn't covered |
|
||||
| Google sign-in quirk | written (UA switch + JS) |
|
||||
| Sites where ad blocking is paused | verified S007 (net-adblock.txt), persisted S008 (site-memory*.txt) |
|
||||
| Remote debugging, user agent | written |
|
||||
|
|
|
|||
|
|
@ -286,6 +286,15 @@ Done: Discord against a fake IPC server (`SMOKE_FAKE_DISCORD=1`, `tests/smoke/ne
|
|||
Not done: real Discord, real gamepad, spell dictionary download/add word/other languages, per-site Discord IDs, media flyout/visualizer/mute (S005 did PiP).
|
||||
Later: S010 list: user checks the Discord icon with their own client (the Discord client may refuse a `.ico` icon; then a PNG source is needed), plays a real gamepad, tries the dictionary download.
|
||||
|
||||
## S023 — Request headers and third-party cookies in servo-net (2026-11-12)
|
||||
- Done: `vendor/servo-net/nacre.rs` (Nacre patch, D-017): embedder-set extra headers, third-party cookie switch, top-level site per webview (from Document requests and `notify_url_changed`, forgotten on close). `http_loader.rs` adds the headers and skips sending/storing cookies for third-party requests; same for WebSocket handshakes. Nacre sets them in `refresh_hub_config` (`hub::privacy_headers`: DNT + Sec-GPC, Save-Data).
|
||||
- Settings: "Send Do Not Track and GPC", "Save data" and "Block third-party cookies" are plain working switches; blocking is also on in privacy mode (`App::privacy_mode_on`).
|
||||
- Tests: 2 new unit tests (headers; site matching incl. subdomains, eTLD+1, IPs), 64 green. `tests/smoke/privacy-net.txt` (loopback; server routes /setcookie, /cookies, /tp, /pixel, /reset, `reqs` log) green twice: cross-site frame and picture get and store no cookies when on, do when off, blocked again in privacy mode; same-site subdomain keeps its cookie; headers present, gone with DNT off. net-privacy and launch still green.
|
||||
- Patch list for Servo upgrades: DESIGN.md "Vendored servo-net patches" (all patch sites).
|
||||
- Not done: `document.cookie` / Cookie Store API in cross-site frames (script sends no webview id; servo-script not vendored). No real-site login check with blocking on (Google/GitHub sign-in) — for the user.
|
||||
- Handoff to S024: privacy mode already turns third-party cookie blocking on; S024 only extends `App::privacy_mode_on` if it adds per-window/per-site modes.
|
||||
- Later: a test server left by an older session held ports 8766/8767 with stale code; stop old ones before net smokes.
|
||||
|
||||
## Later
|
||||
- Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor).
|
||||
- Google sign-in past the email step: press Next with a real account, by the user (S006).
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ Things to check or fix in the review passes before the first build. Remove an it
|
|||
|
||||
- discord.rs on Windows: named-pipe reads block (no read timeout on `File`). Read only during the handshake
|
||||
there, or use a reader thread.
|
||||
- Servo can't add request headers or strip cookies per request, so "Send Do Not Track & GPC" only sets
|
||||
`navigator.globalPrivacyControl`/`doNotTrack` in pages, and "Block third-party cookies" is not possible.
|
||||
Settings must say so (shown as "partial" / "not available with this engine").
|
||||
- Done in S023: request headers (DNT, Sec-GPC, Save-Data) and third-party cookie blocking are patches in the
|
||||
vendored servo-net (docs/DESIGN.md "Vendored servo-net patches"); `document.cookie` in cross-site frames is not covered.
|
||||
- Servo's request interceptor holds a global lock while the embedder answers: `load_web_resource` must answer
|
||||
synchronously, never keep a `WebResourceLoad` waiting.
|
||||
- Intercepted responses skip redirect handling, so HTTPS-only and tracking-parameter stripping serve a tiny page
|
||||
|
|
|
|||
Loading…
Reference in a new issue