Skip to content

🛡️ Sentinel: [HIGH] Fix SQL injection in SQLite PRAGMA configuration - #278

Open
mapleleaflatte03 wants to merge 1 commit into
mainfrom
sentinel-fix-sqlite-pragma-injection-9149440834022562291
Open

🛡️ Sentinel: [HIGH] Fix SQL injection in SQLite PRAGMA configuration#278
mapleleaflatte03 wants to merge 1 commit into
mainfrom
sentinel-fix-sqlite-pragma-injection-9149440834022562291

Conversation

@mapleleaflatte03

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH

💡 Vulnerability: A SQL injection vulnerability (specifically configuration/PRAGMA injection) existed in observability_store.py where the PRAGMA journal_mode value was directly interpolated from the MERIDIAN_OBSERVABILITY_SQLITE_JOURNAL_MODE environment variable without strict validation. SQLite PRAGMA statements do not support parameterized queries.

🎯 Impact: An attacker or malicious user who can control this environment variable could potentially inject arbitrary SQL commands (e.g., WAL; DROP TABLE audit_events;), leading to data loss, unauthorized data manipulation, or denial of service within the observability database.

🔧 Fix: Implemented an explicit allowlist {'DELETE', 'TRUNCATE', 'PERSIST', 'MEMORY', 'WAL', 'OFF', '', 'DEFAULT'} for the configured_journal_mode. If the environment variable provides a value not in this allowlist, it safely falls back to 'WAL'.

✅ Verification:

  • Ran PYTHONPATH=intelligence/company/meridian_platform python3 -m unittest discover -s intelligence/company/meridian_platform -p "test_*.py" to ensure the backend starts correctly and no new regressions were introduced (existing failures were preserved).
  • Confirmed that invalid environment variable values (like 'WAL; DROP TABLE') now correctly fall back to 'WAL' instead of throwing a syntax error or executing the malicious payload.
  • Added a journal entry in .jules/sentinel.md documenting this codebase-specific PRAGMA injection pattern.

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

…ration

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.

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