Repository navigation
fix(opencode): protect credentials at the UI proxy boundary - #2
Draft
kartikkabadi wants to merge 1 commit into
Draft
kartikkabadi wants to merge 1 commit into
kartikkabadi wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The external UI fallback forwards the local server's Authorization and Cookie headers to app.opencode.ai. Its Fetch client also follows upstream redirects server-side, potentially reaching a different origin.
Strip those local credentials before the UI request, use manual redirect handling for this request, and build the destination by assigning only a pathname on the fixed UI URL. Workspace proxy authentication is unaffected. Redirect responses are returned to the browser rather than followed by the server.
Validation with pinned, officially verified Bun 1.3.14:
Draft scope: this is a confirmed credential-forwarding fix and proxy-boundary hardening found during source review. The connector cannot read CodeQL alert locations, so no mapping or closure is claimed for alerts anomalyco#7/anomalyco#8 or the other 30 findings. Intentional permission-controlled shell tools were not blindly restricted. Full application/native packaging and the full test suite were not run. No secret values were read or validated, no alerts were dismissed, and no merge/deployment/upstream change occurred.
AI assistance: prepared with Codex in ChatGPT Work Mode. Independent reviews used GPT-6.1 Sol with low reasoning. The primary session's exact model identifier is not exposed.
Summary by cubic
Fixes the external UI fallback leaking local credentials and following upstream redirects server-side.
The UI proxy no longer forwards the local server's Authorization and Cookie headers to app.opencode.ai, redirect responses are returned to the browser instead of being followed by the server, and destination URLs are built with a pathname assignment so authority-like paths stay on the trusted origin. Workspace proxy authentication is unaffected.
Written for commit 54f0321. Summary will update on new commits.