User and group queries are not properly restricted via GraphQL API #5653

Closed
opened 2025-12-29 19:30:42 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Nov 12, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0.9

Python version

3.8

Steps to Reproduce

  1. Log into NetBox as a user without permission to view user or group objects
  2. Navigate to the GraphQL API view (/graphql/)
  3. Enter the following query:
query {
    user_list
     {
      username
      password
    }
  }

Expected Behavior

The query should return an empty list due to insufficient permissions.

Observed Behavior

The results are not filtered. This is due to a missing call to restrict() on the queryset for these models. (These models are provided by the Django framework, so they're handled a bit differently than native NetBox models.)

Originally created by @jeremystretch on GitHub (Nov 12, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0.9 ### Python version 3.8 ### Steps to Reproduce 1. Log into NetBox as a user without permission to view user or group objects 2. Navigate to the GraphQL API view (`/graphql/`) 3. Enter the following query: ``` query { user_list { username password } } ``` ### Expected Behavior The query should return an empty list due to insufficient permissions. ### Observed Behavior The results are not filtered. This is due to a missing call to `restrict()` on the queryset for these models. (These models are provided by the Django framework, so they're handled a bit differently than native NetBox models.)
adam added the type: bugstatus: accepted labels 2025-12-29 19:30:42 +01:00
adam closed this issue 2025-12-29 19:30:42 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 12, 2021):

This will be fixed in the next release (v3.0.10). To address any potential security issues in the interim, NetBox administrators have the option of disabling the GraphQL API entirely by setting GRAPHQL_ENABLED = False in configuration.py. Alternatively, you can apply the patch from daf6c8e manually.

@jeremystretch commented on GitHub (Nov 12, 2021): This will be fixed in the next release (v3.0.10). To address any potential security issues in the interim, NetBox administrators have the option of disabling the GraphQL API entirely by setting `GRAPHQL_ENABLED = False` in `configuration.py`. Alternatively, you can apply the patch from daf6c8e manually.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5653