Skip to content

Commit d50e846

Browse files
fix: block vpn tailnet endpoint when --browser-only is set (coder#16647)
The work on CoderVPN required a new user-scoped `/tailnet` endpoint for coordinating with multiple workspace agents, and receiving workspace updates. Much like the `/coordinate` endpoint, this needs to respect the `CODER_BROWSER_ONLY`/`--browser-only` deployment config value.
1 parent 4449931 commit d50e846

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

coderd/workspaceagents.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ func (api *API) workspaceAgentClientCoordinate(rw http.ResponseWriter, r *http.R
906906
}
907907

908908
// This is used by Enterprise code to control the functionality of this route.
909+
// Namely, disabling the route using `CODER_BROWSER_ONLY`.
909910
override := api.WorkspaceClientCoordinateOverride.Load()
910911
if override != nil {
911912
overrideFunc := *override
@@ -1576,6 +1577,16 @@ func (api *API) workspaceAgentsExternalAuthListen(ctx context.Context, rw http.R
15761577
func (api *API) tailnetRPCConn(rw http.ResponseWriter, r *http.Request) {
15771578
ctx := r.Context()
15781579

1580+
// This is used by Enterprise code to control the functionality of this route.
1581+
// Namely, disabling the route using `CODER_BROWSER_ONLY`.
1582+
override := api.WorkspaceClientCoordinateOverride.Load()
1583+
if override != nil {
1584+
overrideFunc := *override
1585+
if overrideFunc != nil && overrideFunc(rw) {
1586+
return
1587+
}
1588+
}
1589+
15791590
version := "2.0"
15801591
qv := r.URL.Query().Get("version")
15811592
if qv != "" {

0 commit comments

Comments
 (0)