chore: improve schema security (#23385)

This commit is contained in:
Beto Dealmeida
2023-03-17 08:05:50 -07:00
committed by GitHub
parent d4657f6198
commit 42e8d1b498
17 changed files with 346 additions and 26 deletions

View File

@@ -148,3 +148,17 @@ def test_cancel_query_failed(engine_mock: Mock) -> None:
query = Query()
cursor_mock = engine_mock.raiseError.side_effect = Exception()
assert MySQLEngineSpec.cancel_query(cursor_mock, query, "123") is False
def test_get_schema_from_engine_params() -> None:
"""
Test the ``get_schema_from_engine_params`` method.
"""
from superset.db_engine_specs.mysql import MySQLEngineSpec
assert (
MySQLEngineSpec.get_schema_from_engine_params(
make_url("mysql://user:password@host/db1"), {}
)
== "db1"
)