Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SQL injection in SQLite PRAGMA statement#98

Open
mapleleaflatte03 wants to merge 3 commits into
mainfrom
sentinel-fix-pragma-sql-injection-3335065020537012677
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SQL injection in SQLite PRAGMA statement#98
mapleleaflatte03 wants to merge 3 commits into
mainfrom
sentinel-fix-pragma-sql-injection-3335065020537012677

Conversation

@mapleleaflatte03
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL

πŸ’‘ Vulnerability: In intelligence/company/meridian_platform/observability_store.py, the MERIDIAN_OBSERVABILITY_SQLITE_JOURNAL_MODE environment variable was used directly in an f-string to construct a PRAGMA journal_mode= SQL statement.

🎯 Impact: Because SQLite PRAGMA statements do not support parameterized queries (?), interpolating unvalidated inputs creates a SQL injection vulnerability. Although sqlite3.Connection.execute() prevents multiple semicolon-separated statements (which limits the blast radius), an attacker who can control environment variables could potentially exploit this injection vector.

πŸ”§ Fix: Implemented a strict allowlist validation check. The configured_journal_mode is now explicitly checked against all safe, valid SQLite journal modes (DELETE, TRUNCATE, PERSIST, MEMORY, WAL, OFF) as well as internal bypass values (DEFAULT, ''). Any unrecognized value is safely overridden with the default WAL.

βœ… Verification:

  1. Run PYTHONPATH=intelligence/company/meridian_platform:intelligence:kernel python3 -m unittest intelligence/company/meridian_platform/test_status_surface.py intelligence/company/meridian_platform/test_alerting.py
  2. Tests pass (any offset-naive datetime exceptions are existing environment artifacts).
  3. The journal logging setup handles invalid environment values cleanly without executing them as SQL.

PR created automatically by Jules for task 3335065020537012677 started by @mapleleaflatte03

Co-authored-by: mapleleaflatte03 <240846662+mapleleaflatte03@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits May 14, 2026 19:10
…and fix acceptance test

Co-authored-by: mapleleaflatte03 <240846662+mapleleaflatte03@users.noreply.github.com>
…and fix acceptance test

Co-authored-by: mapleleaflatte03 <240846662+mapleleaflatte03@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant