Skip to content

Reject file/URL table references and MySQL executable comments - #28

Merged
nickklos10 merged 1 commit into
mainfrom
fix/dialect-validator-gaps
Oct 21, 2026
Merged

nickklos10 merged 1 commit into
mainfrom
fix/dialect-validator-gaps

Conversation

@nickklos10

Copy link
Copy Markdown
Owner

Closes three validator gaps that the new dialect connectors (#27) exposed. These were found while adding DuckDB, MySQL and SQL Server support.

  • DuckDB file and URL reads. DuckDB reads FROM 'data.csv' or FROM 's3://b/x.parquet' as a file or URL (a replacement scan). Before this change, the validator caught it only as Unknown table: csv, so a schema table named csv let the read through. Any table name part that contains ., /, \ or : is now rejected. Schema-qualified names such as main.customers are unaffected.
  • MySQL/MariaDB executable comments. MySQL runs the body of /*! ... */ (and MariaDB /*M! ... */) as SQL. These comments are now rejected, based on the tokenizer's comment stream. Plain comments and /*+ hint */ comments still pass.
  • T-SQL OPENROWSET / OPENQUERY / OPENDATASOURCE. These were already rejected, either as a parse error or as a blocked function. This PR adds regression tests for them.

A new source_safety policy check reports the result.

Verification

  • ruff check src tests (ruff 0.17.1): passes.
  • pytest: 817 passed, 3 skipped. Without the fix, 8 of the 14 new tests fail.
  • benchmarks/validate_golds.py: OK. The safety suite: 8/8. The smoke eval run / eval check against the baseline: OK. The quickstart CLI smoke: OK.

🤖 Generated with Claude Code

DuckDB treats `FROM 'data.csv'` or `FROM 's3://b/x.parquet'` as a file or
URL read. The validator only caught these as "Unknown table: csv", so a
schema table named `csv` let the read through. Table parts containing
path or URL characters are now rejected.

MySQL/MariaDB run the body of `/*! ... */` and `/*M! ... */` as SQL, so a
payload hidden there escaped validation. Such comments are now rejected
from the token stream; plain and `/*+ hint */` comments still pass.

Adds regression tests for T-SQL OPENROWSET/OPENQUERY/OPENDATASOURCE,
which were already rejected (parse error or blocked function).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nickklos10
nickklos10 merged commit ceddf45 into main Oct 21, 2026
5 checks passed
@nickklos10
nickklos10 deleted the fix/dialect-validator-gaps branch October 21, 2026 13:38
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.

2 participants