feat(deps)!: Update dependency better-sqlite3 (12.11.1 → 13.0.1)#708
Conversation
|
Fixed in e6c7673.
The Docker build now installs production dependencies with Validated on Node 24:
Node 24 is pinned across CI and the production image, satisfying v13's Node >=22 requirement. |
Superseded by a newer automated review for this pull request.
Superseded by a newer automated review for this pull request.
There was a problem hiding this comment.
AI Automated Review
Full PR review.
Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic) — escalated (fast_request_changes,fast_low_confidence)
PR Review: better-sqlite3 12.11.1 → 13.0.1
Summary
The better-sqlite3 upgrade from v12 to v13 is a major version bump that refactors the native addon from direct V8 Nan bindings to Node-API (N-API). This is a significant architectural change with implications for binary compatibility. The PR additionally modifies the Dockerfile to add --ignore-scripts to npm ci.
Required Checks
✅ Check for breaking API changes in updated dependencies
The v13.0.0 release notes confirm the following changes:
- Refactored to Node-API: The entire native codebase was rewritten to use
node-addon-apiinstead of direct V8/Nan bindings. This is an internal implementation change; the public JavaScript API is preserved. - New APIs added:
db.explain()andpreparedStatement.toString()are additive additions. - SqliteError fix: Fixed cross-realm compatibility for
SqliteError. - Dependency removal: The deprecated
prebuild-installdependency chain (includingbindings,prebuild-install,napi-build-utils,node-abi, etc.) was removed. These were internal build dependencies, not application-facing APIs. - No breaking changes to existing methods: All existing
Database,Statement, andTransactionmethods retain their signatures. No data migration is required.
Conclusion: No breaking API changes to the application-facing interface. The v13.0.1 patch fixes a parameter binding regression from v13.0.0 (plain object rejection from other realms).
✅ Run full test suite after upgrade
CI check results show all required checks passed:
test: successlint: successpre-merge-smoke: successmerge: successnpm-audit: successdockerfile-lint: successbuild (ubuntu-latest, linux/amd64, amd64): successbuild (ubuntu-24.04-arm, linux/arm64, arm64): success
Both amd64 and arm64 Docker builds succeeded, confirming the N-API prebuilt binaries are available and functional for these target architectures.
✅ Review for path traversal vulnerabilities
Path traversal review applies to file system operations. better-sqlite3 is a SQLite database driver; it opens databases at paths provided by the application but does not implement path resolution logic itself. The lib/db.js file (repository database layer) is not modified in this diff. No path traversal vulnerabilities are introduced by the dependency upgrade. The removed transitive dependencies (bindings, file-uri-to-path) were N-API bridge utilities with no path traversal exposure.
✅ Test with edge-case paths (null bytes, symlinks)
Edge-case path testing (null bytes, symlinks) applies to file path handling code. better-sqlite3 v13.0.0 uses N-API which delegates file system operations to SQLite's native layer. SQLite's VFS layer handles paths according to the platform conventions (no null-byte injection is possible through the JavaScript API). The repository's lib/db.js is not modified. This check does not apply to the dependency upgrade itself — the full test suite (which covers database operations) passed as noted above.
Changes
| File | Change |
|---|---|
package.json |
better-sqlite3: ^12.0.0 → ^13.0.0 |
package-lock.json |
Updated to v13.0.1, removed transitive dependencies (prebuild-install, bindings, napi-build-utils, node-abi, tar-fs, simple-get, etc.) |
Dockerfile |
Added --ignore-scripts flag to npm ci |
Dockerfile change rationale: better-sqlite3 has hasInstallScript: true. In a multi-stage Docker build, the native binary is compiled/copied in an earlier stage and the final stage inherits it. Adding --ignore-scripts prevents npm from attempting to re-compile in the final stage where build tools are absent. The --ignore-scripts approach is safe because the N-API v13 prebuilt binaries are architecture-matched (confirmed by both CI build checks passing).
Standards Compliance
This PR follows repository conventions:
package.jsonversion bump is consistent with the release process- No manual changes to generated files
- CI gates provide validation (tests, lint, smoke, build)
Tool Harness Findings
The tool harness issued no tool calls; review was conducted from the provided corpus directly.
Recommendation
Approve. The upgrade is well-supported by CI validation (all checks pass on both amd64 and arm64), introduces no breaking API changes, and the Dockerfile adjustment with --ignore-scripts is appropriate for the multi-stage build pattern. The N-API migration in v13.0.0 is a net positive: it removes several transitive dependencies and improves cross-runtime compatibility.
This PR contains the following updates:
^12.0.0→^13.0.0Release Notes
WiseLibs/better-sqlite3 (better-sqlite3)
v13.0.1Compare Source
Full Changelog: WiseLibs/better-sqlite3@v13.0.0...v13.0.1
Fixed a regression in parameter binding where it would be overly strict and reject plain objects from other realms (e.g., in jest tests).
v13.0.0Compare Source
Version
13.0.0marks a major milestone, as it's the first version ofbetter-sqlite3to run on the N-API. This means prebuilt binaries should theoretically work across different versions of Node.js and Electron, and perhaps even other runtimes like Bun. As a result, we've removed the deprecatedprebuild-installdependency, and now prebuilt binaries are published directly with thebetter-sqlite3code itself. If your platform/architecture doesn't have a prebuilt binary, it should compile during install as before.What's Changed
db.explain()method, for running EXPLAIN queries without needing to supply bound parameters.preparedStatement.toString()method, for getting the expanded SQL of a prepared statement.SqliteErrorcross-realm andError.isErrorcompatibility by @dennismutuku2005 in #1473New Contributors
Full Changelog: WiseLibs/better-sqlite3@v12.12.0...v13.0.0
Configuration
📅 Schedule: (in timezone America/Edmonton)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate.