fix(database): extend shillelagh URI pattern to cover all driver variants#39995
Conversation
…ants Replace two separate shillelagh regexes with a single pattern that blocks shillelagh regardless of the driver suffix, preventing URI variants like shillelagh+csv or shillelagh+json from bypassing the blocklist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code Review Agent Run #b8d2bbActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #39995 +/- ##
=======================================
Coverage 63.83% 63.83%
=======================================
Files 2589 2589
Lines 137821 137821
Branches 31928 31928
=======================================
Hits 87978 87978
Misses 48327 48327
Partials 1516 1516
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ants (apache#39995) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
SUMMARY
The shillelagh URI blocklist in
analytics_db_safety.pyused two separate patterns (shillelagh$andshillelagh\+apsw$) that only matched the bare driver and one specific variant. Other driver suffixes such as+csv,+json, and+gsheetswere not matched, allowing those URIs to bypass the blocklist check.This PR replaces both patterns with a single regex
shillelagh(?:\+[^\s]*)?$that blocksshillelaghregardless of the driver suffix, consistent with how the existingsqlitepattern already handles all its variants viasqlite(?:\+[^\s]*)?$.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend-only change.
TESTING INSTRUCTIONS
Run the updated integration test:
All 15 test cases should pass, including the new
shillelagh+csv,shillelagh+json, andshillelagh+gsheetsvariants.Attempt to create a database connection with
sqlalchemy_uri: shillelagh+csv:///etc/passwdvia the API — should return a 422 error, not 201.ADDITIONAL INFORMATION