Repository navigation
fix(v3/windows): keep WebView2 callback handlers alive until native release - #6184
Conversation
…elease Go-allocated WebView2 handlers were passed to native code as raw addresses while their AddRef/Release returned 1 without holding any Go reference. Once a window dropped an abandoned or replaced Chromium, the GC could free handlers that WebView2 still referenced, e.g. a controller completion delivered after the embed timeout. Handler AddRef/Release now count native references in a registry keyed by the handler pointer, which keeps the handler and its Chromium reachable until the final Release. ShuttingDown drops host callbacks so a retained instance does not also retain its window. Fixes #6168
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: wailsapp/wails/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (19)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughThe Windows WebView2 edge layer now tracks native references to callback handler wrappers. COM AddRef and Release callbacks use this tracking instead of implementation methods. Chromium shutdown clears host callbacks. Windows tests cover handler lifetimes across delayed callbacks, replacement, and teardown. ChangesWebView2 Handler Lifetime
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable issue remains from the reviewed changes; the PR is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The new lifetime tracking addresses a native callback safety problem, but shutdown does not clearly stop every retained callback from applying an abandoned WebView’s permission policy. Whether that can occur in a live Windows session remains unverified. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit taps the handler’s door Comment |
|
Integration check for
I placed this bug fix in v3.0.0 GA, matching #6168. This PR owns the lifetime repair; I will avoid a duplicate implementation and preserve the separate #6167 branch while review continues. The v3 workflow failure still points to the CI repair in #6182. No commits or pushes were made by this integration check. |
|
Reviewed the remaining CodeRabbit summary notes at
CodeRabbit reports no actionable inline findings. No source changes were needed for these notes; the native-validation limits and #6182 CI dependency remain as documented. |
|
GA readiness test run for
The two Windows failures ( |
… WebView2 callback handlers alive until native release
* chore: update sponsors.svg and contributors.svg [skip ci] * Atterpac/dev mode ga (#6150) * fix(devmode): Add refresh http readiness check * chore(gomod): Bump atterpac/refresh v1.1.4 --------- Co-authored-by: Lea Anthony <[email protected]> * chore(changelog): auto-add entry for PR #6150 — Atterpac/dev mode ga * fix(v3/windows): recover from WebView2 process failures instead of leaving a blank window (#6002) * [windows] Recover from WebView2 process failures instead of leaving a blank window Register CoreWebView2's ProcessFailed event (previously unhandled). Renderer exited/unresponsive -> re-navigate to the last host-set URL. Browser process exited -> rebuild the controller on a fresh edge.Chromium instance and restore the last URL; the old instance cannot be re-embedded because Embed's init-wait loop keys on a per-instance flag a used instance has already set. Without this, any browser-process death (crash, GPU-kill exhaustion, external kill of msedgewebview2) leaves every controller COM call failing with ERROR_INVALID_STATE (0x8007139F) and the window permanently blank until the host app is restarted. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(v3/windows): bound WebView2 process-failure recovery and stop it drifting from startup Adapts the process-failure recovery from #5733 to current master and closes the gaps that showed up rebasing it off v3.0.0-alpha2.112. Share one Chromium construction path. The original rebuild carried its own copy of run()'s construction, which was accurate at alpha2.112 when that was just NewChromium plus SetErrorCallback. run() has since grown three more pre-Embed settings, so a rebuilt window silently lost non-client region support, dropped from composition hosting to windowed while options.WebView2CompositionHosting stayed true, and lost cursor handling. newChromium is now the only place that construction lives, so the two paths cannot drift again. Restore the last navigation from setupChromium rather than after it. setupChromium already navigates on its way out, so navigating again from the rebuild loaded the start URL and immediately threw it away for the real one. Folding the restore into that existing branch also fixes an options.HTML window recovering into a window that is never shown: the NavigateToString branch left webviewNavigationCompleted set from the dead controller's last navigation, and navigationCompleted uses that flag to skip the Hide/Show visibility hack — so recovery completed onto exactly the blank window it exists to prevent. Bound the attempts. A rebuilt controller that dies again re-enters the same handler, so an unrecoverable runtime turned recovery into a hot loop spawning WebView2 processes. Recovery now gets maxWebviewRecoveryAttempts consecutive tries, reset by any completed navigation, so a working recovery costs nothing and a broken one degrades to the pre-existing blank window instead of looping. RENDER_PROCESS_UNRESPONSIVE re-fires for as long as the renderer stays hung, so the bound covers re-navigation too. Guard the rebuild against teardown, since shutting the app down kills the WebView2 processes and a failure racing destroy would otherwise embed into a window that is going away. The failure-kind policy and the attempt budget are split into webviewRecoveryActionFor and beginWebviewRecovery, which touch no COM and are covered by unit tests. The rest of the path needs a live WebView2 runtime; the manual matrix is in the pull request. Refs #5733, #5705 Co-authored-by: rmurphy <[email protected]> Co-authored-by: taliesin-ai <[email protected]> Signed-off-by: taliesin-ai <[email protected]> * test(v3/windows): match the build tag of the file under test webview_window_windows.go is `windows && !server`, so tagging its test plain `windows` broke `go test -tags server` for the package: the test file compiled without any of the declarations it references. Note that dialogs_windows_internal_test.go has the same mismatch and already breaks that build on master; left alone here as unrelated. Co-authored-by: taliesin-ai <[email protected]> Signed-off-by: taliesin-ai <[email protected]> * fix(v3/windows): only reset the recovery budget on a successful navigation A dead render process leaves WebView2 on an error page, and that error page fires NavigationCompleted like any other load. Resetting the attempt budget there handed a crash-looping renderer a fresh budget every cycle, so the bound never tripped — reintroducing exactly the runaway it was added to stop. Gate the reset on ICoreWebView2NavigationCompletedEventArgs::IsSuccess, whose vtbl slot was already declared but had no accessor; add one following the existing BOOL out-param pattern. An unreadable IsSuccess counts as unsuccessful, since assuming success is the failure mode that loops. Also guard the renderer re-navigation against teardown. rebuildWebView already bails when the window is being destroyed; the deferred Navigate had the same race and no guard. Both found by CodeRabbit on the pull request. Co-authored-by: taliesin-ai <[email protected]> Signed-off-by: taliesin-ai <[email protected]> * fix(v3/windows): run the process-failure restore after the ProcessFailed handler returns InvokeAsync runs its function inline when the caller is already on the main thread, and the ProcessFailed callback always is: WebView2 delivers it through the message loop. The recovery restore therefore ran inside the event handler, where WebView2 never delivers a new controller's creation callback — a browser-process kill made Embed pump for 30 seconds inside the handler and then exit the process via errorCallback. The WebView2 ProcessFailed documentation requires scheduling the work "to take place after completion of the event handler". Hopping off the main thread first forces dispatchOnMainThread to post, so the handler returns before the restore runs. Validated on Windows 11 26200 / WebView2 151.0.4129.93: repeated browser-process kills recovered 0/8 inline and 8/8 posted (with the message-wait fix in the next commit), ~0.5s per recovery. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(v3/windows): wake the embed wait for input already in the queue pumpUntilInited waited with MsgWaitForMultipleObjects, which only wakes for input that arrives after the wait is entered. A message posted between the drain loop and the next wait was therefore invisible until some later message happened to arrive, and the controller-creation completion could sleep out the whole 30s deadline. Two live symptoms: - A WebView2CompositionHosting window fails at plain startup, deterministically, since the wait/deadline rework: bisects to 8e08788b3 (#5952); the parent commit and v3.0.0-beta.4 both start fine on the same machine. - WebView2 process-failure recovery (#6002): even with the restore correctly posted out of the ProcessFailed handler, rebuilds wedged in 1 of 6 browser-kill trials on the busy post-crash queue. MsgWaitForMultipleObjectsEx with MWMO_INPUTAVAILABLE also returns when matching input is already available. With it, composition-hosted startup works again and posted rebuilds recover 8/8. Validated on Windows 11 26200 / WebView2 151.0.4129.93. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(v3/windows): release the abandoned instance's DComp target before a controller rebuild An HWND can carry only one DirectComposition target. After a browser-process exit the abandoned Chromium's DComp target is still bound to the window, so the replacement's composition setup fails with DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED and falls back to windowed hosting: a WebView2CompositionHosting window recovered with the wrong hosting mode, visible only as one log line and a changed child-window tree (Chrome_RenderWidgetHostHWND and Intermediate D3D Window appear). Releasing the old composition controller and host before creating the replacement keeps the recovered window composition-hosted; the post-recovery child-window set matches the pre-failure one. Validated on Windows 11 26200 / WebView2 151.0.4129.93. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(v3/windows): contain failures during WebView2 recovery Return controller initialization errors during recovery, clean up partial controllers, ignore late callbacks, and preserve quit messages. Recover HTML renderer failures and prevent overlapping recovery attempts. Keep initial startup failures fatal. Co-authored-by: rmurphy <[email protected]> * fix(v3/windows): address WebView2 recovery review findings --------- Signed-off-by: taliesin-ai <[email protected]> Co-authored-by: rmurphy <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Lea Anthony <[email protected]> Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6002 — fix(v3/windows): recover from WebView2 process failures instead of leaving a blank window * chore: update sponsors.svg and contributors.svg [skip ci] * chore(v3): bump to v3.0.0-beta.26 and update changelog * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * fix(darwin): honour Permissions for media capture requests (#6144) Recover the implementation and tests from closed PR #6050 after its temporary base branch was deleted. Port the permission docs to the current M-Press tree and refresh the translation audit records. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: stefan <[email protected]> Co-authored-by: Atterpac <[email protected]> * chore: update sponsors.svg and contributors.svg [skip ci] * chore(v3): bump to v3.0.0-beta.27 and update changelog * chore: update sponsors.svg and contributors.svg [skip ci] * fix(v3/windows): keep WebView2 callback handlers alive until native release (#6184) Go-allocated WebView2 handlers were passed to native code as raw addresses while their AddRef/Release returned 1 without holding any Go reference. Once a window dropped an abandoned or replaced Chromium, the GC could free handlers that WebView2 still referenced, e.g. a controller completion delivered after the embed timeout. Handler AddRef/Release now count native references in a registry keyed by the handler pointer, which keeps the handler and its Chromium reachable until the final Release. ShuttingDown drops host callbacks so a retained instance does not also retain its window. Fixes #6168 Co-authored-by: Lea Anthony <[email protected]> * chore(changelog): auto-add entry for PR #6184 — fix(v3/windows): keep WebView2 callback handlers alive until native release * chore: update sponsors.svg and contributors.svg [skip ci] * fix(linux): do not treat opening the tray menu as a click (#6018) * fix(linux): do not treat opening the tray menu as a click Right-clicking a tray icon ran the click handler as well as opening the menu, so an app that shows its window on click had the window toggle on every right-click — and with an attached window, toggle again on the next one. The dbusmenu "opened" event says the host is about to show the context menu, which is the secondary button. ItemIsMenu is published as false, so a primary click arrives as Activate and is already handled there; the menu-open path only needs to run the onMenuOpen callback. * docs: changelog entry * docs: reference the PR in the changelog entry * test(linux): cover tray menu-open vs click dispatch Pins the fix: Event("opened") must run onMenuOpen and not the click handler, Event("closed") must run onMenuClose and not the click handler, and Activate — the path a primary click actually arrives on — must still run it. * test(linux): assert tray events run only their own callback Each assertion now pins the whole set of click / onMenuOpen / onMenuClose counts rather than the one callback it is about, and Activate is checked against a tray that has the menu callbacks attached, so an event reaching a callback it should not fails the test. --------- Co-authored-by: stefan <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * docs(v3): correct macOS media authorization guidance (fixes #6204) (#6221) docs(v3): correct macOS media authorization guidance Clarify that PermissionDeny does not replace usage descriptions or prevent earlier system authorization. Apply the correction to English and all nine translations. Fixes #6204. * chore(changelog): auto-add entry for PR #6221 — docs(v3): correct macOS media authorization guidance (fixes #6204) * #6167 [v3][Windows] WebView2 recovery failures can still exit the app or strand its controller (#6220) Cockpit patch eac6c1702f5e4a62f6101b52a153c1bfbd20117bbb289c3b6ec454dc650f6bf4 Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * chore(changelog): auto-add entry for PR #6220 — #6167 [v3][Windows] WebView2 recovery failures can still exit the app or strand its controller * fix(v3/windows): finish WebView2 recovery error handling and cleanup (#6222) * fix(v3/windows): finish WebView2 recovery error handling and cleanup Return background and DevTools setup failures to recovery, close abandoned and failed controllers, and keep commands safe after budget exhaustion. Verify native Windows recovery with transient and persistent fault injection in development and production builds. * fix(v3/windows): address recovery review findings Assert the startup fatal diagnostic as well as exit status. Preserve clear WebView backgrounds for transparent and translucent windows, and verify native colour arguments across the live recovery matrix. --------- Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6222 — fix(v3/windows): finish WebView2 recovery error handling and cleanup * fix(v3): complete setup wizard and show system details (#6224) Fixes #6123. Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6224 — fix(v3): complete setup wizard and show system details * fix(v3): keep macOS app output outside file providers (#6225) Fixes #6223. Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6225 — fix(v3): keep macOS app output outside file providers * chore(v3): bump to v3.0.0-beta.28 and update changelog * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * chore: update sponsors.svg and contributors.svg [skip ci] * fix(v3/windows): make WebView2 COM AddRef/Release return the refcount (#6253) * fix(v3): resolve macOS GA readiness regressions (#6237) * fix(v3): resolve macOS readiness blockers and frontend audit findings * fix(v3): update setup wizard source-map-js to 1.2.2 (follow-up to #6237) (#6254) fix(v3): update setup wizard source-map-js to 1.2.2 (GHSA-68fv-2mgg-jv7q) npm audit on the locked setup wizard install reported one high advisory (source-map-js 1.0.0-1.2.1, via postcss and @tailwindcss/node). Lockfile-only refresh to 1.2.2; no package.json change and the committed dist is unchanged (a clean rebuild from the lockfile is byte-identical). Co-authored-by: taliesin-ai <[email protected]> --------- Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6237 — fix(v3): resolve macOS GA readiness regressions * fix(linux): initialize native menu before SetMenu asserts on it (#6233) NewMenu leaves Menu.impl nil until Update. linuxWebviewWindow.setMenu asserted (*linuxMenu) immediately, so window.SetMenu(application.NewMenu()) panicked. Invoke menu.Update on the GTK thread first (same sequence as run()), then read native; skip if impl is still missing. Fixes #6232 Co-authored-by: Abhishek Deepak <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * chore(changelog): auto-add entry for PR #6233 — fix(linux): initialize native menu before SetMenu asserts on it * feat(v3): macOS global shortcuts land on the labelled key (layout-aware) (#5688) * chore(v3): bump to v3.0.0-beta.29 and update changelog * chore: update sponsors.svg and contributors.svg [skip ci] * fix(v3): release InvokeSync* callers when the callback panics (#6108) All five InvokeSync* variants called wg.Done() as the last statement of the dispatched closure, below `defer handlePanic()`. handlePanic calls recover() and returns normally, so a panicking callback unwound the closure cleanly, skipped wg.Done() and left wg.Wait() blocked for the life of the process — with no crash to point at, because the panic had been handled. Deferring the release fixes all five. wg.Done() is deferred first so that, deferred calls being LIFO, handlePanic still runs to completion before the caller is let go: a panic handler that draws UI on the main thread depends on not racing the released caller. For the variants that assign a result, a callback that panics before its assignment completes now hands the caller the zero value rather than never returning at all. Fixes #6107 Co-authored-by: Lea Anthony <[email protected]> * ci: fix Build + Test v3 workflow syntax (#6182) * ci: fix Build + Test v3 workflow syntax Drop the duplicate top-level permissions mapping and the unsupported pull_request_review.branches filter so the workflow can run again. * ci(v3): guard aggregate result to master reviews * ci(v3): use pull_request.base.ref for master guards github.base_ref is empty on pull_request_review events, so the master guards skipped those runs. Use github.event.pull_request.base.ref, which is set for both pull_request and pull_request_review. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * fix(v3/windows): handle WM_CONTEXTMENU so the systray menu opens on right-click (#6162) * fix(v3/windows): handle WM_CONTEXTMENU so the systray menu opens on right-click The tray icon is registered with NOTIFYICON_VERSION_4, which delivers a right-click as WM_CONTEXTMENU rather than WM_RBUTTONUP (NOTIFYICONDATAW docs: LOWORD(lParam) holds notification events "such as NIN_BALLOONSHOW, NIN_POPUPOPEN, or WM_CONTEXTMENU"). The callback switch only handled WM_RBUTTONUP, so rightClickHandler never fired and SetMenu menus were silently dead on Windows (Linux/macOS use different paths and are fine). Also fall back to GetCursorPos() in openMenu() when Shell_NotifyIconGetRect fails or returns nil - that happens while the icon lives in the Windows 11 overflow flyout, and the menu was dropped silently. * fix(windows): use cursor monitor for systray fallback menu placement Pick the monitor containing the menu position, not the owner window's, for the right-edge check in Win32Menu.ShowAt. Also fix w32.MonitorFromPoint to pass the POINT by value as one argument. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Lea Anthony <[email protected]> Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * fix(v3): prevent duplicate window teardown on macOS (#6159) fix(v3): prevent duplicate window teardown (fixes #6158) Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * chore(changelog): auto-add entry for PR #6162 — fix(v3/windows): handle WM_CONTEXTMENU so the systray menu opens on right-click * chore(changelog): auto-add entry for PR #6159 — fix(v3): prevent duplicate window teardown on macOS * fix(v3/windows): SetMenu(nil) is a no-op, matching macOS (#6105) fix(v3/windows): treat SetMenu(nil) as a no-op, matching macOS windowsWebviewWindow.setMenu dereferenced the *Menu argument via menu.Update() with no nil check. WebviewWindow.SetMenu is a no-op on macOS when passed nil, so a running application calling SetMenu(nil) on Windows panicked instead of behaving the same way cross-platform. Add a guard at the top of setMenu that returns immediately when menu is nil, and add a regression test that reproduces the pre-fix panic. Fixes #6104 Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/windows): SetMenu always redraws the menu bar (#6106) fix(v3/windows): always redraw the menu bar after SetMenu windowsWebviewWindow.setMenu only called w32.DrawMenuBar inside the menubar-theme branch, so an application that sets or replaces a menu at runtime without a theme configured got a menu bar Windows was never told to redraw. Move the DrawMenuBar call out of the theme conditional so it runs after every SetMenu, unconditionally, leaving SetMenuBackground and InvalidateRect (theme-only concerns) where they were. Fixes #6103 Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(updater/linux): fallback for cross-device EXDEV rename failures (#6135) * fix(updater/linux): fallback for cross-device EXDEV rename failures Ports the rename-or-copy fallback from #5560 to Unix: on EXDEV the helper now copies (files and .app dirs via copyAny) instead of failing all 20 swap attempts. replaceTarget no longer deletes the target before a successful move, so a failed swap cannot orphan the install. Fixes #6134. * test(updater/linux): cover failed directory swap recovery + docstrings Addresses CodeRabbit review on #6135: adds an end-to-end test for the bothDirs path where a non-EXDEV rename failure after RemoveAll must restore the original bundle via restoreFromBackup and relaunch it without helper env. Also documents the three remaining new test functions to clear the 80% docstring coverage threshold. * fix(updater/linux): stage EXDEV file copies before swapping target Addresses CodeRabbit Major on #6135: cross-device file copies now land via a synced temp sibling beside the target and are atomically renamed into place, so a crash mid-copy leaves the complete old or new file — never a partial binary. Directories still copy onto the cleared slot (atomic dir replace is impossible on Unix); surviving-process failures there stay covered by the outer backup/restore, matching #5560. * test(updater/linux): deterministic staged-copy failure via injectable seam Addresses CodeRabbit Minor on #6135: permission-based copy failure injection (chmod 000) is bypassed by root-capable test runners, so the staging-failure test could false-pass there. Adds copyFileFunc alongside renameFunc and injects the failure through it instead. --------- Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * chore(changelog): auto-add entry for PR #6135 — fix(updater/linux): fallback for cross-device EXDEV rename failures * fix(v3/windows): default info.json language 0000 -> 0409 so Explorer shows version details (#6260) LCID 0 produces a neutral-only string table that the Windows VersionInfo API cannot resolve, leaving Properties > Details empty. Use en-US (0409) in the default template and docs snippet. Adds TestWindowsInfoJSONLanguage regression test. Fixes #6210. Co-authored-by: Lea Anthony <[email protected]> * fix(darwin): stop posting WindowDidUpdate and WindowWillUpdate (#6171) NSWindowDidUpdateNotification fires on every run-loop pass (~120/s while idle) and every window event is forwarded to the page through evaluateJavaScript:. The WebKit in macOS 27.0 (316338@main) runs each evaluateJavaScript as a forced user gesture and consumes the page's transient activation when that gesture ends, so a click's activation is gone within ~10 ms of mousedown and any activation-gated API called from the click handler (navigator.clipboard.writeText, WebAuthn, window.open) rejects with NotAllowedError. WebKit fixed the over-consumption in 321448@main, which has not shipped. Nothing in wails consumes either event and neither carries data. Fixes #6170 Co-authored-by: Lea Anthony <[email protected]> * fix(v3/updater): replace and relaunch the AppImage, not its read-only mount (#6201) * fix(v3/updater): replace and relaunch the AppImage, not its read-only mount * docs(v3/updater): document change and add changelog entry * refactor(v3/updater): add resolveTarget helper * docs(v3/updater): carry the AppImage note into the translated guides --------- Co-authored-by: Lea Anthony <[email protected]> * chore(v3): bump to v3.0.0-beta.30 and update changelog * feat(v3/runtime): export cancellable utilities (#6153) * fix(v3/windows/arm64): pass by-value doubles to WebView2 COM methods (#6165) * fix(windows/arm64): pass by-value doubles to WebView2 COM methods #5741 stopped passing a pointer where WebView2 expects a double, and on windows/arm64 replaced the call with ErrDoubleArgUnsupported, because syscall.SyscallN cannot load d0 (golang.org/issue/62583). So put_ZoomFactor, put_RasterizationScale, put_Expires and the print-settings setters were silently no-ops there: SetZoom does nothing, and a monitor DPI change never reaches the webview. The new internal/webview2/pkg/doublecall package owns the call on every architecture. amd64 and 386 keep the bit-pattern words; arm64 goes through runtime.cgocall — the system-stack switch SyscallN itself uses, and a linkname Go keeps for purego — into an assembly trampoline that loads the integer words into r0-r3 and the double into d0. Both binding packages (pkg/edge, pkg/webview2) use it; appendDoubleArg, ErrDoubleArgUnsupported and the ok result of appendRectArg go away. Refs golang/go#62583 * fix(windows/arm64): keep controller alive across SetBoundsAndZoomFactor and expand changelog Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/windows): allow multiple folder selection in OpenFile dialogs (#6264) On Windows, OpenFile() ignored PromptForMultipleSelection() whenever CanChooseDirectories(true) was set and always showed a single-folder picker. macOS and Linux already honour multiple selection for folders. The Common Item Dialog supports this natively with FOS_PICKFOLDERS and FOS_ALLOWMULTISELECT together. Add cfd.NewSelectMultipleFoldersDialog and choose the dialog through openDialogKindFor, which keeps the existing precedence (directories over files) and adds the multi-folder case. Fixes #6263 Co-authored-by: bnmatrx <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(application): address #6128 with regression coverage (#6261) * fix: address #6128 with native regression coverage * fix: address PR #6261 feedback --------- Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6261 — fix(application): address #6128 with regression coverage * fix(v3/linux): rebuild destroyed GTK3 submenus safely (#6236) * fix(v3/linux): rebuild destroyed GTK3 submenus safely Track native widget destruction, retain submenu types across detached updates, and add native lifecycle regression coverage for #6231. * fix(v3/linux): address GTK3 menu review comments Guard the destroy callback registry with a mutex, make the activation assertion wait up to a second, and nil-check widgets in the label helper. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * chore(changelog): auto-add entry for PR #6236 — fix(v3/linux): rebuild destroyed GTK3 submenus safely * chore(docs): warn instead of fail on stale translations (#6265) An English-only docs edit (for example PR 6213) failed the M-Press "build" job because the translated copies had not caught up. The translation sync workflow is meant to handle that. check_translations.py now reports audit findings as warnings and exits non-zero only for missing, empty or orphaned translation files and for a broken audit run. --strict restores the old behaviour. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * fix(v3/updater): stage beside the target to avoid EXDEV (supersedes #6200) (#6262) * fix(v3/updater): stage beside the target and copy across filesystems on Unix * docs(v3/updater): document change and add changelog entry * fix(v3/updater): keep the old target aside until the new one is in place on Unix * fix(v3/updater): abort the cross-device copy when the stale intermediate cannot be removed * fix(v3/updater): fsync the target directory before deleting the cross-device source * docs(v3/updater): name the .app bundle's parent as the macOS staging location * test(v3/updater): skip permission-based EXDEV failure tests as root * docs(v3/updater): translate the staging-location paragraph Add the new staging paragraph to the nine updater.md translations so their segments line up with the English source again. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Damon Blais <[email protected]> Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> * fix(updater): address #6185 with regression coverage (#6259) fix: address #6185 with native regression coverage Co-authored-by: Lea Anthony <[email protected]> * fix(v3): compile server mode for Android and iOS; fix updater regression test (#6278) * fix(v3): compile server mode for Android and iOS `go build -tags server` failed for GOOS=android and GOOS=ios. The mobile platform files carried no !server constraint, so they collided with the server implementations and called into the GUI bridge that server builds exclude. Fixes #6271. Follow the desktop convention: mobile GUI files, their Objective-C sources and the iOS runtime API now carry !server, and server builds use the existing message-processor, iOS runtime and desktop logger stubs. The mobile signal handler files stay selected, as TestSignalHandlerBuildVariants requires. Mobile server builds are now pure Go. Desktop and non-server mobile builds select exactly the same files as before. Two tests assumed non-server builds without saying so, which hid behind the compile failure: the Linux window test now matches its source's constraint and the system-mode test is tagged !server. CI now cross-compiles server mode for every target on Ubuntu and runs the application package tests in server mode. The server-build guide lists supported platforms and what is unavailable on mobile. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(updater): isolate #6185 regression test by executable path #6262 moved download staging from os.TempDir to the directory beside the target executable so the helper's swap is a same-filesystem rename. The regression test added in #6259 still isolated itself by pointing TMPDIR at a temp root, so the staging directory it watches for never appeared there and the test failed deterministically on every platform and every PR. Point the test's executable resolver into its isolated root instead, the same way the other DownloadAndInstall tests do. The test still fails when the #6259 production fix is reverted. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 894d2556db687742b0afa7e90bc22f83b074f2bb) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(v3/appimage): search only WebKit's install roots for its files (#6267) Walking all of /usr reached /usr/local and /usr/src, bundling other projects' AppDirs and cross-built binaries, after which appimagetool could not pick an architecture. Co-authored-by: taliesin-ai <[email protected]> * fix(android): default to singleTask launchMode to prevent duplicate A… (#5727) fix(android): default to singleTask launchMode to prevent duplicate Activity instances The Android manifest template ships with no explicit launchMode, defaulting to "standard". This means any incoming intent (deep link, notification tap, foreground service return) spawns a second MainActivity — a second WebView and a second attempt to initialise the Go bridge against process-global state (g_bridge, g_jvm, globalApp). Set launchMode="singleTask" so there is always exactly one Activity instance. New intents are delivered via onNewIntent() instead of creating duplicates. This is the standard approach for single-activity WebView shells (Capacitor, Cordova, etc.). Affects the scaffold template and both Android examples. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(android): support HTML file inputs via WebChromeClient (#5807) fix(android): support HTML file inputs via WebChromeClient (#5781) HTML <input type="file"> elements did nothing on Android because the generated MainActivity set only a WebViewClient and never a WebChromeClient, so the WebView had no onShowFileChooser handler to open the system document picker. Add a WebChromeClient whose onShowFileChooser launches the intent from FileChooserParams and delivers the selected URIs back via FileChooserParams.parseResult in onActivityResult. This also enables JS dialogs, console logging and in-page permission prompts that require a WebChromeClient. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/linux): turn off the DMA-BUF renderer only when WebKit renders on NVIDIA (#6273) * fix(v3/linux): turn off the DMA-BUF renderer only when WebKit renders on NVIDIA A loaded nvidia module made every hybrid laptop (AMD or Intel iGPU plus an NVIDIA dGPU) lose the DMA-BUF renderer, though the desktop and WebKit render on the iGPU, slowing rendering to about 1fps. * fix(v3/linux): judge the rendering GPU by offload, NVIDIA-only EGL and the compositor's screens Review: GLX vendor and a mixed EGL list do not move EGL; boot VGA counts only when it drives a screen; X11 keeps the workaround. * fix(v3/linux): an EGL vendor list without NVIDIA outranks PRIME offload --------- Co-authored-by: Lea Anthony <[email protected]> Co-authored-by: taliesin-ai <[email protected]> * fix(ios): document required privacy usage-description keys in Info.plist (#5809) The iOS Info.plist template shipped no NS*UsageDescription keys, yet the Wails runtime exposes camera, microphone, photo-library, location, motion and biometric APIs. On iOS, calling any of these without the matching key is an instant hard crash (and an App Store rejection), with nothing in the template hinting at the requirement. Add a commented block listing the six keys that map to the runtime's permission-gated APIs, so developers uncomment the ones their app uses and supply a real justification string. Keys are commented (not active) to avoid shipping usage descriptions for unused features, which draws App Store review scrutiny. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(android): wrap runtime-call HTTP fallback errors in JSON envelope (#5858) The Android HTTP fallback path in serveAssetForAndroid returned raw plain-text error bodies (from the errs package) for non-200 runtime calls. The JS runtime JSON.parse()s every runtime response, so an error surfaced as 'SyntaxError: Unexpected token ... is not valid JSON' instead of the actual message. Wrap non-200 runtime-call bodies in the same {"ok":false,"error":...} envelope used by handleRuntimeCallForAndroid so the frontend can parse and surface the error. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/windows): show the systray label as the tooltip (#6075) * fix(v3/windows): show the systray label as the tooltip The docs say SetLabel behaves like SetTooltip on Windows, but the Windows setLabel was an empty stub and show() only applied the tooltip when the icon was added, so a label set before Run never reached the icon either. Route the Windows setLabel through setTooltip, fall back to the label in show() when no tooltip is set, and store the label and tooltip on the SystemTray before dispatching to the platform impl so Label() reports the current value once the tray is running. Fixes #6045 * fix(v3/windows): keep an explicit systray tooltip over the label SetTooltip("x") followed by SetLabel("y") showed "y" until Explorer restarted, when show() put "x" back. Both paths now go through SystemTray.tooltipOrLabel, so an explicit tooltip always wins and the label is only the fallback. SetLabel and SetTooltip also wrote label and tooltip on the caller goroutine while Label() and the Windows show() read them. Guard the two fields with a small RWMutex. * fix(v3/windows): fall back to the label when the systray tooltip is cleared SetTooltip("") handed the empty string straight to the Windows setTooltip, which wrote an empty SzTip, so SetLabel("label"); SetTooltip("") left the hover text blank instead of showing the label. setTooltip and setLabel now both apply SystemTray.tooltipOrLabel through one updateTooltip. The value is read when the dispatched call runs rather than captured at the call site, so the icon always ends up with the latest stored text whatever order the calls land in. --------- Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/linux): allow devtools in production builds (#6163) webview_window_linux_dev.go was gated on !production, while its production twin excludes devtools, so building with -tags production,devtools on Linux compiled neither file and failed with missing openDevTools/enableDevTools. Use the same (!production || devtools) constraint as darwin and windows. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/android): apply the "color" field in SetStatusBar (#6193) application.Mobile.SetStatusBar(json) has always accepted only "style" (icon light/dark) and "hidden" in its JSON payload on Android — the "color" key that callers might reasonably expect a status-bar API to support (matching how the equivalent theme attribute android:statusBarColor already colors it statically) was never read by WailsBridge.setStatusBar(), so the status-bar background could only ever reflect whatever was baked into the app's static theme at Activity creation, never anything set at runtime. This is easy to hit for any app that switches between light/dark themes at runtime from JS rather than following the OS-level day/night setting: the icon style updates correctly (that part was already wired), but the background color stays stuck at whatever the static theme resolved to when the Activity was created, silently mismatching the new icon color — e.g. light icons on a still-light background, unreadable status-bar text. Add color handling: parse an optional "color" key ("#RRGGBB" / "#AARRGGBB") and apply it via Window.setStatusBarColor(), alongside the existing style/hidden handling. No API surface changes — "color" is a new optional key in an existing JSON payload, so this is fully backward compatible with callers that don't send it. Not applicable to iOS: UIStatusBarStyle has no background-color concept there (the iOS status bar is always a transparent overlay tinted by whatever view sits behind it), so this is an Android-only addition and mobile_features_ios.go is untouched. Touches: - v3/internal/commands/build_assets/android/app/src/main/java/com/wails/app/WailsBridge.java - v3/pkg/application/mobile_features_android.go (doc comment) - v3/examples/mobile/build/android/app/src/main/java/com/wails/app/WailsBridge.java Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/updater): stop the periodic check from re-downloading a staged update (#6206) periodicCheckLoop skipped the tick only while checking, downloading, verifying or installing. With an update staged (StateReady) it ran CheckAndInstall again and downloaded the same release on every tick until Restart. Skip StateReady too, as the existing CheckInterval test already assumes. Fixes #6188 Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3,linux): set initial filename in save file dialog (#6217) Signed-off-by: Martin Gysel <[email protected]> Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/darwin): zoom the page with WKWebView.pageZoom instead of magnification (#6227) ZoomIn/ZoomOut/ZoomReset/SetZoom/GetZoom on macOS drove -[WKWebView setMagnification:], a view-level scale: the layout viewport stays the same, the page is drawn larger and clipped at the window edges, nothing reflows. Windows (put_ZoomFactor) and Linux (webkit_web_view_set_zoom_level) implement the same API as a browser zoom, and so does Safari. WKWebView.pageZoom (macOS 11+) is that browser zoom; below macOS 11 the magnification path stays as the fallback. ZoomReset also keeps resetting the magnification so a pinch zoom (AllowsMagnification) still returns to actual size. Fixes #6226 Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/linux): open the asset response pipe with O_CLOEXEC (#6241) The Linux response writers stream the body to WebKit through a pipe created with Pipe2(p, 0). Without O_CLOEXEC, any child process forked while a response is in flight (os/exec, a helper the app spawns) inherits the write end. The handler returns and closes its copy, but WebKit only sees EOF once every copy is closed, so the body (and the fetch() behind a binding call) stalls until that child exits, even though headers arrived on time. Create the pipe with O_CLOEXEC on both ends. The read end is only consumed in-process by the GUnixInputStream, so nothing relies on inheriting it. Applies to both the GTK4 and GTK3 writers. Co-authored-by: taliesin-ai <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * fix(v3/appimage): start the bundled WebKit helpers on every distro (#6213) * fix(v3/appimage): start the bundled WebKit helpers on every distro The bundled WebKit library looks for WebKitWebProcess and WebKitNetworkProcess in the build machine's absolute directory, so AppImages built on Debian/Ubuntu only start where that path exists and crash elsewhere with "Unable to spawn a new child process". The copied helpers also lost their executable bit in s.COPY. Patch the helper directory in the deployed library to an AppDir relative path of the same length, between a deploy-only and a pack-only linuxdeploy run, and keep file modes in s.COPY. With GTK4 the AppRun wrapper turns off WebKitGTK 6.0's bubblewrap sandbox, which cannot bind the relative path. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/appimage): bundle the GPU process and apply modes to existing files Bundle WebKitGPUProcess when the host's WebKit ships it: once the library is relocated, WebKit looks for every helper in the AppDir, so a GPU process left on the host could no longer start. s.COPY applies the source's permission bits with Chmod after opening, so they hold for an existing target as well. The relocation test sets the fixture's mode explicitly instead of relying on the umask. The Linux guide no longer suggests DEB or RPM bring the WebKit sandbox back for GTK3 apps: WebKit2GTK 4.1 leaves it off in every format. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/appimage): keep WebKit's bubblewrap sandbox on Helpers move to usr/lib/<name>, the library names them as ././<name>/, and AppRun starts the app in usr/lib, so the path resolves inside the sandbox too. * fix(v3/appimage): load the bundled WebKit injected bundle The injected-bundle path in the WebKit library is still the build machine's absolute path. On Fedora it does not exist, so every web process logged "Error loading the injected bundle". On Debian and Ubuntu it points at the system's bundle, which can come from a different WebKit build than the one in the AppImage. AppRun now sets WEBKIT_INJECTED_BUNDLE_PATH, which release builds of WebKitGTK read, to the bundle shipped in the AppImage. WebKit adds that directory to the sandbox itself. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(v3/appimage): skip the file mode check on Windows Windows has no Unix permission bits, so the library written with 0755 reads back as 0666 there and TestRelocateWebKitHelpers failed on the windows-latest runner. The rest of the test still runs everywhere. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(v3): report stat error before checking AppImage library mode Avoid dereferencing a nil FileInfo when os.Stat fails; report the stat error and the permission mismatch separately. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Lea Anthony <[email protected]> Co-authored-by: Damon Blais <[email protected]> Co-authored-by: taliesin-ai <[email protected]> * fix(v3/build): move AppImage to output dir across filesystems (#6286) * fix(updater): address #6186 with regression coverage (#6280) * chore: update sponsors.svg and contributors.svg [skip ci] * ci(v3): cut macOS runner demand so PR checks stop queueing for hours (#6290) PR runs spent most of their wall time waiting for macOS runners (225-400 min queues observed) while actual job time was ~20 min. Each run requested 15 macOS jobs against an org-wide pool of ~5, and half of all runs were duplicates triggered by pull_request_review on an already-tested commit. - Drop the pull_request_review trigger; the pull_request run on the same SHA already reports the check. - Add a per-PR concurrency group that cancels superseded runs. - Run the six macOS API tag variants sequentially in one job. - Build all templates on Linux; build only vanilla and react on macOS and Windows. macOS jobs per run: 15 -> 4. Co-authored-by: taliesin-ai <[email protected]> * fix: security hardening for v2 and v3 (#6288) * Harden the dev IPC server against cross-origin and DNS-rebinding attacks Gate the wails dev IPC WebSocket behind a per-launch capability cookie and a strict same-origin check, and validate every request's Host against an allowlist (localhost, IP literals, the configured bind address, and WAILS_DEV_ALLOWED_HOSTS) so a malicious page in the developer's browser cannot reach the bound-method dispatcher. * Silence the unhandled-key system beep in WailsWindow * fix(security): update v2 runtime lockfiles for shell-quote, devalue, source-map-js, brace-expansion, vitest - shell-quote 1.10.0 -> 1.12.0 - devalue 5.8.1 -> 5.9.4 - source-map-js 1.2.1 -> 1.2.2 - brace-expansion 1.1.18 -> 1.1.21 - vitest / @vitest/* 4.1.6 -> 4.1.12 (pulls vite 8.3.4, rolldown 1.2.14) Lockfile-only; rebuilt runtime bundles are byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v2/cli): warn that remote templates can run build commands `wails build` and `wails dev` run the frontend:* commands from a project's wails.json. When a project is created from a remote template, extend the existing third-party template notice to say that templates are code, list the frontend commands found in the generated wails.json, and ask the user to review them before building. The notice is now also shown with -q. Document the trust boundary in the v2 CLI reference and community templates pages, and add a matching note for v3 remote templates. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(security): update v3 runtime lockfile for source-map-js, brace-expansion, markdown-it, js-yaml, vitest - source-map-js 1.2.1 -> 1.2.2 - brace-expansion 2.1.4 -> 2.1.7 and 5.0.9 -> 5.0.12 - markdown-it 14.2.0 -> 14.3.3 - js-yaml 4.3.1 -> 4.3.2 - vitest / @vitest/* 4.1.0 -> 4.1.12 Lockfile-only; package.json ranges unchanged. Typecheck, tests and typedoc output are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/updater): use a recognised zip-slip guard when joining archive entries safeJoin already rejected traversal, but via checks on the filepath.Rel result that CodeQL's go/zipslip query does not treat as sanitising the joined path. Guard entry names with filepath.IsLocal and keep a prefix containment check on the joined target as defence in depth. Add tests for nested, backslash and absolute traversal in zip and tar.gz, zip symlink escapes, and symlink write-through. Resolves code-scanning alerts 224 and 225. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/application): bound runtime window ID header to uint32 The window ID header was parsed with strconv.Atoi and then converted to uint32, so negative or oversized values wrapped onto another window's ID. Parse with strconv.ParseUint(..., 32) so out-of-range values are rejected as an invalid runtime call. Resolves code-scanning alert 164. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/notifications): do not fall back to PowerShell for Windows toasts Push Windows toast notifications through the WinRT API only and return its error instead of engaging go-toast's PowerShell fallback, which renders the toast XML into a generated script and cannot deliver activation callbacks. v2's Windows frontend used toast.Notification.Push, which always enables the fallback; it now renders the XML with go-toast's template and calls wintoast.Push without the fallback option. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3): only accept framework control messages from the main frame On macOS and iOS, WebKit reports whether a script message was posted by the main frame. Use it to ignore reserved `wails:` messages posted from child frames. Non-reserved messages are still delivered to RawMessageHandler with their origin info. Platforms that do not report frame identity keep their existing behaviour. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(security): update example frontend lockfiles for source-map-js, devalue, nanoid - source-map-js 1.2.1 -> 1.2.2 (v3 notifications, mobile, ios, file-association, dock, dev, custom-protocol-example, android; v2 dragdrop-test) - devalue 5.8.1 -> 5.9.4 (v3 dev) - nanoid 5.0.8 -> 5.1.16 (v3 file-association) and 3.3.16 -> 3.3.20 Lockfile-only; committed dist bundles are left untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3): validate origin on server-mode runtime requests In server mode /wails/runtime is reachable from any page open in the user's browser. Accept only POST requests, and only from the request host or an origin matching ServerOptions.WebSocketOriginPatterns (or any origin with WebSocketAllowAllOrigins), mirroring the policy already applied to the server's WebSocket endpoints. Requests without Origin whose Sec-Fetch-Site is cross-site or same-site are rejected; requests with neither header (non-browser clients) are still accepted. The check runs before chunk handling and before the query-string fallback, and is compiled only into server builds, so webview transports are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/cli): validate remote template URLs before cloning Remote template values from `wails3 init -t` were passed to `git clone` as positional arguments without validation. Validate the URL before any temporary directory is created, accept only https, http, ssh, git and scp-like URLs, pass url/dir after `--`, reject option-like tags, and run the clone with git's protocol allowlist limited to those transports. Also pass `git remote add` arguments after `--`. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/cli): keep URL userinfo when parsing remote template tags Split the optional tag from a remote template value on the last '@' and only treat the suffix as a tag when it contains no ':' or '/'. This keeps scp-like (git@host:path) and ssh://user@host URLs intact while still supporting url@tag. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/cli): allow '/' in remote template tags Decide whether the text after the last '@' is a tag from the URL part before it rather than the tag itself, so branch tags such as release/1.0 keep working while URL userinfo is still preserved. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(v2): replace wailsapp/mimetype fork with upstream gabriel-vasile/mimetype Switch v2's asset MIME detection from the github.com/wailsapp/mimetype fork (v1.4.1, a 2022 snapshot of upstream) to upstream github.com/gabriel-vasile/mimetype v1.4.16. The fork's only functional change, recognising UTF-8 BOM-prefixed HTML, is covered upstream. Upstream's SVG detector no longer skips a UTF-8 BOM, so strip it before content detection to keep BOM-prefixed SVG detected as image/svg+xml. Add extensionless test cases that exercise the content-detection path. Update the example modules that replace wails/v2 with the local tree and the stale template go.mod/go.sum snapshots. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(v3): drop stale wailsapp/mimetype entries from project templates v3 no longer depends on the fork, but generated projects still listed it as an indirect requirement, which dependency scanners flag. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci: declare least-privilege GITHUB_TOKEN permissions Add explicit top-level contents: read to build-and-test, semgrep, upload-source-documents and sync-translated-documents. The translation sync job keeps contents: write and pull-requests: write for peter-evans/create-pull-request. Semgrep reports to Semgrep Cloud via SEMGREP_APP_TOKEN, not GitHub SARIF, so it needs no extra scope. Resolves code-scanning alerts 207, 208, 111, 129, 118 and 115. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci: stop running PR code from workflow_dispatch runs workflow_dispatch runs in the default branch's context, so its cache scope is the default branch's. changelog-v3 (dispatch checked out refs/pull/N/head and ran go test/go run on it) and cross-compile-test-v3 (dispatch ran gh pr checkout N, then built and ran the PR's code) both let PR-controlled code execute with access to that cache scope, where it could plant entries later restored by trusted workflows. - changelog-v3: drop the workflow_dispatch trigger and the report job that only ran for it; validation still runs on every pull_request, which is unprivileged. Re-run the PR check to validate again. - cross-compile-test-v3: drop the pr_number input and the PR checkout step; a manual dispatch now tests the dispatched ref only. PRs are still tested on approval via pull_request_review. - cross-compile-test-v3: add top-level permissions: contents: read. Resolves code-scanning alerts 236, 234, 180, 186 and 185. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/examples): render XMLHttpRequest event log entries as text logEvent interpolated messages (request URLs, response data) into innerHTML, so a response containing markup was rendered as HTML. Build the entry spans with textContent instead. Resolves code-scanning alert 195. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v2/runtime): pass dev log message as a console argument The dev runtime concatenated the message into console.log's format string, so % sequences in backend-supplied text were interpreted as format directives. Pass it via %s instead and rebuild ipc_websocket.js (rebuilding unchanged sources reproduces the committed bundle byte for byte, so the bundle diff is only this change). Resolves code-scanning alert 102. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(security): update website lockfiles for transitive security advisories Update both website/package-lock.json and website/pnpm-lock.yaml to the same patched versions, within existing semver ranges: - shell-quote 1.12.0, proxy-addr 2.0.8, source-map-js 1.2.2 - joi 17.13.8, compression 1.8.2, body-parser 1.20.8, express 4.22.3 - qs 6.16.1, fast-uri 3.1.8, http-cache-semantics 4.3.0 - postcss-selector-parser 7.1.6 (7.x copies only) - brace-expansion 1.1.21, image-size 2.0.4, js-yaml 3.15.2 / 4.3.2 - svgo 3.3.5, baseline-browser-mapping 2.11.29, browserslist 4.29.3 - colord 2.10.0, postcss 8.5.30, http-proxy-middleware 2.0.10 - axios 1.20.0 (pnpm: @crowdin/crowdin-api-client 1.56.0 -> 1.59.1, which pins axios exactly) Not fixed (patched release is a major bump outside the parent's range, or no patched release exists): postcss-selector-parser 6.1.4 (cssnano 6 plugins pin ^6; GHSA-rj75-hqrm-r3gf needs 7.1.6), tinypool 1.1.1, serialize-javascript 6.0.2, uuid 8.3.2, sprintf-js 1.0.3, braces 3.0.3. package.json is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(security): update v3 runtime lockfile for nanoid - nanoid 3.3.16 -> 3.3.20 (GHSA-2v37-7h3g-55p8), matching #5985 Lockfile-only; npm audit now reports 0 vulnerabilities. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(security): update v2 labstack/echo to v4.15.3 Resolves the encoded-slash route bypass advisory for the dev server's echo dependency in v2 and its example and test modules. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore: tidy merged v2 changelog sections * fix(security): override website transitive deps pinned to vulnerable majors Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/application): format runtime window ID without an int conversion The window ID header is parsed as a 32-bit unsigned value; converting it to int for logging overflows on 32-bit platforms. Format it as unsigned. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/cli): keep URL credentials out of remote validation errors ValidateRemoteURL, cloneArgs and RemoteAdd echoed the supplied value, whose userinfo can carry a token. Report only the reason. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v2/templates): raise template go directives to match wails/v2 The template scaffolds declared go 1.18 and go 1.23.0, below the go 1.25.0 that wails/v2 requires and the go 1.24 that gabriel-vasile/mimetype needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v2/devserver): scope IPC capability cookie to port and refresh it on reconnect Browsers do not scope cookies by port, so two `wails dev` instances on different ports overwrote each other's capability cookie. The cookie name now carries the bind port taken from the configured dev server address. After `wails dev` restarts the app a new capability is minted, but the dev runtime reconnects without reloading the page, so every reconnect was refused until a manual reload. Add a no-op GET /wails/ipcauth route that passes through the host guard and cookie middleware, and have the dev runtime fetch it before each IPC connect attempt. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/application): reject rebound Host headers on loopback server binds When server mode binds a loopback address, a page whose hostname has been rebound to 127.0.0.1 sends a matching Origin and Host, which passes the same-origin checks on /wails/runtime and the WebSocket endpoints. Wrap the server mux in a Host check for loopback binds that accepts only localhost, IP literals, the bind host, and hosts matching WebSocketOriginPatterns. Non-loopback binds are unchanged. Document that WebSocketOriginPatterns targets reverse-proxy deployments and that cross-origin frontends calling /wails/runtime are not supported. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: 0x <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Lea Anthony <[email protected]> * ci(v3): always run Build + Test v3 so its results job can be required (#6291) The trigger-level paths filter skipped the whole workflow for PRs that do not touch v3/, so no v3 check reported and a required v3 check blocked those PRs forever. Detect v3 changes in a job instead: the test jobs are skipped when nothing under v3/ changed, and "v3 Build Results" always reports, failing if change detection itself fails. Co-authored-by: Claude Opus 5.5 <[email protected]> * chore(v3): build with Go 1.26 and refresh golang.org/x modules Raise the module's go directive to 1.26.0 with a go1.26.9 toolchain and update golang.org/x/{sys,term,tools,crypto,mod,net,sync,text} and goldmark. Merged with master's atterpac/refresh v1.1.4 bump. Verified: go mod tidy, go mod verify. go build ./..., go vet and go test -short ./pkg/... ./internal/... give the same results as before the bump (pre-existing failures: build_assets/ios package, TestWorkflowReproDownloadFailureLeavesTempArtifacts, TestFileExplorer). Raise the go directive of the wails3 init and service init go.mod templates to 1.26.0 so generated projects match, run go mod tidy in the examples and tests that replace the v3 module with the local checkout, and note the new Go 1.26 minimum in UNRELEASED_CHANGELOG. (cherry picked from commit adb27182644465319cbf482b2897d522b8366455) Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci: test on Go 1.26 and 1.27 and stop silent toolchain downloads Go 1.25 is out of support. The v2 and v3 test workflows now test every platform on Go 1.27 and also test Go 1.26 on one Linux runner, so the oldest supported release is still covered without adding macOS jobs. In the v3 workflow the GTK3 legacy and server-mode steps run only on the Go 1.27 Linux job, and the macOS API variants job uses Go 1.27 instead of reading the minimum from v3/go.mod. The test jobs set GOTOOLCHAIN=local, so a version mismatch fails the job instead of downloading another toolchain. Template tests use Go 1.27 everywhere, and the remaining workflows pinned to 1.25 move to 1.27. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci: run required PR checks for pull requests into releases/** The branch ruleset that requires "Run Go Tests" and "v3 Build Results" also covers releases/**, but PR Checks (master) and Build + Test v3 only ran for pull requests into master. On a PR into a release branch the test jobs were skipped and the always-run gate passed on "skipped", so untested changes could merge. Both workflows now trigger for pull requests into releases/** and their base-branch conditions accept master or any releases/ branch, so the test jobs and the gate jobs run for those PRs too. The gate job names are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(v3/generator): keep bindings stable when encoding/json aliases json/v2 Go 1.27 enables GOEXPERIMENT=jsonv2 by default, which turns encoding/json.Marshaler, Unmarshaler and RawMessage into aliases of encoding/json/v2 and encoding/json/jsontext types. The generator followed those aliases, emitting models for encoding/json/v2 and rendering json.Marshaler as json$0.Marshaler instead of any. Treat aliases declared in encoding/json whose target lives in an encoding/json subpackage like the named types they replace, both when collecting models and when recording imports (including when they are reached through user alias chains), so output matches Go 1.26. Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(v3): bump to v3.0.0-beta.31 and update changelog * fix(v2/release): pin pnpm 10 for the versioned docs step (#6293) The release script ran an unpinned npx pnpm, which now resolves to pnpm 11. pnpm 11 rejects lockfile entries published within its minimum release age and no longer reads pnpm.overrides from package.json, so the v2 release failed while installing the website. Pin pnpm 10, which wrote the lockfile, install with --frozen-lockfile so the release commit cannot rewrite it, and move the website task off the obsolete pnpm 8.3.1. Co-authored-by: Claude Opus 5.5 <[email protected]> * chore(changelog): auto-add entry for PR #6293 — fix(v2/release): pin pnpm 10 for the versioned docs step * release: v2.17.0 Automated weekly v2 release. * feat(v3): add native macOS menu section headers (#6297) * feat(v3): add native macOS menu section headers * docs(v3): translate menu section headers in all locales --------- Co-authored-by: taliesin-ai <[email protected]> * chore(changelog): auto-add entry for PR #6297 …
Fixes #6168
Problem
pkg/edgepasses Go-allocated WebView2 callback handlers to native code as raw addresses, and theirAddRef/Releasewent toChromium.AddRef/Release, which always returned 1 without keeping any Go reference. Once a window dropped an abandoned or replacedChromium(an embed timeout, a failed replacement, orrebuildWebView), the GC could free handlers that WebView2 still referenced. For example, a controller completion delivered after the timeout would then invoke freed memory.Fix
AddRef/Releasenow updates a registry keyed by the handler'sunsafe.Pointer(com_refs.go). While WebView2 holds a reference, the handler and itsChromiumstay reachable. The finalReleaseremoves the entry.Chromium.AddRef/Releaseand the_IUnknownImplmethods they satisfied are gone.ShuttingDown()clears host callbacks. An instance that WebView2 still references then doesn't keep its window alive.globalErrorCallbackis reset to the default handler rather than nil.Verification (native Windows 11, win-node1, WebView2 153)
TestNativeReferenceKeepsAbandonedHandlerAliveuses only master symbols. On unmodified master it fails 3/3: the abandonedChromiumis collected while a native reference is held. It passes on this branch.Chromiumwas abandoned (GC churn before pumping);ShuttingDown+DestroyWindow);rebuildWebView-style replacement.Chromiumis collected. It made noQueryInterfacecalls and no unbalancedReleasecalls; the tests assert both.pkg/edgesuite passes.pkg/applicationgives identical results on this branch and on master: 358 pass. The master-only failures areTestPrivateMacAPIsAreIsolated(hangs) and three source-tree checks, which fail when the test binary runs outside the repo.go vetpasses for windows/amd64, arm64 and 386.Notes
rebuildWebViewnever closes the old controller, so WebView2 keeps its handlers and the oldChromiumstays in memory. That is safe, and the window is not retained, but it happens once per recovery until [v3][Windows] WebView2 recovery failures can still exit the app or strand its controller #6167 closes abandoned controllers. Before this change the object was freed, but unsafely.ShuttingDown(). Web messages and resource requests from that instance are now dropped. This includes the instance a failed rebuild restores, which [v3][Windows] WebView2 recovery failures can still exit the app or strand its controller #6167 already describes as broken.ShuttingDown; whichever lands second needs a rebase.CC @leaanthony
Summary by CodeRabbit