Skip to content

🛡️ Sentinel: [CRITICAL] Fix SQL injection risk via assertion bypass#51

Draft
davidjuarezdev wants to merge 1 commit intomainfrom
sentinel-fix-sql-injection-risk-11038255197215758585
Draft

🛡️ Sentinel: [CRITICAL] Fix SQL injection risk via assertion bypass#51
davidjuarezdev wants to merge 1 commit intomainfrom
sentinel-fix-sql-injection-risk-11038255197215758585

Conversation

@davidjuarezdev
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
💡 Vulnerability: The streamrip/db.py module relied on Python's assert statement to validate keyword argument keys against expected columns before unpacking them into dynamically constructed SQL queries in the contains() method, and lacked validation entirely in the remove() method. Since assert statements are stripped when Python is run with optimizations (-O), an attacker could supply malicious keyword argument keys (which bypass Python's strict identifier restrictions) leading to SQL injection.
🎯 Impact: Potential for arbitrary code execution or data exposure via SQL injection if the application is run in optimized mode and processing untrusted input.
🔧 Fix: Replaced the assert statement with an explicit if statement raising ValueError in contains(), and added the same explicit key validation to remove().
✅ Verification: Ran ruff check and pytest to ensure no regressions. Added a Sentinel journal entry documenting the learning.


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

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