Loss of Object Properties When Editing with Restricted View Permissions #10937

Open
opened 2025-12-29 21:37:58 +01:00 by adam · 1 comment
Owner

Originally created by @julianstolp on GitHub (Mar 24, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.5

Python Version

3.12

Steps to Reproduce

As Superuser:

  1. Create site s1, devicetype dt1, device role dr1
  2. Create Tag tag1
  3. Create custom field cf1 with object type dcim>device
  4. Create device device1 with tag1, tag2 and every required field (dr1, dt1, s1)
  5. Create user user1 with the following permissions
    • permission1: view DCIM > device, device role, device type, site
    • permission2: view Extras > tag constraints { "slug": "tag1"}
    • permission3: change DCIM > device

As user1

  1. Go to device1 into edit mode
  2. Change anything or nothing as you like
  3. Hit save
  4. tag2 is lost

This happens with every object property the user is not allowed to view!

Expected Behavior

The user should not be able to delete entries on the object just because he cannot see them. This leads to missing data.
In the object overview, the user sees all data, which should also be visible in the edit view, but not changeable unless explicit permission has been granted.

Observed Behavior

The user deletes data unintentionally and is not even aware of it.

Image

Image

Image

Originally created by @julianstolp on GitHub (Mar 24, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.5 ### Python Version 3.12 ### Steps to Reproduce As Superuser: 1. Create site s1, devicetype dt1, device role dr1 3. Create Tag tag1 4. Create custom field cf1 with object type dcim>device 5. Create device device1 with tag1, tag2 and every required field (dr1, dt1, s1) 6. Create user user1 with the following permissions - permission1: view DCIM > device, device role, device type, site - permission2: view Extras > tag constraints { "slug": "tag1"} - permission3: change DCIM > device As user1 1. Go to device1 into edit mode 2. Change anything or nothing as you like 3. Hit save 4. tag2 is lost **This happens with every object property the user is not allowed to view!** ### Expected Behavior The user should not be able to delete entries on the object just because he cannot see them. This leads to missing data. **In the object overview, the user sees all data, which should also be visible in the edit view, but not changeable unless explicit permission has been granted.** ### Observed Behavior The user deletes data unintentionally and is not even aware of it. ![Image](https://github.com/user-attachments/assets/debb6dda-e184-495b-ae5a-06a8c24ddc67) ![Image](https://github.com/user-attachments/assets/ef999313-3f3c-4b98-b137-8847bdd180dd) ![Image](https://github.com/user-attachments/assets/be302da9-c6ff-41c7-b609-7900f4b5cb5f)
adam added the type: bugnetboxstatus: backlogseverity: low labels 2025-12-29 21:37:58 +01:00
Author
Owner

@arthanson commented on GitHub (Mar 26, 2025):

This is reproducible, but a very niche case I'm going to put it in the backlog as any solution could have performance issues, it sounds like a potential solution is to do a permission check on each field and switch it to non-editable if the permission check fails, but not sure what side-effects this would have or performance issues.

@arthanson commented on GitHub (Mar 26, 2025): This is reproducible, but a very niche case I'm going to put it in the backlog as any solution could have performance issues, it sounds like a potential solution is to do a permission check on each field and switch it to non-editable if the permission check fails, but not sure what side-effects this would have or performance issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10937