luoianun opened a new pull request, #42072:
URL: https://github.com/apache/superset/pull/42072

   ### SUMMARY
   
   Fixes #42071.
   
   This updates SQL execution's disallowed function check to use the parsed SQL 
AST instead of substring matching against the full statement text.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable; backend-only change.
   
   ### TESTING INSTRUCTIONS
   
   Added a regression test covering identifiers that contain disallowed 
function names such as `user` and `schema`.
   
   Local checks run:
   
   - `uvx ruff check superset/sql/execution/executor.py 
tests/unit_tests/sql/execution/test_executor.py`
   - `uvx ruff format --check superset/sql/execution/executor.py 
tests/unit_tests/sql/execution/test_executor.py`
   - `git diff --check -- superset/sql/execution/executor.py 
tests/unit_tests/sql/execution/test_executor.py`
   - `py -3.10 -m py_compile superset/sql/execution/executor.py 
tests/unit_tests/sql/execution/test_executor.py`
   
   Attempted but blocked by local Windows dependency setup:
   
   - `python -m pytest tests/unit_tests/sql/execution/test_executor.py -q` with 
system Python failed because the global environment has SQLAlchemy 2.x while 
pytest config expects `sqlalchemy.exc.RemovedIn20Warning`.
   - `uv pip sync -r requirements/development.txt` on Windows failed while 
building `python-ldap==3.4.7` due to missing OpenLDAP headers (`lber.h`).
   - `uvx pre-commit run --files superset/sql/execution/executor.py 
tests/unit_tests/sql/execution/test_executor.py` timed out while preparing hook 
environments.
   
   ### ADDITIONAL INFORMATION
   
   The previous implementation checked denylisted function names as substrings 
of the rendered SQL statement. That caused false positives for identifiers such 
as `metric_user_count`, `information_schema`, and `table_schema`.
   
   The new implementation reuses `SQLScript.check_functions_present(...)`, 
which inspects actual SQL function nodes, so real calls like `USER()` remain 
blocked while identifiers containing `user` are allowed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to