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.

test: keep the sign-in gate for links to another site's sign-in page

Tw936dfe3a50b3ef
diff --git a/docs/incidents.md b/docs/incidents.md
index 50f1698a..1739a4ac 100644
--- a/docs/incidents.md
+++ b/docs/incidents.md
@@ -19,31 +19,31 @@ When a review skill, its prompt or the model running it changes, rerun it on the
## Incidents
-| ID | Reported | Symptom | Introduced | Fixed | Layer | Caught by |
-| ---- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| I-01 | 2026-06-29 | `--zoom 99.5` passed the CLI range check and produced a `pake.json` the app could not load (#1274); the same value later still passed through `--config` | unknown | 7edf2af4 | unit | `rejects malformed zoom values instead of truncating them`, `rejects fractional zoom like the --zoom flag` |
-| I-02 | 2026-07-13 | Apps started at login on Windows showed a blank taskbar icon (#1323) | unknown | 83a1c476 | field | `reapplies the icon after every explicit window show`, `targets the large taskbar icon instead of only the small window icon` |
-| I-03 | 2026-08-01 | A SPA link under `/assets/` was intercepted as a download and a 403 response was toasted as a successful download (#1339) | unknown | f61b3267 | unit | `navigates SPA routes under /assets/ instead of treating them as downloads`, `rejects non-success HTTP responses before writing the file` |
-| I-04 | 2026-08-08 | On Windows a window hidden with `--hide-on-close` could never be restored from the tray (#1343) | unknown | 4ba7e65d | native | `acts on one edge of the click, not both`, `treats a minimized window as not on screen` |
-| I-05 | 2026-08-10 | Apps built with `--new-window` aborted (SIGABRT) on Cmd+click or `target=_blank` links on macOS 26 (#1347) | unknown | 71dccbb5 | native | `uses WebKit's target configuration with a fresh user content controller` |
-| I-06 | 2026-09-10 | Fullscreen video on Windows lost its captions, progress bar and player controls (#1373) | unknown | f671ded1 | native | `preserves WebView2 native fullscreen and keeps the other platform polyfill`, `tests/browser/fullscreen.mjs` |
-| I-07 | 2026-09-20 | Playing a video crashed apps on Wayland with WebKitGTK 2.52 after the 3.17.1 fix had covered only X11 (#1386, #1374) | unknown | 3c978e1e | field | `modern_wayland_uses_shm_instead_of_disabling_compositing`, `shm_preserves_legacy_webkit_niri_and_explicit_modes` |
-| I-08 | 2026-09-25 | `window.print()` failed with "webview.print not allowed" because the capability lacked the print permission (#1396) | unknown | 187cabb1 | review | `window_print_reaches_the_webview_only_from_trusted_contexts` |
-| I-09 | 2026-09-28 | `--windows-toolchain gnu --keep-binary` left a raw `.exe` that would not start without `WebView2Loader.dll` beside it (#1402) | 1fe55a88 | 3e906e81 | unit | `copies WebView2Loader.dll beside the raw binary for gnu`, `records the DLL as an artifact after the binary with --keep-binary` |
-| I-10 | 2026-10-15 | On macOS the Enter that confirms a Chinese input method candidate reached the page and sent the message early (#1415) | unknown | f4b4e3cb | field | `keeps the candidate-confirming Enter (keyCode 229) away from the page` |
-| I-11 | 2026-10-28 | After one failed Windows build, every later build refused to start with "A previous Pake process left a compilation cache lock" until the lock was deleted by hand | 5d66c330 | 16d79b66 | native | `a failed Windows build whose taskkill exits %i keeps the workspace %i times` |
-| I-12 | 2026-08-31 | `--enable-drag-drop`, documented as enabling drag-and-drop uploads, kept Tauri's handler instead, so file drops never reached the page and Windows HTML5 drag and drop broke (#1030, #1132) | bd764f5f | f62e7225 | native | `forwards window/zoom/wasm/new_window flags verbatim` |
-| I-13 | 2026-11-13 | During a stalled remote `--icon` download, SIGINT/SIGTERM waited for the 10-second timeout and logged "Icon download timed out!" before cancelling | 5d66c330 | 891521b4 | unit | `tests/unit/icon.test.ts`, `does not try another favicon source after the build is cancelled` |
-| I-14 | 2026-11-17 | On macOS a page's `alert()`, `confirm()` and `prompt()` showed nothing: `confirm()` returned false at once, so a site that confirms before logging out did nothing | unknown | 3e7ab18d | native | `sets the delegate again, since WebKit caches what it answers`, `answers the three WKUIDelegate panels WebKit would otherwise skip` |
-| I-15 | 2026-11-18 | On macOS, Google sign-in on TikTok, Notion and X ended in a blank window after the password, or the button did nothing: a sized sign-in popup was opened in the app's own window | 0419e982 | 41e1a6f9 | native | `gives a sized popup of the app's own site its own window`, `tests/integration/signin-popup-server.mjs` |
-| I-16 | 2026-11-18 | On macOS, Google sign-in on X still ended in a blank popup that never closed after 3.19.2: the popup opened blank and lost its opener to x.com's opener policy | 41e1a6f9 | d95ac6f4 | native | `a_popup_web_view_is_built_blank_so_the_engine_loads_its_address_once`, `tests/integration/signin-popup-server.mjs` |
-| I-17 | 2026-11-18 | On macOS a page whose web process died stayed white, and quitting the app then aborted it with a crash report: Wry unwraps the URL such a web view no longer has | unknown | 14cd4ba4 | native | `never asks Wry for the URL of a web view that has none`, `is reloaded, within the same limit as on Windows and Linux` |
-| I-18 | 2026-11-18 | With --new-window, an internal target=\_blank link the page handled itself still opened in the system browser (Douyin's episode list opened douyin.com/undefined) | unknown | c2a45111 | native | `a new-window link the page handled itself opens nothing`, `leaves a new-window link the page handled itself alone` |
-| I-19 | 2026-11-18 | DeepSeek showed "Abnormal usage environment" in every packaged app: its page reads `"__TAURI__" in window`, and withGlobalTauri put that name on every site | 6bbecdb1 | b3e1c8b9 | native | `is the only way Pake's injected scripts reach the native side`, `a_site_sees_no_tauri_global_api_and_the_users_own_code_keeps_the_name` |
-| I-20 | 2026-11-18 | On macOS YouTube's fullscreen button made the window full screen but left the video a small box, and the button could not leave: the polyfill stood in for WebKit's own fullscreen | unknown | cd60cc83 | native | `macOS keeps the engine's own fullscreen instead of the polyfill`, `tests/browser/fullscreen.mjs`, `macos_keeps_webkits_own_fullscreen_instead_of_the_polyfill` |
-| I-21 | 2026-11-19 | Douyin's episode list still opened douyin.com/undefined in the system browser after I-18: its covers have no href when the click begins and get one during it, so the guard skipped them | c2a45111 | 39aeb9f8 | native | `a_new_tab_link_without_an_address_never_bubbles_as_blank`, `routes a link that got an external address during the click, once` |
-| I-22 | 2026-11-19 | On Omarchy every Linux app drew a light title bar over a dark page, dark mode on or off: the desktop's Adwaita-dark GTK theme was not installed and GTK fell back to light Adwaita | unknown | 8e1c7ce2 | native | `a_missing_dark_theme_uses_its_installed_base`, `an_installed_or_unrelated_theme_is_left_alone` |
-| I-23 | 2026-11-20 | With ad blocking on, a Mac or Linux app hid every svg on every site, Google's logo and icons among them: the conversion wrote each hiding exception (`redtube.com#@#svg`) as a rule hiding the selector on all other sites | 79396657 | c44435aa | unit | `an_exception_for_one_site_hides_nothing_on_the_others`, `exceptions_narrow_the_rules_they_name` |
-| I-24 | 2026-11-20 | On Windows, ad blocking never hid a generic element: the style was appended at document creation, before the document had a head or a root, so the script threw and nothing was logged | 79396657 | df9a82d4 | native | `the_windows_script_carries_the_exceptions` |
-| 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`, `counts the configured site as this site` |
+| ID | Reported | Symptom | Introduced | Fixed | Layer | Caught by |
+| ---- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| I-01 | 2026-06-29 | `--zoom 99.5` passed the CLI range check and produced a `pake.json` the app could not load (#1274); the same value later still passed through `--config` | unknown | 7edf2af4 | unit | `rejects malformed zoom values instead of truncating them`, `rejects fractional zoom like the --zoom flag` |
+| I-02 | 2026-07-13 | Apps started at login on Windows showed a blank taskbar icon (#1323) | unknown | 83a1c476 | field | `reapplies the icon after every explicit window show`, `targets the large taskbar icon instead of only the small window icon` |
+| I-03 | 2026-08-01 | A SPA link under `/assets/` was intercepted as a download and a 403 response was toasted as a successful download (#1339) | unknown | f61b3267 | unit | `navigates SPA routes under /assets/ instead of treating them as downloads`, `rejects non-success HTTP responses before writing the file` |
+| I-04 | 2026-08-08 | On Windows a window hidden with `--hide-on-close` could never be restored from the tray (#1343) | unknown | 4ba7e65d | native | `acts on one edge of the click, not both`, `treats a minimized window as not on screen` |
+| I-05 | 2026-08-10 | Apps built with `--new-window` aborted (SIGABRT) on Cmd+click or `target=_blank` links on macOS 26 (#1347) | unknown | 71dccbb5 | native | `uses WebKit's target configuration with a fresh user content controller` |
+| I-06 | 2026-09-10 | Fullscreen video on Windows lost its captions, progress bar and player controls (#1373) | unknown | f671ded1 | native | `preserves WebView2 native fullscreen and keeps the other platform polyfill`, `tests/browser/fullscreen.mjs` |
+| I-07 | 2026-09-20 | Playing a video crashed apps on Wayland with WebKitGTK 2.52 after the 3.17.1 fix had covered only X11 (#1386, #1374) | unknown | 3c978e1e | field | `modern_wayland_uses_shm_instead_of_disabling_compositing`, `shm_preserves_legacy_webkit_niri_and_explicit_modes` |
+| I-08 | 2026-09-25 | `window.print()` failed with "webview.print not allowed" because the capability lacked the print permission (#1396) | unknown | 187cabb1 | review | `window_print_reaches_the_webview_only_from_trusted_contexts` |
+| I-09 | 2026-09-28 | `--windows-toolchain gnu --keep-binary` left a raw `.exe` that would not start without `WebView2Loader.dll` beside it (#1402) | 1fe55a88 | 3e906e81 | unit | `copies WebView2Loader.dll beside the raw binary for gnu`, `records the DLL as an artifact after the binary with --keep-binary` |
+| I-10 | 2026-10-15 | On macOS the Enter that confirms a Chinese input method candidate reached the page and sent the message early (#1415) | unknown | f4b4e3cb | field | `keeps the candidate-confirming Enter (keyCode 229) away from the page` |
+| I-11 | 2026-10-28 | After one failed Windows build, every later build refused to start with "A previous Pake process left a compilation cache lock" until the lock was deleted by hand | 5d66c330 | 16d79b66 | native | `a failed Windows build whose taskkill exits %i keeps the workspace %i times` |
+| I-12 | 2026-08-31 | `--enable-drag-drop`, documented as enabling drag-and-drop uploads, kept Tauri's handler instead, so file drops never reached the page and Windows HTML5 drag and drop broke (#1030, #1132) | bd764f5f | f62e7225 | native | `forwards window/zoom/wasm/new_window flags verbatim` |
+| I-13 | 2026-11-13 | During a stalled remote `--icon` download, SIGINT/SIGTERM waited for the 10-second timeout and logged "Icon download timed out!" before cancelling | 5d66c330 | 891521b4 | unit | `tests/unit/icon.test.ts`, `does not try another favicon source after the build is cancelled` |
+| I-14 | 2026-11-17 | On macOS a page's `alert()`, `confirm()` and `prompt()` showed nothing: `confirm()` returned false at once, so a site that confirms before logging out did nothing | unknown | 3e7ab18d | native | `sets the delegate again, since WebKit caches what it answers`, `answers the three WKUIDelegate panels WebKit would otherwise skip` |
+| I-15 | 2026-11-18 | On macOS, Google sign-in on TikTok, Notion and X ended in a blank window after the password, or the button did nothing: a sized sign-in popup was opened in the app's own window | 0419e982 | 41e1a6f9 | native | `gives a sized popup of the app's own site its own window`, `tests/integration/signin-popup-server.mjs` |
+| I-16 | 2026-11-18 | On macOS, Google sign-in on X still ended in a blank popup that never closed after 3.19.2: the popup opened blank and lost its opener to x.com's opener policy | 41e1a6f9 | d95ac6f4 | native | `a_popup_web_view_is_built_blank_so_the_engine_loads_its_address_once`, `tests/integration/signin-popup-server.mjs` |
+| I-17 | 2026-11-18 | On macOS a page whose web process died stayed white, and quitting the app then aborted it with a crash report: Wry unwraps the URL such a web view no longer has | unknown | 14cd4ba4 | native | `never asks Wry for the URL of a web view that has none`, `is reloaded, within the same limit as on Windows and Linux` |
+| I-18 | 2026-11-18 | With --new-window, an internal target=\_blank link the page handled itself still opened in the system browser (Douyin's episode list opened douyin.com/undefined) | unknown | c2a45111 | native | `a new-window link the page handled itself opens nothing`, `leaves a new-window link the page handled itself alone` |
+| I-19 | 2026-11-18 | DeepSeek showed "Abnormal usage environment" in every packaged app: its page reads `"__TAURI__" in window`, and withGlobalTauri put that name on every site | 6bbecdb1 | b3e1c8b9 | native | `is the only way Pake's injected scripts reach the native side`, `a_site_sees_no_tauri_global_api_and_the_users_own_code_keeps_the_name` |
+| I-20 | 2026-11-18 | On macOS YouTube's fullscreen button made the window full screen but left the video a small box, and the button could not leave: the polyfill stood in for WebKit's own fullscreen | unknown | cd60cc83 | native | `macOS keeps the engine's own fullscreen instead of the polyfill`, `tests/browser/fullscreen.mjs`, `macos_keeps_webkits_own_fullscreen_instead_of_the_polyfill` |
+| I-21 | 2026-11-19 | Douyin's episode list still opened douyin.com/undefined in the system browser after I-18: its covers have no href when the click begins and get one during it, so the guard skipped them | c2a45111 | 39aeb9f8 | native | `a_new_tab_link_without_an_address_never_bubbles_as_blank`, `routes a link that got an external address during the click, once` |
+| I-22 | 2026-11-19 | On Omarchy every Linux app drew a light title bar over a dark page, dark mode on or off: the desktop's Adwaita-dark GTK theme was not installed and GTK fell back to light Adwaita | unknown | 8e1c7ce2 | native | `a_missing_dark_theme_uses_its_installed_base`, `an_installed_or_unrelated_theme_is_left_alone` |
+| I-23 | 2026-11-20 | With ad blocking on, a Mac or Linux app hid every svg on every site, Google's logo and icons among them: the conversion wrote each hiding exception (`redtube.com#@#svg`) as a rule hiding the selector on all other sites | 79396657 | c44435aa | unit | `an_exception_for_one_site_hides_nothing_on_the_others`, `exceptions_narrow_the_rules_they_name` |
+| I-24 | 2026-11-20 | On Windows, ad blocking never hid a generic element: the style was appended at document creation, before the document had a head or a root, so the script threw and nothing was logged | 79396657 | df9a82d4 | native | `the_windows_script_carries_the_exceptions` |
+| 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` |
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index 9ea227cb..8c6bbd98 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -321,6 +321,29 @@ mod popup_tests {
assert!(script.contains("window.addEventListener(\"click\", openUnhandledBlankLink);"));
}
+ #[test]
+ fn a_sign_in_path_on_another_site_needs_a_sign_in_request() {
+ // Outlook opens every link in a mail with window.open. A link to
+ // another site's /login replaced the mail page, because any sign-in
+ // path on any site counted as the app's own sign-in. The behaviour is
+ // tested in tests/unit/auth-sso-patterns.test.js; this keeps the gate.
+ let script = include_str!("../inject/auth.js").replace("\r\n", "\n");
+ assert!(script.contains(
+ "const isMatch = providerHost || (signInPath && signsInToThisSite(urlObj));"
+ ));
+ for param in [
+ "\"client_id\",",
+ "\"redirect_uri\",",
+ "\"samlrequest\",",
+ "\"wreply\",",
+ ] {
+ assert!(script.contains(param), "{param} marks a sign-in request");
+ }
+ // A vendor's own website is not a tenant's sign-in.
+ assert!(script.contains("/^(?!www\\.)[a-z0-9-]+\\.okta\\.com$/,"));
+ assert!(!script.contains("/(^|\\.)okta\\.com$/"));
+ }
+
#[test]
fn a_new_tab_link_without_an_address_never_bubbles_as_blank() {
// Douyin's episode covers have no href when the click begins and get