:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(mysql): catch a scheme-less URL pasted into the host field (#95741)
Tom Owers06645a661b4f
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.pyindex 39132e5cd29c..7774ccc4f801 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py@@ -444,7 +444,9 @@ class MySQLSource(SQLSource[MySQLSourceConfig], SSHTunnelMixin, ValidateDatabase# A pasted URL or connection string in the host field otherwise fails DNS resolution with a# misleading "check the spelling" message that echoes the raw value back (which can embed# credentials). Catch it early with an actionable message that never reflects the input.- if "://" in config.host:+ # A scheme-less paste ("db.example.com/mydb", "user:[email protected]") has no "://",+ # so match the path and userinfo separators — neither is legal in a hostname anyway.+ if "/" in config.host or "@" in config.host:return False, _HOST_IS_URL_ERRORvalid_host, host_errors = self.is_database_host_valid(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.pyindex 2139ddf4e415..3c6784ddddd1 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py@@ -2487,6 +2487,9 @@ class TestMySQLSourceValidateCredentials:["https://db.example.com/","mysql://root:[email protected]:3306/mydb",+ # No scheme, so the guard has to match on the path and userinfo separators instead.+ "db.example.com/mydb",+ "root:[email protected]",],)def test_url_in_host_field_rejected_without_echoing_input(self, source, mocker, host):