Permission Inheritance (`--allow-worker` inherits parent permissions)
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
What is the problem this feature will solve?
Today, --allow-worker is an all-or-nothing escape hatch. The docs state this explicitly as a constraint: "The model does not inherit to a worker thread." This means any code running inside a worker can access the filesystem, spawn child processes, and do anything else without restriction, regardless of what the main thread was allowed to do.
This defeats the purpose of the permission model for any application that uses workers, which is most CPU-intensive Node.js applications.
What is the feature you are proposing to solve the problem?
When the main thread creates a Worker, the worker inherits a snapshot of the parent thread's permission state at the time of creation. The worker starts with exactly the same permissions as its parent — no more, no less.
// Main thread: started with --permission --allow-fs-read=/app --allow-worker
const { Worker } = require('node:worker_threads');
const worker = new Worker('./task.js');
// task.js runs with fs.read granted for /app only
// task.js cannot spawn child processes (parent couldn't either)
// task.js cannot read /etc, /home, or anything outside /app
This might be a breaking change. We could then add a --allow-inherit-worker to achieve the same.
What alternatives have you considered?
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando il comportamento attuale di --allow-worker, la documentazione del modello di autorizzazioni e la semantica della creazione di Worker. Definisci e valida come un Worker debba ereditare lo snapshot delle autorizzazioni del processo padre, inclusa la Breaking Change proposta o l’alternativa --allow-inherit-worker; il lavoro è completo quando il comportamento e la scelta di compatibilità sono documentati e coperti da test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, nodejs
- Ambito
- security
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100