fix(sql): use AST for disallowed function checks - #43641
Conversation
Code Review Agent Run #0e3cf4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
The flagged issue is correct. The current implementation in the diff uses a set comprehension that calls To resolve this, you should compute the set of all functions present in the script once and then find the intersection with the denylist. Assuming # Compute present functions once
present_functions = script.get_all_functions()
found = {func for func in engine_disallowed if func in present_functions}If There are no other comments on this PR to address. superset/sql/execution/executor.py |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43641 +/- ##
=======================================
Coverage 79.19% 79.19%
=======================================
Files 2879 2879
Lines 165870 165872 +2
Branches 38352 38350 -2
=======================================
+ Hits 131354 131356 +2
Misses 32039 32039
Partials 2477 2477
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@bito-code-review review |
Code Review Agent Run #65ceffActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
The unified SQL executor currently stringifies parsed SQL and checks each configured disallowed function with substring containment. For PostgreSQL, the default
versiondenylist therefore rejects identifiers such asconversionandcustom_skill_versions, as well as literals and comments containing that text.Reuse the existing
SQLScript.check_functions_presentAST matcher so the denylist applies to actual function calls. This keepsversion()andpg_catalog.version()blocked without weakening the configured check, while avoiding false positives in identifiers, literals, and comments.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable; this is a backend SQL validation change.
TESTING INSTRUCTIONS
pytest tests/unit_tests/sql/execution/test_executor.py -k disallowed_functions.version()andpg_catalog.version()are reported as disallowed.conversion, quoted identifiers,custom_skill_versions, string literals, and comments do not produce false positives.pre-commit runagainst the staged files.ADDITIONAL INFORMATION