-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Deployment Type
NetBox Cloud
NetBox Version
v4.2.4
Python Version
3.12
Steps to Reproduce
Create two Sites and attempt to create a Virtual Machine scoped to conflicting Sites for fields site and cluster.
- Create 2 Sites: "My Site" and "Your Site"
- Create a Cluster Role: "My Role"
- Create a Cluster ("My Cluster") and assign it to "My Site"
- Create a Virtual Machine and assign it to "Your Site" and use the advanced object selector for the Cluster input to assign it to "My Cluster"
Expected Behavior
User should be unable to assign "My Cluster" because the Cluster is scoped to "My Site" and the Virtual Machine is scoped to "Your Site".
The query_params defined on the Virtual Machine's cluster input should prevent this:
netbox/netbox/virtualization/forms/model_forms.py
Lines 187 to 189 in beb0aff
| query_params={ | |
| 'site_id': ['$site', 'null'] | |
| }, |
Observed Behavior
While the cluster input itself does filter out the "My Cluster" option, selecting the Advanced Object Selector allows the selection of "My Cluster". Attempting to create the Virtual Machine scoped to the "My Cluster" Cluster returns an error:
The scope of this issue is currently limited to form inputs that utilize both the selector=True and query_params={...} attributes. But with the acceptance of issues #18138 and #17944 this could be impactful to user-defined scripts and custom fields.
