S063: web pages can't open nacre:// pages; the passwords page asks on every open and isn't kept in the session

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-18 05:12:09 -06:00
commit 583a92b854
2 changed files with 273 additions and 24 deletions

View file

@ -115,6 +115,21 @@ extensions replaced by user scripts and styles, the context menu, the download m
- Fingerprinting: bits per metric and what privacy mode covers are in `docs/engine/privacy-mode.md` (the Servo-era
numbers there are historical).
## Internal pages (D-049, S063)
- Nacre's pages (`nacre://…`) are egui, never loaded into a web view, so any `nacre://` navigation a web view asks
for comes from web content: a link, middle click, `target=_blank`, `window.open`, script, frame, meta refresh or
HTTP redirect. The rule is `tabs::web_may_open`; it is enforced in the engine's `decide-policy` (`engine/host.rs`,
denied with one log line), again in `App::on_navigation` and `on_create_new` (backstops), and for the page's
context menu links (`MenuAction::OpenLink`). The one exception is `nacre://allowcert`, the certificate warning's
"Open anyway", taken only from the tab showing that warning.
- The user opens them: address bar, menus, buttons, shortcuts, bookmarks, command line (`Command::Open` /
`Navigate` / `ShowPage`).
- `nacre://passwords` asks first every time it is shown (master password, or a "Show passwords" click without one),
even while the vault is unlocked for autofill. When a frame draws without it (another tab, page, the tab closed)
`PageState::close_passwords` forgets the answer and every field it showed or took. It is saved and restored as a
new tab (`session::kept_url`).
## Media
Playback is WebKit's own (GStreamer) including Media Source Extensions; `tests/smoke/mse*.txt` are plain MSE tests.

View file

@ -498,6 +498,15 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor
- Measured (hidden, 5 http tabs, tab 0 active, `NACRE_REST_UNIT_SECS=2`, discard 4 = 8 s; WebKitWebProcess of that run, summed `smaps_rollup` Pss, sampled every 2 s): all tabs open 15 processes / 774 MB; ~10 s after the hidden four unloaded 6 processes / 329 MB, settling at 295 MB. Unloading frees the web processes and their memory (no shared process or lingering view ref found); the 6 left include the active tab's and WebKit's spare ones. Both `has_web` expects false.
- Not done: no visible run.
## S063 — nacre:// pages locked down; passwords ask on every open (2026-11-18)
- Rule (D-049): `tabs::web_may_open` — web content never goes to `nacre://` (only `nacre://allowcert`, taken from the tab showing the certificate warning). Enforced in the engine's `decide-policy` for every navigation and new-window action (`engine/host.rs`, one `… denied: web pages can't open Nacre's pages` line), with backstops in `App::on_navigation` (no longer turns a page's `nacre://` navigation into `tab.page`), `on_create_new` (closes such a pop-up) and the page context menu's link items. Nacre's own pages, menus, address bar and bookmarks go through `Command::Open`/`ShowPage`, untouched.
- Passwords: the page asks every time it is shown (master password via `check_password` while the store is unlocked for filling; a "Show passwords" click in device mode, which has no password). A frame drawn without the page (`passwords_shown`, as S059's `capture_shown`) calls `PageState::close_passwords`: answer forgotten, revealed/edit/search/generator/master fields and egui's text edit states cleared.
- Session: `session::kept_url` saves and restores `nacre://passwords` as a new tab (title blank).
- Tests: `web_content_cannot_open_internal_pages`, `passwords_page_not_kept`; `tests/smoke/nacre-lock.txt` + `pages/nacre-lock.html`, `nacre-refresh.html`, server.py `/to-nacre` (302): link, middle click, `target=_blank`, `window.open` (click and script), `location=`, iframe, meta refresh, HTTP redirect all denied (12 log lines, tab count 1, page null); address bar → asks; another tab and back → asks; History and back → asks; master password set → asks. Status `lifecycle.passwords_open`.
- Verified: hidden `nacre-lock.txt` exit 0 (server.py running), shots read; session.json of the run has `nacre://newtab` for the passwords tab; `cargo test` 91 + webext 1.
- Not done: typing the master password into the gate isn't scripted (selftest has no egui text input), only the click path and the gate staying shut; window minimised (no frames) keeps the page open until it is drawn without it; no visible run.
- Decision for device mode (no master password, nothing to ask): a click gate, so no page can open it unseen; the orchestrator/user may want "set a master password" pushed harder.
## Later
- A link followed inside a frame still goes through the tab's navigation policy (WebKit's GTK API has no frame info; S050).
- file:// media outside the XDG user folders doesn't play (WebKit sandbox, D-043).