If you create objects (cables, devices, IPs, almost everything...) without specifying a tenant while you have no rights to create them without a tenant, they are still created as “zombies” and cannot be deleted. #11221

Closed
opened 2025-12-29 21:42:08 +01:00 by adam · 4 comments
Owner

Originally created by @jr3001 on GitHub (May 27, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.7

Python Version

3.10

Steps to Reproduce

  1. Create a user of type "Employee"
  2. Create a Tenant and name it what you want, copy the tenant_id out of the url.
  3. Give the user OR group only Tenant specific rights to e.g. create a Device
    1. to do this you go as admin to "Admin" -> "Permissions" create a new permission, allow actions "Can view", "Can add", "Can change" & "Can delete" and then assign permissions:
      • DCIM > Device
    2. you assign the permission to the user.
    3. at the end you paste the following under "Restrictions" of the Permission and replace the tenant_id with the tenant you created bevore.
      {"tenant__id": 22}
      it can look like that:
      Image
    4. to make the user able to see Device-types and roles and stuff you create a second permission non-tenant specific, to do this start the creation process allow action "Can view" only and select the following permissions after assigning the permission to the User:
      • DCIM > Devicerole
      • DCIM > Devicetype
      • DCIM > Location

it can look like that:
Image

  1. Try to create a Device using NO TENANT with the Test User.
    • you will get error: Operation failed due to object-level permissions violation

Image
Image

  1. Login as Admin
  2. Search for the Device name or similar, you will find the device.
  3. Try to edit the Zombie, you will get an error but it will apply the change.```<class 'dcim.models.devices.Device.DoesNotExist'>evice matching query does not exist.

Python-Version: 3.11.2
NetBox-Version: 4.2.7
Plugins:
netbox_branching: 0.5.4
netbox_documents: 0.7.2
netbox_interface_synchronization: 4.1.6
netbox_inventory: 2.3.0
netbox_ipcalculator: 1.4.9
netbox_topology_views: 4.2.1

7. Try to delete the device, its impossible due to:

<class 'dcim.models.devices.Device.DoesNotExist'>

Device matching query does not exist.

Python-Version: 3.11.2
NetBox-Version: 4.2.7
Plugins:
netbox_branching: 0.5.4
netbox_documents: 0.7.2
netbox_interface_synchronization: 4.1.6
netbox_inventory: 2.3.0
netbox_ipcalculator: 1.4.9
netbox_topology_views: 4.2.1


### Expected Behavior

Device is not going to be created due to permissions.

### Observed Behavior

User got error `Operation failed due to object-level permissions violation` but a zombie/broken device got created.
Originally created by @jr3001 on GitHub (May 27, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.7 ### Python Version 3.10 ### Steps to Reproduce 1. Create a user of type "Employee" 2. Create a Tenant and name it what you want, copy the tenant_id out of the url. 3. Give the user OR group only Tenant specific rights to e.g. create a Device 1. to do this you go as admin to "Admin" -> "Permissions" create a new permission, allow actions "Can view", "Can add", "Can change" & "Can delete" and then assign permissions: - DCIM > Device 2. you assign the permission to the user. 3. at the end you paste the following under "Restrictions" of the Permission and replace the tenant_id with the tenant you created bevore. `{"tenant__id": 22}` it can look like that: ![Image](https://github.com/user-attachments/assets/e5d07369-a89f-4d96-9b97-5835c4f51ea2) 4. to make the user able to see Device-types and roles and stuff you create a **second** permission non-tenant specific, to do this start the creation process allow action "Can view" only and select the following permissions after assigning the permission to the User: - DCIM > Devicerole - DCIM > Devicetype - DCIM > Location it can look like that: ![Image](https://github.com/user-attachments/assets/727aa83a-2f16-455a-abf2-3bafce468a4b) 5. Try to create a Device using NO TENANT with the Test User. - you will get error: Operation failed due to object-level permissions violation ![Image](https://github.com/user-attachments/assets/63df0d1b-2711-4ba6-ace8-b5468c00073e) ![Image](https://github.com/user-attachments/assets/edb5f799-681b-4246-bca6-f8ae9cc9b0b2) 6. Login as Admin 7. Search for the Device name or similar, you will find the device. 8. Try to edit the Zombie, you will get an error but it will apply the change.```<class 'dcim.models.devices.Device.DoesNotExist'>evice matching query does not exist. Python-Version: 3.11.2 NetBox-Version: 4.2.7 Plugins: netbox_branching: 0.5.4 netbox_documents: 0.7.2 netbox_interface_synchronization: 4.1.6 netbox_inventory: 2.3.0 netbox_ipcalculator: 1.4.9 netbox_topology_views: 4.2.1 ``` 7. Try to delete the device, its impossible due to: ``` <class 'dcim.models.devices.Device.DoesNotExist'> Device matching query does not exist. Python-Version: 3.11.2 NetBox-Version: 4.2.7 Plugins: netbox_branching: 0.5.4 netbox_documents: 0.7.2 netbox_interface_synchronization: 4.1.6 netbox_inventory: 2.3.0 netbox_ipcalculator: 1.4.9 netbox_topology_views: 4.2.1 ``` ### Expected Behavior Device is not going to be created due to permissions. ### Observed Behavior User got error `Operation failed due to object-level permissions violation` but a zombie/broken device got created.
adam added the type: bug label 2025-12-29 21:42:08 +01:00
adam closed this issue 2025-12-29 21:42:08 +01:00
Author
Owner

@jr3001 commented on GitHub (May 27, 2025):

any way to delete the devices without having to edit postgresql and having no clue what do to exactly in it? Like can i say netbox, please ignore that error and delete everything as normal but with ignoring errors?

@jr3001 commented on GitHub (May 27, 2025): any way to delete the devices without having to edit postgresql and having no clue what do to exactly in it? Like can i say netbox, please ignore that error and delete everything as normal but with ignoring errors?
Author
Owner

@arthanson commented on GitHub (May 27, 2025):

@jr3001 I'm not seeing this, but the reproduction steps are a bit unclear - can you please check and update your Steps to Reproduce, detailing exactly what permissions you have enabled (for example to create a device like this you would need perms on Device, Device Role, Device Type and Site) can you please explicitly detail what permission are required to reproduce - I'm not sure what you mean by "Tenant specific rights".

@arthanson commented on GitHub (May 27, 2025): @jr3001 I'm not seeing this, but the reproduction steps are a bit unclear - can you please check and update your Steps to Reproduce, detailing exactly what permissions you have enabled (for example to create a device like this you would need perms on Device, Device Role, Device Type and Site) can you please explicitly detail what permission are required to reproduce - I'm not sure what you mean by "Tenant specific rights".
Author
Owner

@jr3001 commented on GitHub (May 28, 2025):

@jr3001 I'm not seeing this, but the reproduction steps are a bit unclear - can you please check and update your Steps to Reproduce, detailing exactly what permissions you have enabled (for example to create a device like this you would need perms on Device, Device Role, Device Type and Site) can you please explicitly detail what permission are required to reproduce - I'm not sure what you mean by "Tenant specific rights".

you are right, i just updated it. and i noticed that i may be only netbox-branching related. i think i need to move the issue, since i can only reproduce it using a branch, mehhh..........

@jr3001 commented on GitHub (May 28, 2025): > [@jr3001](https://github.com/jr3001) I'm not seeing this, but the reproduction steps are a bit unclear - can you please check and update your Steps to Reproduce, detailing exactly what permissions you have enabled (for example to create a device like this you would need perms on Device, Device Role, Device Type and Site) can you please explicitly detail what permission are required to reproduce - I'm not sure what you mean by "Tenant specific rights". you are right, i just updated it. and i noticed that i may be only netbox-branching related. i think i need to move the issue, since i can only reproduce it using a branch, mehhh..........
Author
Owner

@arthanson commented on GitHub (May 28, 2025):

@jr3001 I'll close this issue for now, if you can get repro steps and it is only with branching then please open it in netbox branching. If the repro steps do not require netbox branching then please re-open it here with repro steps.

@arthanson commented on GitHub (May 28, 2025): @jr3001 I'll close this issue for now, if you can get repro steps and it is only with branching then please open it in netbox branching. If the repro steps do not require netbox branching then please re-open it here with repro steps.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11221