AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 47 Bitcoin

db: add STRICT tables with migration for old databases

Public commit record

What the developer wrote

Authored by wqxoxo

98/100 · Strong
db: add STRICT tables with migration for old databases

Enables STRICT tables in developer mode, but old databases (~2019) may
have BLOB values in TEXT columns. Migration converts BLOB faildetail
to TEXT with UTF-8 validation, NULLs invalid data.

STRICT is only applied to fresh databases; existing databases being
upgraded skip STRICT to avoid type affinity issues with legacy data.

Also adds security pragmas in developer mode: trusted_schema=OFF,
cell_size_check=ON.

Fixes #5390.

Changelog-Added: Database: STRICT tables and security pragmas in developer mode
Changelog-Fixed: Database migration for old BLOB-typed faildetail values
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit hardens Core Lightning's SQLite database handling in developer mode by adding STRICT table enforcement and two security-related SQLite pragmas. It also adds a migration that cleans up old database entries where a text column accidentally stored binary data, converting them to text or wiping them if they aren't valid text. The changes are defensive: they reduce the chance of unexpected data types causing bugs or security issues, but they do not by themselves fix a known exploitable vulnerability.

Recommended action

Review and merge if the project treats developer-mode hardening as valuable. Ensure the migration is idempotent and that the UTF-8 validation does not discard data operators might need. Consider whether trusted_schema=OFF and cell_size_check=ON should also be enabled in production builds after testing, since currently they are developer-mode only.

Security signals we found

01

Adds STRICT table enforcement for new SQLite tables in developer mode

02

Enables SQLite security pragmas trusted_schema=OFF and cell_size_check=ON in developer mode

03

Adds migration to sanitize legacy BLOB data in a TEXT-typed column with UTF-8 validation

04

Disables STRICT during migrations to avoid breaking upgrades with legacy type-affinity data

05

References issue #5390 as fixed

Risk score

Why this scored 47/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 6/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.