Skip to content

fix: enforce authorization on generic task kill/pause/unpause - #10271

Open
PerumalsamyR wants to merge 1 commit into
determined-ai:mainfrom
PerumalsamyR:fix/generic-task-authz-10270
Open

fix: enforce authorization on generic task kill/pause/unpause#10271
PerumalsamyR wants to merge 1 commit into
determined-ai:mainfrom
PerumalsamyR:fix/generic-task-authz-10270

Conversation

@PerumalsamyR

Copy link
Copy Markdown

Summary

KillGenericTask, PauseGenericTask, and UnpauseGenericTask in master/internal/api_generic_tasks.go looked up a task solely by ID and acted on it without any authorization check. As a result, any authenticated user could cancel, pause, or unpause another user's generic tasks just by supplying the task ID — a cross-user denial-of-service on shared multi-user clusters.

This fixes #10270.

Root cause

The sibling read endpoints in the same subsystem already gate access:

  • GetTask and GetGenericTaskConfig (master/internal/api_task.go) both call a.canDoActionsOnTask(...), which for generic/NTSC tasks routes through canAccessNTSCTaskCanGetNSC.
  • Sibling NSC lifecycle endpoints (KillCommand, KillNotebook, KillShell, KillTensorboard) all check the authz provider before acting.

The three generic-task lifecycle endpoints skipped this step entirely.

Change

Add an a.canDoActionsOnTask(ctx, taskID) check at the top of each of the three handlers, before the task is fetched and mutated — matching the pattern already used by GetGenericTaskConfig. Permission-denied is surfaced as NotFound, consistent with the existing endpoints, so task existence is not leaked to unauthorized callers.

Testing

  • Added TestGenericTaskLifecycleAuthZ (master/internal/api_generic_tasks_intg_test.go), which mocks the NSC authz provider to deny access and asserts that all three endpoints reject the request. The test fails on main (endpoints proceed without an authz call) and passes with this change.
  • Verified existing related tests still pass: TestGetTask, TestGetGenericTaskConfig, TestAuthZCanTerminateNSC.
--- PASS: TestGenericTaskLifecycleAuthZ (0.82s)
    --- PASS: TestGenericTaskLifecycleAuthZ/kill
    --- PASS: TestGenericTaskLifecycleAuthZ/pause
    --- PASS: TestGenericTaskLifecycleAuthZ/unpause

Notes

No API/proto changes; the fix is limited to server-side authorization enforcement. Behavior for authorized callers is unchanged.

@PerumalsamyR
PerumalsamyR requested a review from a team as a code owner July 15, 2026 07:24
@PerumalsamyR
PerumalsamyR requested a review from maxrussell July 15, 2026 07:24
@cla-bot

cla-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: PerumalsamyR.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@PerumalsamyR
PerumalsamyR force-pushed the fix/generic-task-authz-10270 branch from 8ad47c0 to 63dc1f4 Compare July 15, 2026 07:36
@cla-bot

cla-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @PerumalsamyR on file. In order for us to review and merge your code, please start the CLA process at https://determined.ai/cla.

After we approve your CLA, we will update the contributors list (private) and comment @cla-bot[bot] check to rerun the check.

@PerumalsamyR
PerumalsamyR force-pushed the fix/generic-task-authz-10270 branch from 63dc1f4 to 84a9f07 Compare July 15, 2026 07:37
@cla-bot

cla-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @PerumalsamyR on file. In order for us to review and merge your code, please start the CLA process at https://determined.ai/cla.

After we approve your CLA, we will update the contributors list (private) and comment @cla-bot[bot] check to rerun the check.

KillGenericTask, PauseGenericTask, and UnpauseGenericTask acted on a
task looked up solely by ID, without any authorization check. Any
authenticated user could cancel, pause, or unpause another user's
generic tasks by supplying the task ID, allowing cross-user disruption
of running workloads on a shared cluster.

The sibling read endpoints GetTask and GetGenericTaskConfig already
gate access through canDoActionsOnTask, which routes generic tasks
through canAccessNTSCTask -> CanGetNSC. These three lifecycle endpoints
skipped that step entirely.

Add a canDoActionsOnTask check at the start of each handler so callers
must be authorized for the task before it is killed, paused, or
unpaused. Permission-denied is surfaced as NotFound, consistent with
the existing endpoints, so task existence is not leaked.

Add an integration test covering the denied-access path for all three
endpoints.
@PerumalsamyR
PerumalsamyR force-pushed the fix/generic-task-authz-10270 branch from 84a9f07 to fc230ba Compare July 15, 2026 08:29
@cla-bot

cla-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @PerumalsamyR on file. In order for us to review and merge your code, please start the CLA process at https://determined.ai/cla.

After we approve your CLA, we will update the contributors list (private) and comment @cla-bot[bot] check to rerun the check.

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.

🐛[bug] Missing authorization on generic task kill/pause/unpause allows any authenticated user to disrupt another user's workloads

1 participant