Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2024-05-24 - Fix SQL injection in SQLite PRAGMA configuration
**Vulnerability:** SQLite `PRAGMA` statements configured via unvalidated string concatenation (e.g., `conn.execute(f"PRAGMA journal_mode={mode}")`) allow SQL injection because `PRAGMA` queries do not support parameterized placeholders (`?`).
**Learning:** Environment variables or other input sources used directly in PRAGMA queries bypass the normal SQL parameterization protections.
**Prevention:** Strictly allowlist or validate all values dynamically passed into `PRAGMA` commands.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def _connect(db_path: str) -> sqlite3.Connection:
configured_journal_mode = (
os.environ.get('MERIDIAN_OBSERVABILITY_SQLITE_JOURNAL_MODE', 'WAL') or 'WAL'
).strip().upper()
if configured_journal_mode not in {'DELETE', 'TRUNCATE', 'PERSIST', 'MEMORY', 'WAL', 'OFF'}:
configured_journal_mode = 'WAL'
if configured_journal_mode not in {'', 'DEFAULT', 'OFF'}:
needs_init = configured_journal_mode != 'WAL' or db_path not in _JOURNAL_MODE_INITIALIZED
if needs_init:
Expand Down
Loading