node:sqlite: backup() unwraps any object as a DatabaseSync, and a duck-typed URL aborts the process
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit den node:sqlite-Implementierungen von backup() und dem DatabaseSync-Konstruktor und reproduziere anschließend beide Beispiele aus dem Issue. Die Arbeit ist abgeschlossen, wenn ungültige backup-Argumente und fehlerhafte URL-ähnliche Objekte TypeError auslösen, statt einen segfault zu verursachen, mit Regressionstests für beide Fälle.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js, sqlite
- Bereich
- databases
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 68/100