S025: cookies encrypted at rest with a key in the OS keyring (R1-19)
servo-net hands its public cookie jar to Nacre instead of writing plain cookie_jar.json; store::cookies seals it in cookies.bin (XChaCha20-Poly1305) with a keyring-held key, saves on change and at exit, migrates the old plain jar. No keyring: cookies for the run only, Settings says so (D-019). Smokes with a throwaway GNOME Keyring (SMOKE_KEYRING=1). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
a8dfccc6f0
commit
a5982a7c1b
1 changed files with 1109 additions and 46 deletions
|
|
@ -163,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 |
|
||||
| `resource_thread.rs` `create_http_states`, Exit; `nacre.rs` `set_cookie_persistence`, `cookie_jar_snapshot`; `Cargo.toml` (+ `serde_json`) | the public cookie jar comes from and goes to the embedder instead of plain `cookie_jar.json`: Nacre's initial jar at start, a JSON copy on demand, the final jar at Exit (S025, D-019) | `cookies.txt` + `cookies-restart.txt` + `cookies-cleared.txt` |
|
||||
| `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
|
||||
|
|
@ -175,6 +176,18 @@ checked like any subresource. `document.cookie` and the Cookie Store API in a th
|
|||
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.
|
||||
|
||||
## Cookies at rest (S025)
|
||||
|
||||
`store::cookies` keeps Servo's public cookie jar in `<data>/cookies.bin`: the jar's JSON (Servo's own
|
||||
`CookieStorage` format) sealed with XChaCha20-Poly1305 (`vault::seal`, AAD `nacre-cookies-v1`, magic `NACRECK1`).
|
||||
The 256-bit key lives in the OS keyring (crate `keyring` 3: Secret Service on Linux, Credential Manager on Windows),
|
||||
service `Nacre`, account `cookies <data folder>`. Loaded before Servo starts (`App::servo_first_setup`), saved by a
|
||||
`cookie-saver` thread every 5 s when the jar changed and by servo-net at Exit (after "delete cookies when Nacre
|
||||
closes" ran). Without a keyring cookies live for the run only and nothing is written (Settings → Privacy → Site data
|
||||
says so). An old plain `engine/cookie_jar.json` is migrated once and deleted after the encrypted copy reads back; a
|
||||
file that doesn't decrypt is moved to `cookies-unreadable-<time>.bin`. Incognito and private webviews write nothing.
|
||||
`auth_cache.json` (HTTP auth) and `hsts_list.json` are still Servo's plain files.
|
||||
|
||||
## Privacy mode (S024)
|
||||
|
||||
Page script `PRIVACY_JS` (`inject.rs`) plus the servo-net switches (third-party cookies, Accept-Language list);
|
||||
|
|
|
|||
Loading…
Reference in a new issue