Repository navigation
fix(agent-server): ignore empty VS Code tkn on resource requests - #6804
Open
aribaskagan wants to merge 1 commit into
Open
aribaskagan wants to merge 1 commit into
aribaskagan wants to merge 1 commit into
Conversation
code-server appends an empty tkn query parameter on vscode-remote-resource URLs. The editor proxy treated any tkn parameter as the session-token exchange, so the empty value failed the compare and returned 401 before the editor cookie was checked. Only a non-empty tkn is the handshake. An empty or absent tkn falls through to the cookie check and is proxied. See OpenHands/OpenHands#19713
Contributor
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. Try requesting a review at a lower effort level.
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.
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.
HUMAN:
Found the empty tkn check in the proxy and tested the fix against a live code-server
AGENT:
Why
Embedded VS Code in agent-canvas 1.40 loads, but theme, grammar, and extension fetches to
/vscode/stable-…/vscode-remote-resource?path=…&tkn=return 401. code-server appends an emptytknon those URLs. The editor proxy treated anytknquery parameter as the session-token exchange, so the empty value failed the constant-time compare and returned 401 before the HttpOnly editor cookie was checked.Summary
tknis the handshake. A match still sets the editor cookie and returns 303. A mismatch still returns 401.tknfalls through to the existing cookie check and is proxied.vscode-remote-resourcestays authenticated by that cookie.Issue Number
Fixes #6803 (downstream report: OpenHands/OpenHands#19713)
How to Test
The proxy test needs Node. The live test needs an extracted code-server release. After a valid
?tkn=<token>exchange,…/vscode-remote-resource?path=…&tkn=with the editor cookie returns 200 (the live test servesdark_plus.jsonand expectsDark+). The same URL without the cookie returns 401.tkn=<wrong>returns 401.Video/Screenshots
N/A. The failure is an HTTP 401 on
vscode-remote-resource, covered by the tests above.Design Doc
Skipped. This is a small bug fix in the existing editor-proxy handshake.
Type
Notes
This change was written with AI assistance.
Draft #6195 changes how the connection token is passed on argv. It does not change this proxy handshake.