FileVar uploads collide with REST run parameters

Chiusa
#73 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@pheus ci sta già lavorando.

Dal 3/11/2026.

  • #105 di @pheus — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Start at the REST run endpoint's multipart request handling and trace how uploaded file parts are separated from execution parameters. The report reproduces collisions for FileVar names commit and data; use its documented multipart requests to check both cases. Done means the endpoint accepts those uploads as variables, keeps run settings separate, and returns HTTP 201 with the file available to the Script.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

app: scripts severity: medium status: accepted type: bug
Plugin Version

v0.0.1

NetBox Version

v4.7.3

Python Version

3.12

Steps to Reproduce
  1. Create a Script Project for uploaded files, upload the following Script, and activate its revision:
    from netbox_scripts.scripts import FileVar, Script
    
    
    class TakesNamedFile(Script):
        commit = FileVar(label='Named file')
    
        def run(self, data, commit):
            return data['commit'].read().decode()
    
  2. Create a small notes.txt file and request a run using the documented multipart format. Replace <id> with the Script's ID:
    printf 'hello\n' > notes.txt
    
    curl -i -sS -X POST \
      -H "Authorization: Token $NETBOX_TOKEN" \
      -F 'data={}' \
      -F [email protected] \
      'https://netbox.example.com/api/plugins/netbox-scripts/scripts/<id>/run/'
    
Expected Behavior

The request returns HTTP 201 and queues the Script with the uploaded file in data['commit']. The file variable is kept separate from the run's commit setting.

The REST execution guide documents file parts named after their variables and separates variable values from execution parameters.

Observed Behavior

The request returns HTTP 400:

{"commit": ["Must be a valid boolean."]}

A FileVar named data, sent alongside the JSON data part, similarly returns:

{"data": ["Value must be valid JSON."]}

The endpoint reads the uploaded file as the top-level run parameter with the same name.

This affects request handling and is separate from the OpenAPI schema change in #16.

Lingua principale
Python
Stelle
8
Fork
0
Merge medio
9h 34m
PR unite (30g)
32

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di netbox-community/netbox-scripts

Tutte le issue di netbox-community/netbox-scripts

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.