-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
netboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Milestone
Description
NetBox Edition
NetBox Community
NetBox Version
v4.4.1
Python Version
3.12
Steps to Reproduce
This is a follow-up to #15587.
When permission constraints are used to restrict users ability to run specific scripts, it works as intended in the GUI, but API requests allow running all scripts, ignoring the constraint.
- Create two custom scripts, called "safe" and "dangerous"
- Create three permissions:
readonlycan view all objectsread safe scriptscan viewCore | managed filewith constraints{"data_path": "scripts/safe_script.py"}run safe scriptscan view and runExtras > Scriptwith constraints{"name": "SafeScript"}
- Create a user called Alice with those permissions
- Create an API token for Alice
- Run the dangerous script by API.
curl -H "Content-Type: application/json" http://localhost:8000/api/extras/scripts/2/ --data '{"data": {}, "commit": true}' -H "Authorization: Token $ALICE_TOKEN"
Expected Behavior
When Alice makes an API request to run the "dangerous script" it should fail.
Observed Behavior
Alice can run both scripts by API.
In the GUI, she can run the safe script, but when she tries to run the dangerous script, the run button is disabled.
Metadata
Metadata
Assignees
Labels
netboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application