Skip to content

fix(shell): enforce WebView trust boundaries and root crash recovery#173

Merged
Wangnov merged 14 commits into
mainfrom
codex/issue-167-webview-root-recovery
Jul 11, 2026
Merged

fix(shell): enforce WebView trust boundaries and root crash recovery#173
Wangnov merged 14 commits into
mainfrom
codex/issue-167-webview-root-recovery

Conversation

@Wangnov

@Wangnov Wangnov commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enforce a release-only browser-chrome policy across the renderer and native WebView2 layers: block context menus, print/reload/devtools/history shortcuts, and mouse back/forward while preserving controlled development debugging and the explicit crash-page reload action.
  • Restrict the production WebView to the bundled app origin, deny new windows and dangerous schemes, route external HTTP(S) through the validated system-browser command, reduce Tauri capabilities to the APIs actually used, and split strict production CSP from loopback-only development HMR CSP.
  • Add a dependency-light renderer entry, outer crash boundary, and static pre-createRoot fallback that cover providers, QuitConfirm, and Shell; recovery surfaces log diagnostics, read backend operation snapshots, and keep quit decisions phase-aware.
  • Gate the Windows release window on successful native accelerator hardening and add build/test guards that prevent the minimal renderer entry from accidentally importing the React application graph.

Validation

  • npm run check — pass
  • npm run lint — pass
  • npm test — pass (24 files / 166 tests)
  • npm run build — pass, including renderer-entry isolation check
  • cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings — pass
  • cargo test --manifest-path src-tauri/Cargo.toml --workspace — pass (99 tests)
  • cargo test --manifest-path crates/codex-mac-engine/Cargo.toml --all-targets — pass
  • cargo test --manifest-path crates/codex-win-engine/Cargo.toml --all-targets — pass
  • macOS release runtime check — Cmd+R and Cmd+P remain blocked
  • Exact second-pass codex review --base origin/mainpass: no P1/P2 and no findings (未发现会破坏现有功能或阻碍合并的缺陷。)
  • git diff --check origin/main...HEAD — pass
  • GitHub PR checks — pass (6/6)

Deployment notes

No migration is required. On Windows release builds, the main window intentionally remains hidden until the native WebView2 accelerator gate succeeds; an unsupported or failed gate shows a native startup error and exits instead of exposing an unsafe WebView. Development builds retain debugging behavior.

Closes #167

@Wangnov Wangnov marked this pull request as ready for review July 11, 2026 12:40
@Wangnov Wangnov merged commit 35e3fb8 into main Jul 11, 2026
6 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(shell): enforce WebView trust boundaries and root crash recovery

1 participant