Repository navigation
Reject file/URL table references and MySQL executable comments - #28
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes three validator gaps that the new dialect connectors (#27) exposed. These were found while adding DuckDB, MySQL and SQL Server support.
FROM 'data.csv'orFROM 's3://b/x.parquet'as a file or URL (a replacement scan). Before this change, the validator caught it only asUnknown table: csv, so a schema table namedcsvlet the read through. Any table name part that contains.,/,\or:is now rejected. Schema-qualified names such asmain.customersare unaffected./*! ... */(and MariaDB/*M! ... */) as SQL. These comments are now rejected, based on the tokenizer's comment stream. Plain comments and/*+ hint */comments still pass.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_safetypolicy 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 smokeeval run/eval checkagainst the baseline: OK. The quickstart CLI smoke: OK.🤖 Generated with Claude Code