Repository navigation
fix(coderd/workspaceapps)!: strip session tokens before proxying to apps - #31633
Merged
Merged
Conversation
The app proxy only stripped Coder cookies, so a request authenticated with the Coder-Session-Token header or the coder_session_token query parameter forwarded the caller's API key to the workspace app. Remove both before the request reaches the app. The query parameter is removed from the raw query, so the rest of the query string is forwarded unchanged. Authorization and access_token are still forwarded since apps can use them for their own auth.
…bdomain app Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… helper Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dylanhuff-at-coder
marked this pull request as ready for review
November 4, 2026 16:56
BobbyHo
self-requested a review
November 4, 2026 17:23
BobbyHo
approved these changes
Nov 4, 2026
BobbyHo
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Just one small thing regarding the following comment:
Authorization and access_token are still forwarded since apps can use them for their own auth. Stripping those safely needs to know which credential Coder actually used, so that's left for a follow-up.
Would you mind creating a Linear ticket to track this so we can follow up on it later? Thanks!
Collaborator
Author
|
Thanks! Opened CORE-817 to track stripping |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 workspace app proxy stripped Coder cookies before forwarding a request to the app, but not the
Coder-Session-Tokenheader or thecoder_session_tokenquery parameter. App auth accepts both, so a client that authenticated that way (the CLI and codersdk, or an IDE extension pointed at a path app URL) passed its API key through to whatever runs behind the app. That matters most for shared apps and ports, where the caller's token reached a workspace owned by someone else.This strips both before proxying. The query parameter is removed from the raw query string, so everything else in the query reaches the app byte-for-byte.
Authorizationandaccess_tokenare still forwarded since apps can use them for their own auth. Stripping those safely needs to know which credential Coder actually used, so that's tracked in CORE-817.This is marked breaking because an app that relied on the caller's Coder token arriving through that header or query param won't get it anymore. Cookie-authenticated requests were already covered, so this only affects callers that send the token in that header or query param. Nothing in this repo depends on it. Apps that need to call the Coder API as the visitor should use the OAuth2 provider instead.
Covered by the shared app proxy tests, which run against coderd and wsproxy, for both the owner on a path app and another user on a shared subdomain app, plus unit tests for the query filtering.