fix(coderd): reject workspace proxy hostname prefixes by geokat · Pull Request #27544 · coder/coder · GitHub
Skip to content

fix(coderd): reject workspace proxy hostname prefixes - #27544

Merged
geokat merged 3 commits into
mainfrom
george/plat-384/wsproxy-hostname-prefixes-match-bug
Jul 28, 2026
Merged

fix(coderd): reject workspace proxy hostname prefixes#27544
geokat merged 3 commits into
mainfrom
george/plat-384/wsproxy-hostname-prefixes-match-bug

Conversation

@geokat

@geokat geokat commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

A workspace proxy hostname prefix could be accepted as a valid proxy
access URL. An authenticated user could then be redirected to an
attacker-controlled domain with an application-connect API key in the
URL.

Require proxy access URL matches to have a hostname boundary after the
candidate hostname, allowing only the end of the URL, a port, or a
path.

Add regression coverage for proxy access URL and wildcard hostname
prefixes.

Refs: https://linear.app/codercom/issue/PLAT-384

Require access URL matches to end at a hostname boundary, preventing
attacker-controlled prefix domains from receiving application-connect API
keys through auth redirects.

Add regression coverage for access URL and wildcard hostname prefixes.

Refs: https://linear.app/codercom/issue/PLAT-384
@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown

@geokat
geokat marked this pull request as ready for review July 27, 2026 19:17
Comment thread coderd/database/querier_test.go
Comment thread coderd/database/querier_test.go

@BobbyHo BobbyHo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — just left a couple of non-blocking comments about adding some test coverage.

geokat and others added 2 commits July 27, 2026 14:22
Review feedback: add a test truncating mid-label, where the leftover starts with an ordinary character (and the candidate has a true delegated TLD).

Co-authored-by: Bobby Ho <bobbidinho@gmail.com>
@BobbyHo
BobbyHo self-requested a review July 27, 2026 21:47

@BobbyHo BobbyHo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thank you for adding the new test cases.

@geokat
geokat requested a review from jdomeracki-coder July 27, 2026 21:50

@jdomeracki-coder jdomeracki-coder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the patch is good enough as is

Long term it would probably make sense to avoid performing security sensitive checks using SQL entirely - instead we should move this check to Go

@geokat
geokat merged commit 8cc7f2b into main Jul 28, 2026
27 of 28 checks passed
@geokat
geokat deleted the george/plat-384/wsproxy-hostname-prefixes-match-bug branch July 28, 2026 20:21
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants