Skip to content

MDEV-40653 Various SQL injections paths mitigation - #5514

Merged
drrtuy merged 2 commits into
MariaDB:11.4from
drrtuy:MDEV-40653
Aug 7, 2026
Merged

MDEV-40653 Various SQL injections paths mitigation#5514
drrtuy merged 2 commits into
MariaDB:11.4from
drrtuy:MDEV-40653

Conversation

@drrtuy

@drrtuy drrtuy commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Harden DuckDB SQL forwarding against injection

What

Prevent SQL injection caused by MariaDB and DuckDB lexer differences when forwarding queries. Ensure generated DuckDB SQL safely handles crafted identifiers and reject queries whose backslash-escape semantics could change quote boundaries.

Key changes

  • Add centralized DuckDB identifier quoting with embedded double-quote escaping.
  • Apply safe quoting across DDL, DML, pushdown, schema, and delta-appender paths.
  • Replace naive backtick conversion with lexer-aware handling of strings, comments, and quoted identifiers.
  • Reject forwarded SQL when MariaDB and DuckDB parse backslash-escaped quotes differently.
  • Execute non-streaming statements through DuckDB’s single materialized pending-query path and add identifier/lexical-guard regression coverage.

How to test

Run:

storage/duckdb/run_mtr.sh duckdb_identifier_escaping

@drrtuy
drrtuy merged commit d8bb2d5 into MariaDB:11.4 Aug 7, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant