🔒 Fix SQL injection vulnerability in DuckDB execute - #35
Conversation
Refactored PySUS DuckDB query building to use safe parameterization ($1) when passing arbitrary strings as file paths. Instead of using f-strings to place paths into queries, paths are now passed securely to execute().
|
👋 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:
Fixed a critical SQL injection vulnerability in
pysus/api/client.py. Theread_parquetfunction dynamically built SQL queries using f-strings for user-provided paths (e.g.,f"SELECT * FROM '{path}'").If left unfixed, this allowed an attacker to inject arbitrary SQL statements by providing carefully crafted file paths. Given this operates on DuckDB, it could allow arbitrary operations.
🛡️ Solution:
Refactored the query generation logic to safely use DuckDB's parameterized statements (
$1placeholder). Since DuckDB accepts list arrays forread_parquetand binds them securely natively, paths are now provided in the parameters argument ofduckdb.execute(). We also cleaned up branching logic since single files and multi-files can now share the same array parameterization logic safely.PR created automatically by Jules for task 456115586314976520 started by @devdudumuniz