You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1][doc-drift] Parameterized queries are promised in DESIGN_REQUIREMENTS but execute_query does not accept params #285
execute_query(connection_id, sql) accepts only two arguments. Frontend wraps it as api.executeQuery(connId, sql) with no parameter array. Any user-supplied value must be interpolated into the SQL string by the frontend. This contradicts the test plan.
Files
src-tauri/src/commands/mod.rs:157-181
src/lib/tauri-api.ts (executeQuery wrapper)
src/types/index.ts (no params type)
Repro
Static analysis only. Repro requires a feature that uses params.
Expected
execute_query accepts an optional params: Vec<Value> (or similar), frontends pass values as ? placeholders, sqlx binds them. A test demonstrates that SELECT ? with user input cannot be injected.
Proposed fix
Scope M. Add params to command signature; switch to sqlx::query_with(sql, params).fetch_many(). Update tauri-api.ts and TS types. Land test_execute_with_params from TESTING_STRATEGY §4.
Acceptance
Test passes; SQL injection via params is impossible by construction.
Needs human verify
Yes (param path itself is testable; full surface needs real usage).
Worth recording what checking this premise turned up, since the issue is closed as a design rejection.
The reasoning for rejecting: execute_query runs the user's own text, so the whole statement is the input and there is no application value to bind. Where values are the app's they are bound already, in Rust. Where the app composes SQL for a human to read — a backup file, a generated INSERT — placeholders are not available at all.
But those escaping paths used \\' for a quote, which is not an escape under NO_BACKSLASH_ESCAPES. The backslash is literal and the quote ends the string. Verified against MySQL 8.0.46: a row value of x', 1); DROP TABLE victim; -- in a SQLPilot backup, restored on a server in that mode, dropped the table.
Fixed in #650 by doubling the quote, which is correct whether backslash escaping is on or off. Nine assertions across seven files — several of them the tests specifically about injection safety — had been written against the old form.
So the instinct behind this issue was right even though the proposed fix was not the one that was needed.
Activity
fix(security): double the quote, so a value cannot end the string it …
fix(security): double the quote, so a value cannot end the string it …
EVWorth commentedon Sep 11, 2026
Worth recording what checking this premise turned up, since the issue is closed as a design rejection.
The reasoning for rejecting:
execute_queryruns the user's own text, so the whole statement is the input and there is no application value to bind. Where values are the app's they are bound already, in Rust. Where the app composes SQL for a human to read — a backup file, a generated INSERT — placeholders are not available at all.But those escaping paths used
\\'for a quote, which is not an escape underNO_BACKSLASH_ESCAPES. The backslash is literal and the quote ends the string. Verified against MySQL 8.0.46: a row value ofx', 1); DROP TABLE victim; --in a SQLPilot backup, restored on a server in that mode, dropped the table.Fixed in #650 by doubling the quote, which is correct whether backslash escaping is on or off. Nine assertions across seven files — several of them the tests specifically about injection safety — had been written against the old form.
So the instinct behind this issue was right even though the proposed fix was not the one that was needed.