node:sqlite: backup() unwraps any object as a DatabaseSync, and a duck-typed URL aborts the process
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
Version
v27.0.0-pre (884f9cd62da)
Platform
Darwin 25.6.0 arm64
Subsystem
sqlite
What steps will reproduce the bug?
node:sqlite's backup() checks that its first argument is an object, then unwraps it. Passing anything other than a DatabaseSync results in a crash:
const { backup } = require('node:sqlite');
backup({}, '/tmp/c1a.db');
Similarly, the DatabaseSync constructor treats any object as a URL if it has a string href. If that href doesn't parse, it crashes:
const { DatabaseSync } = require('node:sqlite');
new DatabaseSync({ href: 'zzz' });
How often does it reproduce? Is there a required condition?
It's consistent.
What is the expected behavior? Why is that the expected behavior?
Both should raise a TypeError.
What do you see instead?
A segfault.
Additional information
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 con le implementazioni di node:sqlite di backup() e il costruttore di DatabaseSync, quindi riproduci entrambi gli esempi dell’issue. Il lavoro è completato quando gli argomenti backup non validi e gli oggetti simili a URL malformati generano TypeError invece di causare un segfault, con copertura di regressione per entrambi i casi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js, sqlite
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100