Repository navigation
Conversation
…n-loopback address
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
The fix looks correct. Building the onBeforeSendHeaders filter from the published sidecar host, and registering it again on each SidecarCredentials change, keeps the exact-origin and top-level-renderer checks in SidecarCredentials.authorization. So a wider filter doesn't send the credential anywhere new.
I couldn't run the desktop app here. The new test passes with this change and fails on the base for the Tailscale and LAN-name cases. tsc -b for packages/desktop passes. Its typecheck script fails with "Script not found" before checking anything.
Public API: unchanged (internal desktop main-process code only).
One small point inline: the onChange subscription added for each window is never removed.
Fixes #51075
| session.webRequest.onBeforeSendHeaders({ urls: sidecarUrls(SidecarCredentials.get()) }, credential) | ||
|
|
||
| follow() | ||
| SidecarCredentials.onChange(follow) |
There was a problem hiding this comment.
wireRendererHeaders runs for every new window, and this subscription is never removed. Each window you open adds another follow listener that lives for the life of the app, and every listener registers the same session filter again. Could you keep the stop function that onChange returns and call it when the window is closed?
When the background service is configured to listen on a non-loopback address (
hostnamein~/.config/opencode/service.json, for example a Tailscale IP to share it), the desktop app on that machine fails every request to its own server with 401:BackgroundServicepublishes the sidecar ashttp://100.87.251.43:45278.AuthorizationinonBeforeSendHeaders, but that filter only matched127.0.0.1andlocalhost.starting v2 background servicelog lines, and a 401 on the server for every/api/event,/api/infoand session read.Fix
wireRendererHeadersnow builds its filter from the published sidecar endpoint. It registers again on everySidecarCredentialschange, because the window opens before the service is ready.SidecarCredentials.authorizationstill adds the header only for the exact sidecar origin, from the renderer's top-level frame.Visual
Added by the opencode bot (AI-generated).
Fixes #51075