Script run responses include storage backend error text
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Start by reading validation.py around build_error_sanitizer and storage/store.py around _stream_verified, then trace how script_class_context passes load errors to the REST and UI views. Check how the sanitizer handles backend-specific error details while preserving useful administrator logging. Done when script run responses omit storage backend details and the full error remains available in server logs; consider the upload path covered by #77.
Written by the indexing model from the issue text.
Description
Plugin Version
v0.0.1 (also present on main)
NetBox Version
v4.7.4
Python Version
3.12
Steps to Reproduce
- Use the default filesystem storage backend for script source.
- Activate a revision for an upload project so it has a runnable Script.
- Make that revision's stored files unreadable by the NetBox process, and clear the local runtime cache so the run has to read from storage.
- Run the Script through the REST API (
POST /api/plugins/scripts/scripts/<id>/run/), or from its run view in the UI.
Expected Behavior
The response says the Script could not be loaded, without storage backend details. The full error goes to the server log for the administrator.
Observed Behavior
Found by reading the code on main, not by running these steps. The example message below shows the shape the code produces, not captured output.
The load failure is shown to the user by api/views.py:351-358 (REST) and views/scripts.py:198 (UI). It comes from script_class_context, which passes the error through build_error_sanitizer (validation.py:239-261). The sanitizer replaces the storage key, digest, local cache directory and runtime root, but not the storage backend's own root path or other backend text. Reading a stored file wraps the backend exception text (storage/store.py, _stream_verified), so a filesystem read failure still shows something like Permission denied: '/opt/netbox/netbox/media/<scripts root>/<storage>/<digest>/script.py'. Other backends would include their own error text, such as an S3 endpoint URL.
The upload path has the same root cause and is covered by #77. CodeQL reports this one as py/stack-trace-exposure (alert 3).
- Dominant language
- Python
- Stars
- 8
- Forks
- 0
- Avg merge
- 9h 56m
- Merged PRs (30d)
- 29
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
-
Run links keep only the last value of repeated query parametersPossibly taken @pheus claimed this 1 day ago. Openapp: scripts severity: medium status: accepted type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#83 · 1 assignee ·
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
-
Cleanup confirmation treats retained Job history as a blockerPossibly taken @pheus claimed this 1 day ago. Openapp: scripts severity: medium status: accepted type: bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
netbox-community/netbox-scripts#79 · 1 assignee ·
Maintainers usually reply within 1 day
-
Failed REST uploads expose internal error detailsPossibly taken @pheus claimed this 1 day ago. Openapp: scripts severity: medium status: accepted type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netbox-community/netbox-scripts#77 · 1 assignee ·
Maintainers usually reply within 1 day
-
app: scripts severity: low status: backlog type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
netbox-community/netbox-scripts#76 ·
Maintainers usually reply within 1 day
All issues in netbox-community/netbox-scripts
Similar issues
-
bug module:nodes tests
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rocketride-org/rocketride-server#3020 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
bretterer/home-assistant-rivian#335 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mampfes/hacs_waste_collection_schedule#8114 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
TIGER-AI-Lab/ClawBench#475 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
UKGovernmentBEIS/inspect_ai#6322 ·
Maintainers usually reply within 1 day