: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(metabase): stop retrying syncs whose host resolves to an internal IP (#89670)
Tom Owers98527c46eb66
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/source.pyindex 64d8ac4b0e7c..e89128893d28 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/source.py@@ -135,6 +135,10 @@ The API key (or user) needs read access to the data you want to sync.""",# Deterministic and permanent until the Instance URL is corrected, so stop# retrying. Match the stable prefix, not the customer's hostname that follows it."Couldn't resolve the host": "The Metabase Instance URL could not be resolved via DNS. Check that it's spelled correctly and reachable from the public internet, then reconnect.",+ # `_is_host_safe` raises this when the Instance URL resolves to an internal or+ # private address (SSRF guard). Deterministic and permanent until the customer+ # points the source at a publicly reachable host, so stop retrying.+ "internal or private IP address": "The Metabase Instance URL resolves to an internal or private IP address. Use your instance's public URL, then reconnect.",}def _build_auth(self, config: MetabaseSourceConfig) -> MetabaseAuth:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/tests/test_metabase_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/tests/test_metabase_source.pyindex 0a045ce20959..6eedacf8bfba 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/tests/test_metabase_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/metabase/tests/test_metabase_source.py@@ -57,6 +57,29 @@ class TestMetabaseSource:non_retryable = self.source.get_non_retryable_errors()assert any(key in err for key in non_retryable)+ def test_internal_ip_host_message_is_classified_non_retryable(self):+ # `_is_host_safe` raises this exact message when the Instance URL resolves to a+ # private/internal address (SSRF guard) — a permanent, deterministic failure until the+ # customer points the source at a public host. Build the message via the real+ # `_is_host_safe` code path so this test breaks if either side's wording drifts from+ # the classifier's key.+ with (+ mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.common.mixins.is_cloud",+ return_value=True,+ ),+ mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.common.mixins.get_instance_region",+ return_value="US",+ ),+ ):+ ok, err = _is_host_safe("10.0.0.5", team_id=999)++ assert not ok+ assert err is not None+ non_retryable = self.source.get_non_retryable_errors()+ assert any(key in err for key in non_retryable)+def test_get_schemas_returns_all_endpoints(self):schemas = self.source.get_schemas(self.config, self.team_id)assert {s.name for s in schemas} == set(ENDPOINTS)