Repository navigation
feat(desktop): scope TLS cert verification to individual backend connections - #12927
Abhijay007 wants to merge 6 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae4ab13f48
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
This pull request has been automatically marked as stale because it has not had recent activity for 23 days. What happens next?
Thank you for your contribution! 🚀 |
jbg
left a comment
There was a problem hiding this comment.
The per-session verifier isolates the pins for two concurrent connections to the same hostname. The two existing CSP and storage threads still apply to this head.
One issue criterion is still unsettled: remoteBackends.ts checks that the resolved status and ACP origins match only after sending the authenticated ACP probe. The configured pin constrains redirects by hostname, so a different port still passes that check. Please settle the supported redirect and port behavior from #11704 and validate the allowed origin before sending the secret.
Could you also add a regression check that exercises two actual window sessions through the probe and WebSocket paths and verifies that both receive the renderer CSP? The current mocked verifier test covers the pin decision, and the source-text check can pass with the CSP handler attached only to the old session.
Validate the ACP origin before sending credentials, apply CSP to each renderer session, and migrate legacy desktop preferences. Exercise separate pins and CSP with real Electron windows.
ae4ab13 to
870ac4a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 870ac4a17d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfa3c2e56e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Store chat input history separately from preferences and migrate existing history. Reuse the legacy spellchecker dictionary to preserve custom words across isolated backend sessions.
jbg
left a comment
There was a problem hiding this comment.
Please address the two findings below.
| let gooseServeLease: GooseServeLease | null = null; | ||
|
|
||
| const partitionKey = ++backendPartitionCounter; | ||
| const windowPartition = `persist:goose-${partitionKey}`; |
There was a problem hiding this comment.
[P2] Tie the browser partition’s lifetime to the connection. Every chat window creates a disk-backed persist:goose-N partition. Closing the window leaves its browser state on disk, and the counter starts over on relaunch. A different backend lease can then inherit the previous lease’s partition, including its cache and cookies. Use an in-memory partition or explicitly manage the stored state when a lease ends.
| } | ||
| event.returnValue = | ||
| key === CHAT_HISTORY_KEY | ||
| ? updateChatHistory(pruneStoredMessageHistory) |
There was a problem hiding this comment.
[P2] Keep disk reads off the input-history shortcut. Each Cmd/Ctrl+Up or Down reads, parses, and serializes the entire history file through synchronous IPC. With large saved prompts, holding the shortcut can block Electron’s main process and stall other windows. Serve history navigation from memory or use asynchronous IPC.
jbg
left a comment
There was a problem hiding this comment.
I’d pause revisions here and revisit which part of desktop owns the isolated connection. The latest commit addresses my two previous findings, and the two-backend test is worth keeping.
Moving the whole chat window into an in-memory session has reopened the dictionary regression. Electron doesn’t support adding custom words to an in-memory session, so copying the shared dictionary into each chat can’t preserve that behavior on Linux. I also found that the history migration leaves the original prompts in persist:goose after the new history store expires or clears them.
Let’s return to #11704 — Scope desktop backend TLS pins to individual connections and trace what it would take for the lease to own the authenticated HTTP and WebSocket traffic while the renderer keeps its persistent profile. The deciding question is whether every authenticated request, including those from standalone app windows, can use that transport. I’d settle that before asking for another implementation round.
Fixes: #11704
Summary
Each backend connection now gets its own isolated Electron session (persist:goose-${n}) with a cert verifier scoped to that connection's trust object only — fixing the bug where two windows on the same hostname could cross-authorize each other's TLS certificates.
Testing
backendCertificateVerifier.test.ts, including the key isolation case: two sessions on the same hostname each reject the other's certificate fingerprint.pnpm run typecheck,pnpm run lint, andpnpm testall pass (938 tests).