Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

docs: record the system proxy download defect as I-28

Tw935171b2a4b684
diff --git a/.claude/rules/tauri-runtime.md b/.claude/rules/tauri-runtime.md
index 669aaf8c..4a97215c 100644
--- a/.claude/rules/tauri-runtime.md
+++ b/.claude/rules/tauri-runtime.md
@@ -5,7 +5,7 @@ paths:
# Tauri runtime risk areas
-- Native IPC is gated by the application command manifest in `src-tauri/build.rs`. Keep every registered app command in that manifest and grant only its required permissions. The packaged capability is local-only; `PakeConfig::remote_capability` grants the same permission set to exact configured entry origins (scheme, host, and port) before webviews load. Navigation flags, login redirects, subdomains, and restored URLs must not expand that grant. Keep local pages, secondary windows, loopback/IPv6 URLs, and literal hostname handling covered. ACL-denied downloads may fall back to browser attachments, but transient download anchors must bypass the IPC click interceptor to avoid recursion. Fullscreen must acquire native permission before mutating the player DOM; untrusted frame messages must never gain a top-level navigation fallback. Run `cargo test --lib` and `node tests/integration/ipc-security.mjs` (real macOS WebView; on a Mac whose system HTTP proxy is on, as the test Mac's is, prefix `NO_PROXY=127.0.0.1,localhost`: the native download client takes the system proxy but not its exceptions list, so the loopback payload goes to the proxy, comes back `502` and the probe dies reading `request.headers`, measured 2026-12-01); hiding `window.__TAURI__` or narrowing plugin capabilities alone does not gate application commands.
+- Native IPC is gated by the application command manifest in `src-tauri/build.rs`. Keep every registered app command in that manifest and grant only its required permissions. The packaged capability is local-only; `PakeConfig::remote_capability` grants the same permission set to exact configured entry origins (scheme, host, and port) before webviews load. Navigation flags, login redirects, subdomains, and restored URLs must not expand that grant. Keep local pages, secondary windows, loopback/IPv6 URLs, and literal hostname handling covered. ACL-denied downloads may fall back to browser attachments, but transient download anchors must bypass the IPC click interceptor to avoid recursion. Fullscreen must acquire native permission before mutating the player DOM; untrusted frame messages must never gain a top-level navigation fallback. Run `cargo test --lib` and `node tests/integration/ipc-security.mjs` (real macOS WebView, which passes on a Mac whose system proxy is on, as the test Mac's is: hyper-util reads that proxy without its exceptions list, so `macos_system_proxy` and `system_proxy_bypasses` in `invoke.rs` read the list themselves and send loopback direct; before c454d938 the probe's loopback payload got a 502 from the proxy and it died reading `request.headers`); hiding `window.__TAURI__` or narrowing plugin capabilities alone does not gate application commands.
- Injected CSS uses `src-tauri/src/inject/styles.js`: preserve DOM stylesheet order on ordinary pages; use constructable sheets only when CSP blocks the style element. `replaceSync` silently drops `@import`, so keep import-bearing CSS on its original DOM path, including escaped/case-insensitive at-keywords. Strict CSP plus imports remains unsupported. Run `node tests/browser/style-injection.mjs` with an installed Playwright runtime; mock CSSStyleSheet tests do not validate CSP or cascade behavior.
- The `runtime-template` Cargo feature builds a prebuilt runtime that a separate builder customizes without a compiler: at launch it reads `pake-runtime/{pake.json, app.json, custom.js?, tray.png?}` from `Contents/Resources` on macOS or next to the executable elsewhere, and applies app.json's `identifier` and `productName` to the Tauri context before build. The CLI never enables the feature, so CLI-built apps keep their compiled configuration even if such a folder appears. A present but invalid override exits with a `[Pake]` message instead of falling back to the template's identity. A runtime app keys its WebView profile folder under the config dir (`%APPDATA%\<identifier>\EBWebView` on Windows) by identifier instead of product name (`data_dir_name`), so a rename keeps logins and a generated name cannot share another program's folder; CLI apps keep the product-name folder. On Windows a runtime app also sets the process AppUserModelID to its identifier before any window exists, so shortcuts carrying that ID group with the running window and toasts are attributed to it. Logic and tests live in `src-tauri/src/util.rs` (`apply_runtime_override`, `data_dir_name`, `set_app_user_model_id`); `PakeConfig::runtime_app` is the single runtime-app flag, and `run_app` copies the overridden identity from the returned Tauri config into the context; keep `cargo clippy` and `cargo test --lib` green both with and without `--features runtime-template`.
- The app is built with `withGlobalTauri: false`: a page can read `window.__TAURI__`, and DeepSeek's front end shows "Abnormal usage environment" when `"__TAURI__" in window` holds (measured on a real bundle, 2026-11-18; its other tests are a user agent naming Tauri or Electron). Injected scripts reach the native side only through `window.__PAKE_NATIVE__` from `src-tauri/src/inject/bridge.js`, which keeps the shape they used (`core.invoke`, `shell.open` and `window.getCurrentWindow()` with the nine window commands the capability grants) over `__TAURI_INTERNALS__`; a new window call is added there with the command and argument names Tauri's own API sends, and needs its permission in the capability. Tauri decides the global API at compile time, so a prebuilt runtime cannot switch it per app: the user's own code, a bundled local page or an injected script that names `__TAURI__`, gets the name pointed at the bridge instead (`global_api_name_script` in `window.rs`): a local app only on its own `tauri:` pages, so a site it links out to stays clean, while an app with such a script shows the name to its site again. The rest of Tauri's global API (events, paths, DPI types) is gone for such code; the capability never granted a page most of it. `isTauri`, `__TAURI_INTERNALS__` and the plugins' `__TAURI_PLUGIN_*` names remain and are not configurable from a script; hiding them means patching the tauri crate, to do only when a site is shown to read them. `tests/unit/native-bridge.test.js` holds the scripts and the config to this.
diff --git a/docs/incidents.md b/docs/incidents.md
index 3ccbeab8..23babb32 100644
--- a/docs/incidents.md
+++ b/docs/incidents.md
@@ -48,3 +48,4 @@ When a review skill, its prompt or the model running it changes, rerun it on the
| I-25 | 2026-11-19 | An `--inject` file that was not `.css` or `.js` (even `theme.CSS`) silently dropped `--proxy-url`, `--download-dir`, `--multi-window`, basic auth and the `--wasm` headers, and `--json` still reported success (#1439) | 5752996f | e4e663bb | review | `rejects a file that is neither CSS nor JS`, `wraps an upper-case .CSS file as a style injection, not as script` |
| I-26 | 2026-11-23 | In an Outlook web mail app, a link in a mail to another site's sign-in page (`github.com/login`, `/auth/verify?token=`) replaced the mail page instead of opening in the browser: any path with a sign-in segment on any site counted as the app's own sign-in | unknown | 368ded2f | review | `opens another site's sign-in page from a mail in the browser`, `keeps a sign-in request with an OAuth parameter in the app`, `a_sign_in_path_on_another_site_needs_a_sign_in_request`, `counts the configured site as this site` |
| I-27 | 2026-11-23 | `pake example.com:8443/dashboard` or `pake localhost:3000` built an app with no hostname: the URL parser read the bare host as a scheme, so the `https://` default was skipped, and a unit test documented that as expected (#1443) | unknown | 107e0f2a | unit | `tests/unit/url.test.ts`, `rejects an out-of-range port on a bare host` |
+| I-28 | 2026-12-01 | On a Mac with a system proxy, a download from a host that proxy skips (loopback, a LAN address, an entry of its exceptions list) went to the proxy and failed, while the page itself loaded directly | unknown | c454d938 | native | `the_system_proxy_carries_downloads_except_for_loopback`, `system_proxy_exceptions_read_like_the_page_reads_them` |