S024: privacy mode that holds up (R1-16)

Firefox-consistent anti-fingerprinting script (canvas/WebGL/audio/font noise per run and site; common screen,
CPU, platform, touch and WebGL values; frames covered), paused per site, on in incognito. Privacy mode also
switches third-party cookie blocking and a Firefox-style Accept-Language in the vendored servo-net;
document.cookie is emptied in cross-site frames. Engine gaps fixed on the way: screen geometry (was 0x0),
document.fonts.check, a pass-through DynamicsCompressorNode. Settings sub-page and shield flyout explain it.
Tests: unit tests, privacy-mode/incognito/net smokes, Cover Your Tracks run recorded in
docs/engine/privacy-mode.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-12 17:13:08 -06:00
commit d2cc780684

View file

@ -143,6 +143,10 @@ picture-in-picture, extensions, password capture, printing.
video" (and PiP finds no video). Plain `<video>` files (WebM, MP4 through GStreamer) play.
- Inline `<svg>` is painted from its own markup, so `currentColor` misses the CSS colour; `SVG_COLOR_JS`
(`inject.rs`) copies each icon's computed colour into its `color` attribute (hover colours not followed).
- Fingerprinting: Servo has no IndexedDB, plugins list, WebRTC or DynamicsCompressorNode, and its user agent is a
rare Firefox version, so Cover Your Tracks still finds Nacre unique with privacy mode on (bits per metric in
`docs/engine/privacy-mode.md`). `document.fonts.check()` and a pass-through compressor are Nacre's own layer
(`FONTS_CHECK_JS`, `COMPRESSOR_JS` in `inject.rs`); the screen size comes from `Hub::screen_geometry`.
- CSS `mask-image` icons (e.g. Wikipedia's) paint as solid squares. HTTP/2 header limit: see D-012.
## Vendored servo-net patches
@ -159,6 +163,7 @@ picture-in-picture, extensions, password capture, printing.
| `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 |
| `fetch/methods.rs` `main_fetch` (step 12) | privacy mode's Firefox-style Accept-Language ("en-US,en;q=0.5", `nacre::append_accept_language`) replaces Servo's single locale; a page's own value stays (S024) | `privacy-net.txt` |
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
@ -166,8 +171,15 @@ count, so `a.example.com` on `example.com` stays first-party. The top-level site
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).
checked like any subresource. `document.cookie` and the Cookie Store API in a third-party frame go to net with no
webview id (servo-script isn't vendored); Nacre's `FRAME_COOKIE_JS` (`inject.rs`, S024) empties them in a frame
whose top page is another site.
## Privacy mode (S024)
Page script `PRIVACY_JS` (`inject.rs`) plus the servo-net switches (third-party cookies, Accept-Language list);
every surface, the choice made for it and the Cover Your Tracks result are in `docs/engine/privacy-mode.md`.
Paused per site (`privacy.mode_off`); on in incognito windows by default (`privacy.mode_incognito`).
## UI system (S015)