Hub rules-sqlite

rules-sqlite

v4 public Verified

Sqlite

SQLite is a lightweight, disk-based database engine. These rules govern efficient embedded database usage and SQL optimization for AI agents.

@sigmashakeinc 4 pulls 18 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-sqlite →
Severity
10 error 8 warn 0 info
demo.cast
SQLite is a lightweight, disk-based database engine. These rules govern efficient embedded database usage and SQL optimization for AI agents.

Rules index

18 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

sqlite

sqlite-block-attach-database-interpolation error block

RISK: ATTACH DATABASE with interpolated paths enables path traversal and lets attackers attach malicious DB files (which can pivot via triggers if trusted_schema=ON). FIX: Allowlist filenames; pass them through bound parameters or hard-code paths.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-better-sqlite3-exec-userinput error block

RISK: better-sqlite3 db.exec(str) runs ALL semicolon-separated statements with no parameter binding — direct injection if str is user-derived. FIX: Use db.prepare(sql).run(params) and split DDL into separate prepared statements.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-c-exec-nonliteral error block

RISK: sqlite3_exec() with a non-literal SQL argument runs every semicolon-separated statement and is the classic C-API injection sink. FIX: Use sqlite3_prepare_v2() + sqlite3_bind_*() and step a single statement at a time.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-fts3-tokenizer-registration error block

RISK: fts3_tokenizer() lets SQL register a function-pointer tokenizer — a known RCE vector (CVE-2019-8457 family) when callable from untrusted SQL. FIX: Avoid the legacy two-arg fts3_tokenizer(); compile with -DSQLITE_ENABLE_FTS3_TOKENIZER off and use FTS5.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-load-extension error block

RISK: Loadable SQLite extensions allow arbitrary native code execution via .so/.dll (CVE-2019-8457 class). FIX: Keep sqlite3_enable_load_extension(db, 0); never call load_extension() on untrusted input.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-pragma-key-literal error block

RISK: SQLCipher PRAGMA key='...' embeds the encryption key in source/SQL logs/traces. FIX: Use sqlite3_key_v2() C API or your binding's keyed-open with secrets pulled from a secret manager.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-python-executescript-userinput error block

RISK: cursor.executescript() runs multiple semicolon-separated statements with implicit commit — a direct SQL-injection sink (PEP 249). FIX: Call execute() per statement with bound ? parameters.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-string-concatenation-sql error block

RISK: String-built SQL is the #1 SQLite injection vector. FIX: Use parameter placeholders (? or :name) and bind values; never concatenate user input into SQL.

Rule source requires an active Pro or Enterprise subscription.
sqlite-block-uri-open-userinput error block

RISK: Opening with uri=True and a user-controlled file: URI lets the caller select VFS, enable mode=memory, swap journal files, etc. FIX: Disable URI mode or strictly validate the path and strip query parameters.

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-check-same-thread-false warning ask

RISK: check_same_thread=False without an explicit mutex causes race conditions and DB corruption — Python's sqlite3 connections are not thread-safe. FIX: Use one connection per thread, or wrap the connection in a Lock.

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-foreign-keys-off warning log

RISK: foreign_keys=OFF lets orphaned rows accumulate, breaking referential integrity assumptions in app code. FIX: Set PRAGMA foreign_keys=ON on every new connection (it is per-connection, not persistent).

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-old-better-sqlite3-version warning log

RISK: better-sqlite3 < 11.10 bundles SQLite older than 3.50.2, which is vulnerable to CVE-2025-6965 / CVE-2025-29087 (integer overflows leading to memory corruption). FIX: Bump to better-sqlite3 ≥ 11.10.0 (SQLite 3.50.2+).

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-pragma-cell-size-check-off warning log

RISK: cell_size_check=OFF disables a defensive integrity check that mitigates malformed-DB exploits. FIX: Leave the default ON, especially when opening DB files from untrusted sources.

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-pragma-durability-off warning ask

RISK: journal_mode=OFF / synchronous=OFF disables crash recovery — a single power loss corrupts the database. FIX: Use WAL + synchronous=NORMAL in production; only disable in throwaway test fixtures.

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-public-db-path warning log

RISK: Placing a .db/.sqlite file in a web-served directory exposes the entire database for download. FIX: Store DB files outside the web root (e.g. /var/lib/app).

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-shared-cache-deprecated warning log

RISK: Shared-cache mode is officially discouraged by SQLite (concurrency/corruption pitfalls, see sqlite.org/sharedcache.html). FIX: Use WAL journal mode for concurrent readers/writers instead.

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-trusted-schema warning log

RISK: trusted_schema=ON lets malicious triggers/views/virtual-tables in attached DBs invoke unsafe functions. FIX: Keep PRAGMA trusted_schema=OFF (the default since 3.31).

Rule source requires an active Pro or Enterprise subscription.
sqlite-warn-writable-schema error block

RISK: PRAGMA writable_schema=ON allows arbitrary modification of sqlite_master enabling persisted RCE via crafted triggers. FIX: Remove the PRAGMA; use ALTER TABLE / migrations instead.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v4
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
840b5b5a4cb7b68a120b6ba1775ec2dd4035a8a082e49069c68ef484c4977e65
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-sqlite/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-sqlite. The published version only bumps when a maintainer resyncs.

No commit history available.