Opt in
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 3.8k
- Fork
- 279
- Merge medio
- 1h 47m
- PR unite (30g)
- 2
Descrizione
Hi 👋 I happened on this just meandering around the Node GH. I think this would be an excellent thing to provide with Node, but I’m concerned about some of what’s proposed.
Background
Based on my reading of README/issues clarifying progress, the current behavior is:
- Install corepack
- Use Yarn/PNPM commands as if the package manager is already installed in
$PATH - If it’s not, corepath silently installs and executes it with the command entered
My understanding is that this will be be bundled with Node, eliminating step 1. While convenient, that makes the following steps troubling.
Risks
Users are executing code they didn’t take any affirmative steps to install. This is a clear security issue, but it’s (subtly) more too.
In terms of security risk, it’s similar to npx prior to NPM 7:
- It obfuscates what action the user is actually performing
- It executes network-delivered code without auditability
- It puts the user at the mercy of security decisions made by others
- Network delivered code can be poisoned in a variety of ways, including network API vulnerabilities, hijacked domains, malicious detection of
curl … | …
The subtly more bit: false negatives. Users or orgs might have a policy of aliasing these package manager commands to harden or restrict them for their own usage. If an environment isn’t properly provisioned, this would undo those restrictions rather than failing as expected.
Solutions/prior art
NPM 7, thankfully, introduces a prompt when using npx to ask if the user wants to download and execute commands that aren’t already available on $PATH. This isn’t a panacea, but it’s a meaningful improvement over silently downloading and executing third party code.
The same technique could be used here. The downside is it’s a minor inconvenience, but the risks it would help to alleviate are huge.
Considerations
- Automations aren’t interactive, and may expect to be able to bypass this
- Meaningful thought should be put into mitigation of risk around that
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
L'issue rimanda al README e alle issue correlate sul comportamento attuale di Corepack; inizia da lì e verifica come i comandi del gestore di pacchetti gestiscono gli strumenti mancanti in PATH. Definisci un comportamento opt-in o basato su prompt che tenga conto dell'automazione non interattiva, quindi verificalo rispetto alle problematiche di sicurezza e di PATH descritte qui.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- nodejs, typescript
- Ambito
- cli, security
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100