Jobs tab lists other users' jobs without applying object permissions
NetBox Edition
NetBox Community
NetBox Version
v4.7.1
Python Version
3.12
Steps to Reproduce
- As an admin, create two users,
aliceandbob, neither of them superusers. - Create an object permission granting
core.view_jobwith the constraint{"user": "$user"}, and assign it to both users. This is meant to let each user see only their own jobs. - Grant both users
core.view_datasource. - As
alice, create a data source and sync it, so a Job is recorded withaliceas the owning user. - Log in as
boband open the data source's Jobs tab at/core/data-sources/<pk>/jobs/.
Expected Behavior
The Jobs tab shows only jobs matching bob's core.view_job constraint, so alice's job is not listed. This matches the sibling changelog and journal tabs, which filter their querysets against the same user's permissions.
Observed Behavior
The tab lists alice's job, including its ID, name, status, timestamps and owning username. The error and log_entries columns expose their contents too if the user enables them in the table config. The core.view_job constraint is silently ignored.
The same gap appears on the script list at /extras/scripts/, which renders the most recent job for each script through JobsMixin.get_latest_jobs. That path additionally dereferences job.data in the template, so another user's script test results are shown.
Suspected Cause
ObjectJobsView.get_jobs (netbox/netbox/views/generic/feature_views.py:194) builds the Job queryset without .restrict(). Its own get_object restricts at :192, and the sibling changelog and journal views restrict at :63 and :141. The permission='core.view_job' argument on the ViewTab only controls tab visibility.
Same gap at two more sites:
ScriptJobsView(netbox/extras/views.py:1809) passesscript.jobs.all()JobsMixin.get_latest_jobs(netbox/netbox/models/features.py:527) returns an unrestricted queryset
The Jobs tab auto-registers for every JobsMixin model (features.py:818), so this is not limited to data sources and scripts. ScriptResultView is unaffected, fixed in #22283.
Proposed Fix
No response
Source: netbox-community/netbox