🔒 Fix SQL injection vulnerability in DuckDB read_parquet queries - #44
🔒 Fix SQL injection vulnerability in DuckDB read_parquet queries#44devdudumuniz wants to merge 1 commit into
read_parquet queries#44Conversation
Replaced direct string interpolation of file paths with DuckDB's parameterized queries (`?`) in both the schema checking logic (`get_columns`) and the main query execution block within `pysus/api/client.py`. This securely handles lists of paths directly through DuckDB's parameter binding, eliminating the risk of SQL injection while preserving `sql` parameter modification functionality.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: The string formatting in the
read_parquetmethod withinpysus/api/client.pyallowed an SQL injection vulnerability where crafted filenames (e.g.,evil'; SELECT 'injected' as a; --.parquet) could execute arbitrary SQL statements against DuckDB.read_parquet()could exploit this vulnerability to execute arbitrary data-read or modification actions within DuckDB, depending on the current environment's permissions and available tables.🛡️ Solution: The queries have been refactored to use standard SQL parameterization (
?). DuckDB'sread_parquetfunction securely accepts a string list array argument as a bound parameter. This securely parses all paths, avoiding injection via string concatenation entirely, and correctly aligns any user-suppliedsqlmodifications with multiple table references.PR created automatically by Jules for task 5696750450343249978 started by @devdudumuniz