🛡️ Sentinel: [CRITICAL] Fix SQL injection risk in database wrapper#61
Draft
davidjuarezdev wants to merge 1 commit intomainfrom
Draft
🛡️ Sentinel: [CRITICAL] Fix SQL injection risk in database wrapper#61davidjuarezdev wants to merge 1 commit intomainfrom
davidjuarezdev wants to merge 1 commit intomainfrom
Conversation
- 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>
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: SQL injection via
**kwargsused in dynamic SQL queries. Thecontains()method usedassert(which can be optimized away in production) for key validation, andremove()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
assertwith explicitraise ValueErrorfor key validation incontains(), and added identical explicit key validation toremove(). Documented learnings in.jules/sentinel.md.✅ Verification: Ran full test suite using
PYTHONPATH=. pytest testsand verified changes tostreamrip/db.pyvia git diff. No regressions were found.PR created automatically by Jules for task 8876014041990717640 started by @davidjuarezdev