plugins/sql: remove size limit.
What changed, and why it matters
This commit removes a 500 megabyte cap on the SQL plugin's internal SQLite database. Previously, the code artificially limited how large the database file could grow. Now it lets SQLite use its own default limits, which are effectively unlimited. The stated reason is to support larger nodes with bigger databases, not to fix a security bug. There is no direct evidence this change introduces a vulnerability, but removing any resource limit can theoretically make it easier for a bug or abuse to consume more disk space than before.
Treat as a routine scalability change. Review whether the SQL plugin has other safeguards against unbounded database growth or denial-of-service via large queries, since the explicit size ceiling is gone. No immediate security response is indicated by the available evidence.
Security signals we found
Removal of an explicit resource limit (database size cap)
Change is described by the author as a scalability/preparation fix, not a security fix
No references to CVEs, advisories, or security reports in commit or supplied materials
Evidence from the diff
The patch deletes the static max_dbmem variable (500,000,000 bytes) and the associated PRAGMA max_page_count setting that constrained SQLite to roughly that size using 4 KiB pages. The plugin now relies on SQLite defaults for maximum page count. The commit message frames this as a scalability improvement driven by upcoming tests that will exceed the limit. No input validation, query behavior, or access controls are changed.
Changed components
plugins/sql.cCore Lightning SQL pluginSQLite database size configurationInspect captured patch +0 / −8
diff --git a/plugins/sql.c b/plugins/sql.c
index 17c63faf..f116f7e1 100644
--- a/plugins/sql.c
+++ b/plugins/sql.c
@@ -133,7 +133,6 @@ struct table_desc {
struct list_head refresh_waiters;
};
static STRMAP(struct table_desc *) tablemap;
-static size_t max_dbmem = 500000000;
static struct sqlite3 *db;
static char *dbfilename;
static int gosstore_fd = -1;
@@ -252,13 +251,6 @@ static struct sqlite3 *sqlite_setup(struct plugin *plugin)
sqlite3_limit(db, SQLITE_LIMIT_TRIGGER_DEPTH, 1);
sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, 1);
- /* Default is now 4k pages, so allow 500MB */
- err = sqlite3_exec(db, tal_fmt(tmpctx, "PRAGMA max_page_count = %zu;",
- max_dbmem / 4096),
- NULL, NULL, &errmsg);
- if (err != SQLITE_OK)
- plugin_err(plugin, "Could not set max_page_count: %s", errmsg);
-
err = sqlite3_exec(db, "PRAGMA foreign_keys = ON;", NULL, NULL, &errmsg);
if (err != SQLITE_OK)
plugin_err(plugin, "Could not set foreign_keys: %s", errmsg);
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.