From fd7b33e763e7dbad850573b20ad1dd5287acfa3c Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Mon, 27 Oct 2025 15:01:16 +0100 Subject: [PATCH] sqlite: allow setting defensive flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/60217 Reviewed-By: Colin Ihrig Reviewed-By: Antoine du Hamel Reviewed-By: Ulises Gascón --- doc/api/sqlite.md | 22 ++++++++++++ src/env_properties.h | 1 + src/node_sqlite.cc | 45 +++++++++++++++++++++++ src/node_sqlite.h | 6 ++++ test/parallel/test-sqlite-config.js | 56 +++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+) create mode 100644 test/parallel/test-sqlite-config.js diff --git a/doc/api/sqlite.md b/doc/api/sqlite.md index bb77b77f5b..bde7bcd8eb 100644 --- a/doc/api/sqlite.md +++ b/doc/api/sqlite.md @@ -98,6 +98,10 @@ exposed by this class execute synchronously. + +* `active` {boolean} Whether to set the defensive flag. + +Enables or disables the defensive flag. When the defensive flag is active, +language features that allow ordinary SQL to deliberately corrupt the database file are disabled. +See [`SQLITE_DBCONFIG_DEFENSIVE`][] in the SQLite documentation for details. + ### `database.location([dbName])`