fix(coderd): reject agent requests from suspended owners by hwang251 · Pull Request #28513 · coder/coder · GitHub
Skip to content

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

Merged
hwang251 merged 2 commits into
mainfrom
plat-278
Aug 24, 2026
Merged

fix(coderd): reject agent requests from suspended owners#28513
hwang251 merged 2 commits into
mainfrom
plat-278

Conversation

@hwang251

Copy link
Copy Markdown
Contributor

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.

@linear-code

linear-code Bot commented Aug 24, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@hwang251

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

cdrci2 added a commit to coder/cla that referenced this pull request Aug 24, 2026
@hwang251 hwang251 changed the title fix(coderd/httpmw/workspaceagent): reject agent requests from suspended owners fix(coderd): reject agent requests from suspended owners Aug 24, 2026
@hwang251

Copy link
Copy Markdown
Contributor Author

@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

@hwang251
hwang251 merged commit 2f50b2d into main Aug 24, 2026
28 checks passed
@hwang251
hwang251 deleted the plat-278 branch August 24, 2026 22:25
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 24, 2026
@hwang251 hwang251 added backport backport/v2.34 Backport PR targeting release/2.34 backport/v2.35 Backport PR targeting release/2.35 and removed backport/v2.35 Backport PR targeting release/2.35 backport/v2.34 Backport PR targeting release/2.34 labels Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v2.35 Backport PR targeting release/2.35 backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants