Skip to content

fix(vpn): avoid setting session token header twice #18524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jun 24, 2025

coderd currently does not handle a session token header value of the form token1, token2. However, it does handle multiple instances of the token header by simply taking the first. This is the default behaviour of http.Header.Get.

So, setting the token header twice causes issues when Coder is behind a proxy that merges duplicate headers, such as Apache.

This PR ensures we don't set it twice by not sharing one slice between the HTTPClient and the websocket.DialerOptions. It also adds a regression test.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson marked this pull request as ready for review June 24, 2025 10:56
@ethanndickson ethanndickson force-pushed the ethan/avoid-setting-token-header-twice branch from f53cc17 to 591a3b7 Compare June 24, 2025 10:56
@ethanndickson ethanndickson changed the title fix: avoid setting session token header twice chore: fix typo when setting dial headers Jun 24, 2025
@ethanndickson ethanndickson force-pushed the ethan/avoid-setting-token-header-twice branch from 591a3b7 to bafa0c6 Compare June 24, 2025 11:02
@ethanndickson ethanndickson force-pushed the ethan/avoid-setting-token-header-twice branch from bafa0c6 to cbf7ec7 Compare June 24, 2025 11:30
@ethanndickson ethanndickson changed the title chore: fix typo when setting dial headers fix(vpn): avoid setting session token header twice Jun 24, 2025
@ethanndickson ethanndickson merged commit 79c666b into main Jun 25, 2025
45 checks passed
@ethanndickson ethanndickson deleted the ethan/avoid-setting-token-header-twice branch June 25, 2025 01:27
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants