-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
NetBox Edition
NetBox Community
NetBox Version
v4.4.8
Python Version
3.12
Steps to Reproduce
- Navigate to Admin → Permissions (or go to
/users/permissions/add/) - Click Add (create a new Object Permission)
- In the Object types selector, scroll/search for terms like
ObjectType,cached,queue, etc. - Observe that internal/third-party models appear in the selectable list
Expected Behavior
The Object types selector should only include object types that make sense for NetBox ObjectPermissions, for example:
- user-facing NetBox models, and
- plugin models intended to participate in NetBox’s object permission system
Internal metadata models and third-party dependency/tooling models (like the examples above) should not be offered as selectable object types.
Observed Behavior
The selector includes internal/third-party models such as:
core.ObjectTypedebug_toolbar.historyentry*django_rq.queueextras.cached_valuemigrations.migration*thunmbnail.kv_store
*) only listed in a local dev environment
Additional Notes / Suggestion
First off: thank you for the recent improvements around the ObjectPermission UI (especially the object type grouping introduced around #20759). It makes the selector much easier to navigate.
From a quick look, this seems to be related to the queryset/filter used to build the choices. The current filter appears to be:
OBJECTPERMISSION_OBJECT_TYPES = Q(
~Q(app_label__in=['account', 'admin', 'auth', 'contenttypes', 'sessions', 'taggit', 'users']) |
Q(app_label='users', model__in=['objectpermission', 'token', 'group', 'user'])
)
As written, this behaves like a small denylist (plus a special-case allowlist for users.*), which means any other installed Django app (including dev tooling / background worker apps) can show up as selectable object types.
I’d like to suggest a review of all object types that are currently eligible for ObjectPermissions. A short-term fix could be to exclude known internal and common third-party tooling apps/models.
Longer-term, it might be more robust to base the selector on a “user-facing/public models” concept (while still supporting plugins), rather than relying on a denylist of a few Django apps.
Happy to help test any changes.