From 745bb5437f5f7962b6aab45921e6ca8745d5f419 Mon Sep 17 00:00:00 2001 From: rgxdev Date: Tue, 24 Nov 2026 21:47:25 +0100 Subject: [PATCH] docs(policy): allow agent control on the user's profile and tabs Adds two opt-in agent-control modes to the hard-rule 7 exception and threat model S22: own tabs in a profile the user picks, and control of the user's open tabs. Each stays off by default behind its own setting, with per-session site approval, no Shield lowering, no private-space tabs, a per-tab indicator with one-click stop, confirmation for submissions, payments and filled secret fields, and no access to saved passwords, passkeys or autofill. Signed-off-by: rgxdev --- AGENTS.md | 17 +++++++++++++---- docs/threat-model.md | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 28c41c55..5fdf56f6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -217,10 +217,19 @@ Security and privacy IPC listener per running data directory for agent control. It is off by default, opens only after the user opts in, and accepts connections only from the same OS user account. Each connection needs explicit approval in Tarn before receiving browser data or controlling a - tab. It may use only a dedicated throwaway profile at Strict with per-site approval. Turning - the setting off closes the listener and ends the session, including profile cleanup. This - exception permits no TCP listener, local HTTP API, remote-debugging port, page-to-shell bridge - or new outbound request by the shell. + tab. By default it uses a dedicated throwaway profile at Strict with per-site approval. Two + further modes are allowed, each off by default behind its own setting that only the user can + switch in Tarn: the agent opens its own tabs in a profile the user picks, with that profile's + cookies and logins, or it controls tabs the user already has open. In these modes each site + needs the user's approval in Tarn and the approved list starts empty for every session; the + profile's Shield level applies and is never lowered for the agent; private-space tabs stay + out of reach; every tab the agent controls shows a visible indicator with a one-click stop; a + form submission, a payment or a filled secret field needs the user's confirmation; and the + agent gets no access to saved passwords, passkeys or autofill. Turning the setting off closes + the listener and ends the session, including cleanup of the throwaway profile; in the other + modes it releases every tab and leaves the user's data as it was. This exception permits no + TCP listener, local HTTP API, remote-debugging port, page-to-shell bridge or new outbound + request by the shell. 8. **No new or changed connections.** Do not add a request the shell makes, or change the receiver, content or frequency of one listed in `PRIVACY.md` ("Connections the browser itself makes"). No telemetry, analytics, accounts or crash upload. Exception, decided by the diff --git a/docs/threat-model.md b/docs/threat-model.md index fbdc1ebf..9acb2186 100644 --- a/docs/threat-model.md +++ b/docs/threat-model.md @@ -27,7 +27,7 @@ settings per client are in `cryptography.md`; the actors, components and externa | S13 | Medium | Supply chain | `cargo-deny`, `cargo audit`, committed lockfile, crates pinned to exact versions (GPUI `=0.2.2`, no git dependencies), SBOM per release. | `deny.toml` (advisories, bans, licences and sources in the `deny` job on every pull request, advisories nightly), lockfile, Renovate, CycloneDX SBOM on each tagged release, made in a job without `id-token`; Inno Setup 6.7.3 for the Windows installer pinned by SHA-256 (`release.yml`), Ninja for the Chromium build pinned by SHA-256 (`scripts/fetch-ninja.sh`, release and CI), Gradle 8.14.3 for the Android build pinned by SHA-256 (`mobile/android/gradle.sh`; no wrapper jar in the repository). CEF archive: SHA-256 recorded from `chromium-update.yml`'s download, checked by each build's own download (`scripts/fetch-cef.sh`). The `cef` pin and the locked `cef-dll-sys` move with the CEF build in `chromium-update.yml`'s pull requests (the newest unyanked crates.io release with a stable CEF build on every platform, no waiting period), which need a maintainer's approval and pass CI and `deny`; the pull request shows only their versions and checksums, not the crates' source, which CI builds without secrets; `tag` does not release a merge whose `cef` crate differs from the latest release's: it opens an issue and a maintainer releases it. Both trust `cef-builds.spotifycdn.com` and one network route to it; no second download over another route and no waiting period. No independent build exists. | | S21 | Medium | Memory-safety bugs in our FFI code | `unsafe` confined to two crates, each block documented with its invariant and enforced by lint. | `forbid(unsafe_code)` outside engine/platform, except `crates/app-dll`, whose only `unsafe` is its `RunWinMain` export for CEF's Windows launcher and the documented call inside it; `undocumented_unsafe_blocks` denied. | | S14 | Medium | Attacker-controlled titles and favicons parsed by the shell | Titles are bounded plain text. Favicons have byte and dimension caps and are decoded with limits. | Titles cut to 1024 characters in the engine, unchanged titles dropped, and bounded for display by `ui::text::bounded_title`. Find in Tabs snippets of page text (`WebView::find_text`), never from a Lockdown tab (found by title and address only): read in the same isolated world with the query as a JS string literal, at most 3 per tab of 320 characters each (cut again in Rust), shown as `bounded_title` plain text, never stored. Page text read for translation (feature `translation`) is capped at 2,000 nodes of 2,000 characters and 100,000 in all, handed only to Apple's on-device Translation framework and written back by the client world as text node data, never markup, only while the tab shows the offered page; never under Lockdown. The page can observe the rewrite and so learn the target language. Favicons (`engine::favicon`): links read and fetched in the engine's isolated world (WebKit's client content world, a DevTools isolated world in Chromium), hrefs over 2048 and `sizes` over 256 characters dropped there, so content rules, proxy and user agent apply; https URLs on the page's site, or on another site's host only when the page itself already loaded a resource from that exact host (default port; the isolated world reports at most 64 such hosts from Resource Timing, which lists only requests the page really made, so content rules have already applied to them), so a page cannot make the browser contact a server it has not used; cookies only for the page's own origin; another site's icon is fetched as a CORS request without credentials; no redirects are followed (`redirect: 'error'`), so no request goes past the checked URL; 10 s timeout, 256 KiB cap, and only while the tab still shows the requesting origin; SVG icons are rasterised to PNG by the engine (as an image, so no script runs); decoded with a 1024 px / 16 MiB limit and re-encoded as 64×64 PNG; stored per profile and wiped with history; a failed fetch is retried on the site's next page load, until three fetches have failed in a session; an icon stored over 30 days ago is fetched again the same way on the site's next load and replaced only on success; a subdomain without its own icon shows its registrable domain's, never across a public suffix; not fetched under Lockdown. Linux (`tarn.webview` `readIconLinks` and `fetchIcon`) runs the same scripts in its WebKitGTK script world `tarn` and iOS in its `WKContentWorld`, with the same Rust checks (`engine::favicon`); their components keep only https URLs, at most `favicon::MAX_CANDIDATES` (`favicon::fetch_urls`), and always fetch with the `favicon::MAX_BYTES` cap. Reader mode (`engine::reader`) reads the article in the same isolated world as plain strings, at most 200 KB and 10,000 characters a paragraph without control characters, re-checked by `Article::parse` (`serde_json`, input over 800 KB refused); the check for an article after each load runs only on http(s) pages and never under Lockdown, and GPUI draws them as text only; nothing of it is stored. Clean Up (`browser_core::cleanup`) reads only the http(s) host (at most 10 labels), the first 8 path segments and the first 1,024 characters of the title, never the query, fragment or user info, on the device; it keeps nothing but an in-memory undo record of tab and group ids and the names of the groups it made or opened, dropped with its toast. The link under the pointer (status bubble) is cut to 4,096 characters where the engine hands it over (`view_policy::MAX_HOVERED_LINK`; WebKit, CEF and the Linux web view component), parsed as a URL so its host shows as punycode and other characters percent-encoded, shown without user info (also inside `blob:`) with the host's end kept (`host_tail`) and the rest bounded by `bounded_url` (`browser_core::link_status`); the origin is drawn whole and only the rest is cut to fit, as plain text in a window the pointer passes through; never stored. The mini-player's title comes from the page's media session or document title through `page_ops::MediaState::parse` (cleaned and cut like a tab title); no artwork is fetched. | -| S22 | Medium | Other local programs driving the browser | No listener by default, no remote-debugging port, no local HTTP API. Agent control is the sole exception: an opt-in OS-local endpoint restricted to the same OS user. The user must approve each agent connection and each site in Tarn before the agent can use it. Tarn must isolate each session in a throwaway Strict profile, and close the listener and wipe the session when disabled. | No listener exists in the current implementation. The egress check continues to apply with agent control off. Chromium ignores Chromium and CEF switches on Tarn's argv (`command_line_args_disabled`), and the browser process also removes the switches that turn off a sandbox, site isolation or web security, run a program in front of a child (`renderer-cmd-prefix`, `gpu-launcher`, …) or open remote debugging, before its children start (`engine::chromium::runtime`, not yet run against a launch with those switches). `crates/app/tests/egress.rs` launches the shell with filter-list updates off, loads a page from a local server and fails if `lsof` (sampled every 500 ms) shows any socket of the shell process, listening or connected; it is ignored by default because it opens a window and runs by hand with `cargo test -p app --tests -- --ignored`; no workflow runs it. The filter-list download itself is not covered. | +| S22 | Medium | Other local programs driving the browser | No listener by default, no remote-debugging port, no local HTTP API. Agent control is the sole exception: an opt-in OS-local endpoint restricted to the same OS user. The user must approve each agent connection and each site in Tarn before the agent can use it. By default Tarn isolates each session in a throwaway Strict profile. Two further modes, each off by default behind its own setting, let the agent open its own tabs in a profile the user picks (with its cookies and logins) or control tabs the user already has open; in them the approved site list starts empty for every session, the profile's Shield level is never lowered for the agent, private-space tabs are out of reach, every controlled tab shows an indicator with a one-click stop, form submissions, payments and filled secret fields need the user's confirmation, and the agent cannot read saved passwords, passkeys or autofill. Residual risk in these modes: page content the agent reads can steer it (prompt injection) while it acts with the user's logins on an approved site; per-site approval and the confirmations bound what it can do, not what it is told. Disabling closes the listener and ends the session: the throwaway profile is wiped, and in the other modes every tab is released with the user's data left as it was. | No listener exists in the current implementation, and the two modes on the user's profile or tabs are not built. The egress check continues to apply with agent control off. Chromium ignores Chromium and CEF switches on Tarn's argv (`command_line_args_disabled`), and the browser process also removes the switches that turn off a sandbox, site isolation or web security, run a program in front of a child (`renderer-cmd-prefix`, `gpu-launcher`, …) or open remote debugging, before its children start (`engine::chromium::runtime`, not yet run against a launch with those switches). `crates/app/tests/egress.rs` launches the shell with filter-list updates off, loads a page from a local server and fails if `lsof` (sampled every 500 ms) shows any socket of the shell process, listening or connected; it is ignored by default because it opens a window and runs by hand with `cargo test -p app --tests -- --ignored`; no workflow runs it. The filter-list download itself is not covered. | | S23 | Low | Page floods the user with dialogs, popups or tabs | Rate limits and a "stop this page" option. Pop-ups only after a user gesture. | 5 prompts and 3 popups per tab per 10 s, shared with the popups that tab opens, at most 8 queued; pages cannot open windows without a user gesture (`javaScriptCanOpenWindowsAutomatically` false; WebKit's default is true); "Block requests from this page" declines the queue and further requests until the next navigation; sign-in requests only from the page's own origin (scheme, host and port), at most 3 attempts. A site's "Block" pop-up rule and the pop-up, malware and adult sets refuse the rest, with a notice that offers to open it once (`app/tests/blocking.rs`). The mini-player's Play runs as the user's gesture, which the page's own scripts share for that moment as after a click; Pause and Seek do not on Chromium. Residual: WebKit treats every script of the shell's isolated world as a gesture, so on macOS with WebKit, Linux and iOS a Pause or Seek also lends the page one gesture. | | S24 | High | A page abuses or subverts Tarn's YouTube script in the page world | The script is compiled into the app, runs only on YouTube's hosts (exact match or dot-suffix, never `accounts.youtube.com`), captures the built-ins it uses before any page script runs, removes only allowlisted keys, never touches the DOM, storage, cookies or the network, defines no global and has no bridge to the shell. The signed bundle may change only which keys it removes. | `shield::youtube` and `youtube.js`; `youtube::parse` accepts at most 32 ASCII-letter keys and refuses keys playback needs; `data_store::install_scripts` rebuilds a controller's scripts in one place, so the referrer script, the Bitwarden passkey script (S15, S18) and the Netflix visibility script survive every change. Node sandbox test (`shield/tests/youtube.rs`) covers host gating, poisoned built-ins and every hook. The page can detect and undo the YouTube script on its own pages; that only brings its ads back. The Netflix script runs only on `netflix.com` hosts, makes the page see itself visible and focused, defines no global and has no bridge to the shell. Undoing it only lets Netflix stop playback again. On Windows both scripts reach Chromium's main world through `Page.addScriptToEvaluateOnNewDocument`, registered before a view's first load: the Netflix script in every view but Lockdown's, the YouTube script only in views made for a site where blocking is not paused; a new or switched-off YouTube script replaces the registered one for each view's next document. On Linux both are WebKitGTK page-world user scripts at document start in every frame (`linux/src/webview/scripts.rs` `apply_page_scripts`), installed in no Lockdown view and wrapped by `page_scripts::outside_lockdown` so they skip hosts set to Lockdown; the YouTube one only while Block YouTube ads is on (`youtube` prop), built by `youtube::script` from the bundle's `youtube::config`. Linux has no per-site pause, so blocking is never paused there. Display test `youtube_and_netflix_scripts_run_only_on_their_hosts_and_never_under_lockdown`. | | S25 | Medium | User opens a malware, phishing or scam site | Domain sets from curated lists checked on every navigation in every frame, including redirects and downloads, before the request is made; WebKit's fraudulent-website check stays on with the malware switch. | `nav_policy::gate` runs in `decide_policy` before the sub-frame and download branches; main frames get a native warning page (`app::blocking`) with "Go Back" as the default button, and "Visit Anyway" only for malware, ignoring clicks for 700 ms from when its tab becomes visible, and remembered per host and profile in memory until quit. Subresources from the two most curated malware lists are blocked by a content rule list that pausing a site does not lift. Sets of categories switched off are not loaded. New domains are missed until the next daily bundle. |