Problem
NSE scripts can only be managed through the /nsesview HTML form interface. There are no REST API endpoints for NSE scripts, making programmatic management (upload, update, delete) impossible without scraping HTML and CSRF tokens.
Proposed solution
Add a new NsesApi(BaseApi) class at /api/v1/nses with full CRUD:
| Method |
Path |
Action |
| GET |
/api/v1/nses/ |
list all NSE scripts ({id, name, hash}) |
| POST |
/api/v1/nses/ |
upload a new .nse file (multipart filebody); upserts on name collision |
| GET |
/api/v1/nses/<pk> |
read a single script by ID |
| PUT |
/api/v1/nses/<pk> |
update file content and/or rename in-place |
| DELETE |
/api/v1/nses/<pk> |
delete by ID |
All endpoints use @protect() (JWT or session auth) and @safe.
The PUT endpoint:
- accepts an optional
filebody multipart file and/or an optional name form field (at least one required)
- validates the
.nse extension on upload
- rejects SHA-256 hash collisions with other records
- uses
FileManager to replace the file on disk atomically
Motivation
External automation clients need a stable REST interface to manage deployed NSE scripts without recycling IDs or scraping HTML forms. An in-place PUT avoids the race-condition window between delete and re-create.
Problem
NSE scripts can only be managed through the
/nsesviewHTML form interface. There are no REST API endpoints for NSE scripts, making programmatic management (upload, update, delete) impossible without scraping HTML and CSRF tokens.Proposed solution
Add a new
NsesApi(BaseApi)class at/api/v1/nseswith full CRUD:/api/v1/nses/{id, name, hash})/api/v1/nses/.nsefile (multipartfilebody); upserts on name collision/api/v1/nses/<pk>/api/v1/nses/<pk>/api/v1/nses/<pk>All endpoints use
@protect()(JWT or session auth) and@safe.The
PUTendpoint:filebodymultipart file and/or an optionalnameform field (at least one required).nseextension on uploadFileManagerto replace the file on disk atomicallyMotivation
External automation clients need a stable REST interface to manage deployed NSE scripts without recycling IDs or scraping HTML forms. An in-place
PUTavoids the race-condition window between delete and re-create.