Files
bun-sqlite/package.json
T
tbenandClaude Opus 5.5 66f73c4228 Fix SQL injection, schema-sync data loss, and backup safety
Security:
- select: bind parameters instead of mysql.format (backslash escaping
  allowed injection on SQLite); drop the mysql dependency
- validate all interpolated identifiers, limit/offset/page, order
  strategy, operators, join types and raw equalities (new sql-safe.ts)
- quote identifiers and bind values in schema manager DDL/queries

Data loss:
- schema sync runs with foreign keys off inside a transaction, with
  foreign_key_check before commit (DROP TABLE no longer cascades)
- parentTableName tables: stop mutating the parent schema and copy
  inherited columns on rebuild
- keep column data on type changes (match columns by name)
- backups and schema snapshots use VACUUM INTO (includes WAL data);
  restore closes the DB, clears -wal/-shm, and swaps atomically
- backup listing/trimming only touches <db_name>-<timestamp> files

Correctness:
- update/delete use the generator's WHERE clause instead of a regex
- keep 0/""/false values; booleans stored as 0/1
- IN/NOT IN and BETWEEN arrays, NOT LIKE wrapping, AVG, select aliases
- OFFSET without LIMIT, count ignores pagination
- MATCH emits `field MATCH fn(?)` for sqlite-vec
- sql() returns rows for any row-producing statement
- targetId no longer mutates the caller's query
- init throws instead of process.exit; CLI reports errors

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 02:06:59 +01:00

41 lines
991 B
JSON

{
"name": "@moduletrace/bun-sqlite",
"version": "1.1.13",
"description": "SQLite manager for Bun",
"author": "Benjamin Toby",
"main": "dist/index.js",
"bin": {
"bun-sqlite": "dist/commands/index.js"
},
"scripts": {
"dev": "tsc --watch",
"compile": "rm -rf dist && tsc"
},
"devDependencies": {
"@types/bun": "latest",
"@types/inquirer": "^9.0.9",
"@types/lodash": "^4.17.24",
"@types/node": "^25.3.3"
},
"peerDependencies": {
"typescript": "^5"
},
"files": [
"dist",
"README.md",
"package.json"
],
"repository": {
"type": "git",
"url": "git+https://git.tben.me/Moduletrace/bun-sqlite.git"
},
"dependencies": {
"@inquirer/prompts": "^8.3.0",
"chalk": "^5.6.2",
"commander": "^14.0.3",
"inquirer": "^13.3.2",
"lodash": "^4.17.23",
"sqlite-vec": "^0.1.7-alpha.2"
}
}