mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
chore: improve schema security (#23385)
This commit is contained in:
@@ -69,7 +69,7 @@ class MySQLEngineSpec(BaseEngineSpec, BasicParametersMixin):
|
||||
)
|
||||
encryption_parameters = {"ssl": "1"}
|
||||
|
||||
dynamic_schema = True
|
||||
supports_dynamic_schema = True
|
||||
|
||||
column_type_mappings = (
|
||||
(
|
||||
@@ -192,13 +192,28 @@ class MySQLEngineSpec(BaseEngineSpec, BasicParametersMixin):
|
||||
|
||||
@classmethod
|
||||
def adjust_database_uri(
|
||||
cls, uri: URL, selected_schema: Optional[str] = None
|
||||
cls,
|
||||
uri: URL,
|
||||
selected_schema: Optional[str] = None,
|
||||
) -> URL:
|
||||
if selected_schema:
|
||||
uri = uri.set(database=parse.quote(selected_schema, safe=""))
|
||||
|
||||
return uri
|
||||
|
||||
@classmethod
|
||||
def get_schema_from_engine_params(
|
||||
cls,
|
||||
sqlalchemy_uri: URL,
|
||||
connect_args: Dict[str, Any],
|
||||
) -> Optional[str]:
|
||||
"""
|
||||
Return the configured schema.
|
||||
|
||||
A MySQL database is a SQLAlchemy schema.
|
||||
"""
|
||||
return parse.unquote(sqlalchemy_uri.database)
|
||||
|
||||
@classmethod
|
||||
def get_datatype(cls, type_code: Any) -> Optional[str]:
|
||||
if not cls.type_code_map:
|
||||
|
||||
Reference in New Issue
Block a user