Skip to content

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

Open
github-actions[bot] wants to merge 1 commit into
release/2.34from
backport/26600-to-2.34
Open

fix: pin workspace agent API client to intended agent (#26600)#26611
github-actions[bot] wants to merge 1 commit into
release/2.34from
backport/26600-to-2.34

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Backport of #26600 to release/2.34.

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

The automatic cherry-pick conflicted because #26600 was built on a separate request-context refactor of apiClient that is not present on this release branch. The redirect block and agent-address pinning are applied to the existing apiClient() here, and the request-context-bounded dial test (which depends on that refactor) is omitted. This branch had no agentconn_test.go, so the redirect tests are added as a new agentconn_test.go. The two redirect regression tests added by #26600 are included.

@github-actions github-actions Bot requested a review from ethanndickson June 23, 2026 13:08
@ethanndickson ethanndickson force-pushed the backport/26600-to-2.34 branch from 47693a1 to 728a3e6 Compare June 23, 2026 13:39
@ethanndickson ethanndickson changed the title fix: pin workspace agent API client to intended agent (#26600) (conflicts) fix: pin workspace agent API client to intended agent (#26600) Jun 23, 2026
@ethanndickson

Copy link
Copy Markdown
Member

This backport required a fairly involved manual conflict resolution: #26600 was built on a separate request-context refactor of apiClient that isn't present on this release branch, so the redirect-blocking and agent-address pinning had to be re-applied by hand to the older apiClient(), and the test layout differs per branch. Extra scrutiny on the resolution is appreciated.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 728a3e64eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Backport of #26600 to release/2.34.

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.

(cherry picked from commit eeb2624)
@ethanndickson ethanndickson force-pushed the backport/26600-to-2.34 branch from 728a3e6 to aa89df6 Compare June 23, 2026 14:32
@ethanndickson ethanndickson requested a review from f0ssel June 23, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant