Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: pin workspace agent API client to intended agent (#26600) - #26622

Merged
f0ssel merged 1 commit into
release/2.29from
backport/26600-to-2.29
Jun 27, 2026
Merged

fix: pin workspace agent API client to intended agent (#26600)#26622
f0ssel merged 1 commit into
release/2.29from
backport/26600-to-2.29

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

Backport of #26600 to release/2.29.

Original PR: #26600 - fix: pin workspace agent API client to intended agent
Merge commit: eeb2624
Requested by: @ethanndickson

What this fixes

The workspace agent API client followed HTTP redirects and trusted the redirected host, letting a malicious agent bounce a coderd request onto a different agent's unauthenticated port-4 API (cross-tenant file read/write and RCE, Cure53 CODAGT-668). apiClient now refuses redirects and pins every dial to the intended agent address, and the task-app / scaletest clients share AppHTTPClient, which blocks redirects too.

Conflict resolution

This 2.29 ESR backport was resolved using the existing release/2.32 backport (#26612) as a reference; that resolution applies cleanly here. #26600 was built on a separate request-context refactor of apiClient that is not present on this release branch, so the redirect block and agent-address pinning are applied to the existing apiClient(), and the request-context-bounded dial test (which depends on that refactor) is omitted. This branch had no agentconn_test.go, so the redirect regression tests are added as a new agentconn_test.go. The generated agent-conn mock additionally required its net/http import for the new AppHTTPClient method.

Backport of #26600 to release/2.29.

The workspace agent API client followed HTTP redirects and trusted the
redirected host, letting a malicious agent bounce a coderd request onto
a different agent's unauthenticated port-4 API (cross-tenant file
read/write and RCE). apiClient now refuses redirects and pins every dial
to the intended agent address, and the task app / scaletest clients
share AppHTTPClient, which blocks redirects too.

The upstream change was built on a separate request-context refactor of
apiClient that is not present on this release branch, so the redirect
block and agent-address pinning are applied to the existing apiClient()
here and the request-context-bounded dial test is omitted. The generated
agent-conn mock also needed its net/http import for the new AppHTTPClient
method.

(cherry picked from commit eeb2624)
@ethanndickson
ethanndickson force-pushed the backport/26600-to-2.29 branch from ad78e3e to 4a5d9aa Compare June 23, 2026 14:31
@ethanndickson
ethanndickson requested a review from f0ssel June 23, 2026 14:43
@f0ssel
f0ssel merged commit f8bdec5 into release/2.29 Jun 27, 2026
25 checks passed
@f0ssel
f0ssel deleted the backport/26600-to-2.29 branch June 27, 2026 12:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 27, 2026
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