Skip to content

🛡️ Sentinel: [CRITICAL] Fix SQL injection risk in database wrapper#61

Draft
davidjuarezdev wants to merge 1 commit intomainfrom
sentinel-db-sql-injection-fix-8876014041990717640
Draft

🛡️ Sentinel: [CRITICAL] Fix SQL injection risk in database wrapper#61
davidjuarezdev wants to merge 1 commit intomainfrom
sentinel-db-sql-injection-fix-8876014041990717640

Conversation

@davidjuarezdev
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
💡 Vulnerability: SQL injection via **kwargs used in dynamic SQL queries. The contains() method used assert (which can be optimized away in production) for key validation, and remove() completely lacked validation against arbitrary dictionary keys.
🎯 Impact: Arbitrary SQL execution if assertions are disabled or malicious keys are passed to remove(), potentially allowing unauthorized database modification or data extraction.
🔧 Fix: Replaced assert with explicit raise ValueError for key validation in contains(), and added identical explicit key validation to remove(). Documented learnings in .jules/sentinel.md.
✅ Verification: Ran full test suite using PYTHONPATH=. pytest tests and verified changes to streamrip/db.py via git diff. No regressions were found.


PR created automatically by Jules for task 8876014041990717640 started by @davidjuarezdev

- Replaced `assert` with `raise ValueError` in `contains()` to prevent bypassing validation when optimizations are enabled.
- Added missing key validation to `remove()` method before embedding `**kwargs` keys directly into SQL formatting.
- Created Sentinel security learning journal entry.

Co-authored-by: davidjuarezdev <230496599+davidjuarezdev@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