[DOM-75520] fix: enforce owner-based RBAC on all job endpoints#20
Open
ddl-subir-m wants to merge 1 commit intomainfrom
Open
[DOM-75520] fix: enforce owner-based RBAC on all job endpoints#20ddl-subir-m wants to merge 1 commit intomainfrom
ddl-subir-m wants to merge 1 commit intomainfrom
Conversation
This was referenced Mar 20, 2026
5 tasks
61afe7f to
f80ca44
Compare
7 tasks
Build on PR #30's auth-actions foundation to cover more endpoints: - JobListItemResponse lightweight schema for list views - build_job_list_item_response() with best_model extraction - summary_only CRUD optimization (skip large blobs in list queries) - Owner scoping on cleanup/preview/orphan endpoints - Owner filtering on registered models listing - clear_viewing_user() to prevent cross-request context leakage - Zombie local job detection for OOM'd training tasks - Background sync throttling state (not yet wired) - Python 3.9 compat: from __future__ import annotations in generated client Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bb15abf to
3513f67
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Security issue: All job endpoints are currently accessible by any authenticated user regardless of ownership. A user can read, cancel, or delete jobs they don't own. The job listing endpoint also accepts a client-supplied
ownerparameter, which could be used to enumerate other users' jobs.Additionally, the user identity resolution had the wrong priority:
get_request_owner()preferredget_viewing_user()(sidecar API) over thedomino-usernameheader. In the App context, the sidecar always returns the App owner's identity, not the actual viewing user's. This meant all RBAC checks were comparing against the App owner instead of the browser user.The
clear_viewing_user()fix prevents user context from leaking between requests in the same process.Depends on
summary_only, owner filtering in CRUD)Summary
Security fixes
_enforce_job_owner()on all single-job endpoints (get, status, metrics, progress, cancel, delete, logs) — returns 404 to non-owners to avoid leaking job existenceresolve_job_list_filters()ignores client-suppliedowner— always resolves server-side from authenticated userget_request_owner()inverted: prefersdomino-usernameheader (trusted, Domino proxy) over sidecar user (returns App owner)clear_viewing_user()prevents cross-request user context leakageOther improvements
JobListItemResponselightweight schema for dashboard (excludes leaderboard/diagnostics blobs)needs_requestflag in compat route patterns for forwarding Request to RBAC endpointsFiles changed
app/services/job_service.py— RBAC enforcement, owner resolution, background syncapp/api/schemas/job.py—JobListItemResponseapp/api/routes/jobs.py— Request forwarding for owner enforcementapp/api/compat/patterns.py—needs_requestflagapp/api/compat/custom_jobs.py— owner enforcement on compat routesapp/api/compat/custom_models.py— owner filtering on modelsapp/services/model_service.py— owner param on registered modelsapp/core/context/user.py—clear_viewing_user()app/core/leaderboard_utils.py— leaderboard normalization helpers (dependency)app/main.py— clear user context after each requesttests/test_job_service.py— updated + new RBAC teststests/test_compat_jobs.py— compat route teststests/test_auth_header_concurrency.py— concurrency testsTest plan
test_job_service.pypassestest_compat_jobs.pypassestest_auth_header_concurrency.pypassesdomino-usernameheader takes priority over sidecar