: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(convex): mask deployment URL in credential-validation errors (#68510)
Tom Owers83c0b0e9053b
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.pyindex 40562f0d0ff3..b87d1473333b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/convex.py@@ -244,7 +244,13 @@ def validate_credentials(deploy_url: str, deploy_key: str) -> tuple[bool, str |passif e.response.status_code in (401, 403):return False, "Invalid deploy key. Check your Convex deploy key and try again."- return False, str(e)+ # Any other status falls through to a generic message. Keep the raw error+ # (which embeds the deployment URL) out of what the user sees.+ detail = f" (HTTP {e.response.status_code})" if e.response is not None else ""+ return (+ False,+ f"The Convex deployment rejected the request{detail}. Check your deployment URL and deploy key, then try again.",+ )except RequestsConnectionError:return False, "Could not connect to the Convex deployment. Check your deployment URL and try again."except RequestException as e:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.pyindex b8938a837d34..899db77d3393 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/convex/tests/test_convex.py@@ -5,6 +5,7 @@ import pytestfrom unittest.mock import MagicMock, Mock, patchfrom parameterized import parameterized+from requests.exceptions import HTTPErrorfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManagerfrom products.warehouse_sources.backend.temporal.data_imports.sources.convex.convex import (@@ -109,6 +110,21 @@ class TestValidateDeployUrl:called_url = mock_get.return_value.get.call_args.args[0]assert called_url.startswith("https://swift-lemur-123.convex.cloud/api/")+ @patch("products.warehouse_sources.backend.temporal.data_imports.sources.convex.convex.make_tracked_session")+ def test_validate_credentials_does_not_leak_url_on_http_error(self, mock_get):+ err_response = Mock(status_code=400)+ err_response.json.return_value = {"code": "SomethingUnexpected"}+ response = Mock()+ response.raise_for_status.side_effect = HTTPError(response=err_response)+ mock_get.return_value.get.return_value = response++ ok, err = validate_credentials("https://swift-lemur-123.convex.cloud", "prod:abc123")+ assert not ok+ assert err is not None+ assert "swift-lemur-123" not in err+ assert "convex.cloud" not in err+ assert "400" in err+class TestListSnapshotResumable:@patch("products.warehouse_sources.backend.temporal.data_imports.sources.convex.convex.make_tracked_session")