fix(coderd): reject agent requests from suspended owners (#28513) by github-actions[bot] · Pull Request #28652 · coder/coder · GitHub
Skip to content

fix(coderd): reject agent requests from suspended owners (#28513) - #28652

Merged
mtojek merged 2 commits into
release/2.34from
backport/28513-to-2.34
Aug 26, 2026
Merged

fix(coderd): reject agent requests from suspended owners (#28513)#28652
mtojek merged 2 commits into
release/2.34from
backport/28513-to-2.34

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #28513

Original PR: #28513 — fix(coderd): reject agent requests from suspended owners
Merge commit: 2f50b2d
Requested by: @hwang251

## What

`ExtractWorkspaceAgentAndLatestBuild` computed the workspace owner's
RBAC subject via `UserRBACSubject`, but discarded the returned user
status. As a result, workspace agent requests were still authorized even
when the owner's account was suspended.

This change captures `userStatus` and rejects the request with `401
Unauthorized` when the owner is not `Active`, returning a clear message
directing the user to contact an admin to reactivate the account.

## Changes

- `coderd/httpmw/workspaceagent.go`: stop discarding the owner status
from `UserRBACSubject`; return `401` when the owner is not active.
- `coderd/httpmw/workspaceagent_test.go`: add an `InactiveUser` test
that suspends the owner and asserts a `401` with the expected message.

## Testing

- New `TestWorkspaceAgent/InactiveUser` unit test covers the
suspended-owner path.

---

> This PR was created by Coder Agents on behalf of @hwang251.

(cherry picked from commit 2f50b2d)
@github-actions github-actions Bot added the backport/v2.34 Backport PR targeting release/2.34 label Aug 26, 2026
@github-actions
github-actions Bot requested a review from hwang251 August 26, 2026 17:50
@hwang251
hwang251 requested a review from mtojek August 26, 2026 17:51
@mtojek
mtojek merged commit 33694a9 into release/2.34 Aug 26, 2026
25 checks passed
@mtojek
mtojek deleted the backport/28513-to-2.34 branch August 26, 2026 19:34
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v2.34 Backport PR targeting release/2.34

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants