Skip to content

🔒 Fix SQL injection vulnerability in DuckDB read_parquet queries - #44

Draft
devdudumuniz wants to merge 1 commit into
mainfrom
security-sql-injection-read-parquet-5696750450343249978
Draft

🔒 Fix SQL injection vulnerability in DuckDB read_parquet queries#44
devdudumuniz wants to merge 1 commit into
mainfrom
security-sql-injection-read-parquet-5696750450343249978

Conversation

@devdudumuniz

Copy link
Copy Markdown
Owner

🎯 What: The string formatting in the read_parquet method within pysus/api/client.py allowed an SQL injection vulnerability where crafted filenames (e.g., evil'; SELECT 'injected' as a; --.parquet) could execute arbitrary SQL statements against DuckDB.

⚠️ Risk: An attacker supplying or modifying files and triggering 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's read_parquet function 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-supplied sql modifications with multiple table references.


PR created automatically by Jules for task 5696750450343249978 started by @devdudumuniz

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.
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant