Script object variables display and accept objects the user cannot view
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- authentication, backend-api-design
Research direction
Start by tracing the UI and REST run paths that render and validate Script forms, then inspect how ObjectVar and MultiObjectVar resolve submitted IDs. Check where NetBox's restrict_form_fields() helper is applied and how object-level view permissions affect its queryset. Done means inaccessible objects are neither shown as selected values nor accepted on submission, including REST requests.
Written by the indexing model from the issue text.
Description
Plugin Version
v0.0.1
NetBox Version
v4.7.4
Python Version
3.12
Steps to Reproduce
- As an administrator, upload and activate this Script:
from ipam.models import Prefix from netbox_scripts import ObjectVar, Script class InspectPrefix(Script): prefix = ObjectVar(model=Prefix) def run(self, data, commit): self.log_info(str(data['prefix']), obj=data['prefix']) - Create a prefix, such as
10.0.0.0/24, and note its ID. - Sign in as a non-superuser with
runpermission on the Script and no view permission for prefixes, either directly or through a group. - Open
/plugins/netbox-scripts/scripts/<script-id>/run/?prefix=<prefix-id>. - Submit the form.
Expected Behavior
ObjectVar and MultiObjectVar display and accept only objects the requesting user can view, including any object-level permission constraints.
The prefix is not displayed as a selected value. Submitting its ID through the UI or REST API returns an invalid-choice error without creating a Job.
Observed Behavior
The Run page displays 10.0.0.0/24 as the selected prefix. Submitting the form creates a Job with that Prefix object in data, despite the user's lack of view permission.
Dropdown searches and the advanced selector respect view permissions, but prefilled and submitted IDs are resolved against an unrestricted queryset. MultiObjectVar and REST submissions are affected too.
The UI and REST run paths do not apply NetBox's restrict_form_fields() helper before rendering or validating the form. The label is exposed before the Script runs, so permission checks inside run() cannot prevent it.
- Dominant language
- Python
- Stars
- 8
- Forks
- 0
- Avg merge
- 11h 23m
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from netbox-community/netbox-scripts
-
app: scripts severity: low status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
netbox-community/netbox-scripts#94 ·
Maintainers usually reply within 1 day
-
app: scripts severity: medium status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#83 ·
Maintainers usually reply within 1 day
-
app: scripts status: backlog type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
netbox-community/netbox-scripts#80 ·
Maintainers usually reply within 1 day
-
app: scripts severity: medium status: backlog type: bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
netbox-community/netbox-scripts#79 ·
Maintainers usually reply within 1 day
-
app: scripts severity: medium status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#77 ·
Maintainers usually reply within 1 day
All issues in netbox-community/netbox-scripts
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Documentation#2838 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
awslabs/route53-dynamic-dns-with-lambda#67 · 1 comment ·
-
`SubAgents` returns a child run's `DeferredToolRequests` to the parent as a successful tool resultOpenbug pkg:harness
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pydantic/pydantic-ai#12405 ·
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 82/100