AttributeError when trying to sort table without being logged in #53

Closed
opened 2026-04-05 16:21:21 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @fabi125 on 3/30/2026

NetBox Edition

NetBox Community

NetBox Version

v4.5.5

Python Version

3.12

Steps to Reproduce

  1. Allow view access to NetBox for unauthenticated users.
  2. Open up a random UI list view, e.g. http://netbox/dcim/devices/
  3. Click on any columns to sort the data by that column

Expected Behavior

Data is sorted by that column.

Observed Behavior

Nothing happens. Looking at the network requests that get sent out, it shows http://netbox/dcim/devices/?sort=name which resulted in a 500.

Opening that URL in a new tab shows the following error:

<class 'AttributeError'>

'AnonymousUser' object has no attribute 'config'

Python version: 3.12.10
NetBox version: 4.5.5
Plugins: None installed

The error seems to come from here: https://github.com/netbox-community/netbox/blob/v4.5.5/netbox/netbox/tables/tables.py#L162-L170

BaseTable tries to save the selected column to the user config, which doesn't exist if the user is not logged in.

My suggestion would be to add request.user.is_authenticated to the condition on line 162. Happy to put up a PR for this.

*Originally created by @fabi125 on 3/30/2026* ### NetBox Edition NetBox Community ### NetBox Version v4.5.5 ### Python Version 3.12 ### Steps to Reproduce 1. Allow view access to NetBox for unauthenticated users. 2. Open up a random UI list view, e.g. http://netbox/dcim/devices/ 3. Click on any columns to sort the data by that column ### Expected Behavior Data is sorted by that column. ### Observed Behavior Nothing happens. Looking at the network requests that get sent out, it shows `http://netbox/dcim/devices/?sort=name` which resulted in a 500. Opening that URL in a new tab shows the following error: ``` <class 'AttributeError'> 'AnonymousUser' object has no attribute 'config' Python version: 3.12.10 NetBox version: 4.5.5 Plugins: None installed ``` The error seems to come from here: https://github.com/netbox-community/netbox/blob/v4.5.5/netbox/netbox/tables/tables.py#L162-L170 `BaseTable` tries to save the selected column to the user config, which doesn't exist if the user is not logged in. My suggestion would be to add `request.user.is_authenticated` to the condition on line 162. Happy to put up a PR for this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#53