🛡️ Sentinel: [CRITICAL] Fix SQL injection risk in dynamic kwargs#53
Draft
davidjuarezdev wants to merge 1 commit intomainfrom
Draft
🛡️ Sentinel: [CRITICAL] Fix SQL injection risk in dynamic kwargs#53davidjuarezdev wants to merge 1 commit intomainfrom
davidjuarezdev wants to merge 1 commit intomainfrom
Conversation
Replaces assert with explicit ValueError key validation to prevent SQL injection in streamrip/db.py when kwargs are unpacked into dynamic SQL queries. Asserts can be optimized away. Co-authored-by: davidjuarezdev <230496599+davidjuarezdev@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚨 Severity: CRITICAL
💡 Vulnerability: The
containsandremovedatabase methods accept**kwargsthat unpack directly into SQL condition strings. The validation of these columns was previously done with anassert. If a user runs streamrip using the python optimize flag (-O), assertions are stripped, allowing arbitrary column names to be unpacked into dynamic SQL queries, completely bypassing the validation.🎯 Impact: Exploitation could allow an attacker to inject arbitrary SQL statements into the database query engine.
🔧 Fix: Removed
assertvalidation and replaced it with an explicitValueErrorthat cannot be ignored by the interpreter. Also added the missing dictionary key validation to theremovemethod.✅ Verification: Ran the test suite via
poetry run pytest teststo ensure no legitimate internal database query mechanisms break from the stricter validation checking.Includes a journal entry to
.jules/sentinel.mddocumenting the learnings of this vulnerability constraint.PR created automatically by Jules for task 1275855855781349914 started by @davidjuarezdev