Skip to content

: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.

fix(managed-warehouse): trust EU hosted Trino endpoints (#118461)

Benjamin Knofe-Videre8e424105802
diff --git a/docs/internal/hogql-trino-compiler.md b/docs/internal/hogql-trino-compiler.md
index 4a17a44e35cf..2c9a7fc6a5eb 100644
--- a/docs/internal/hogql-trino-compiler.md
+++ b/docs/internal/hogql-trino-compiler.md
@@ -79,8 +79,8 @@ The grant secret exists only in process memory; these paths never read `Duckgres
The standalone `resolve_managed_warehouse_trino_connection(...)` helper returns a short-lived snapshot; callers executing queries must use the context manager to get refresh behavior.
The connection uses HTTPS with certificate verification and a 60-second HTTP timeout.
-Its session bypasses environment proxies only for control-plane-issued targets with a single hostname label under `dw.us.postwh.com` or `dw.dev.postwh.com`, on port 443.
-Customer-configured external sources retain the separate fixed-host allowlist (`trino.dw.us.postwh.com` and `trino.dw.dev.postwh.com`).
+Its session bypasses environment proxies only for control-plane-issued targets with a single hostname label under `dw.us.postwh.com`, `dw.eu.postwh.com`, or `dw.dev.postwh.com`, on port 443.
+Customer-configured external sources retain the separate fixed-host allowlist (`trino.dw.us.postwh.com`, `trino.dw.eu.postwh.com`, and `trino.dw.dev.postwh.com`).
The session checks and renews the same grant before sending POST, polling GET, or cancellation DELETE requests when less than two minutes remain.
Mint and renewal calls have a ten-second timeout.
Credential renewal is serialized so polling and cancellation share one renewal decision.
diff --git a/products/managed_warehouse/backend/tests/test_trino_connection.py b/products/managed_warehouse/backend/tests/test_trino_connection.py
index 5a51c4704b85..c9f853ff3b8b 100644
--- a/products/managed_warehouse/backend/tests/test_trino_connection.py
+++ b/products/managed_warehouse/backend/tests/test_trino_connection.py
@@ -203,6 +203,7 @@ def test_failed_refresh_does_not_send_a_request(refresh_response: str) -> None:
"host,port,bypass_proxy",
[
("tenant.dw.us.postwh.com", 443, True),
+ ("tenant.dw.eu.postwh.com", 443, True),
("TENANT.DW.DEV.POSTWH.COM.", 443, True),
("tenant.dw.us.postwh.com", 8443, False),
("trino.example.com", 443, False),
diff --git a/products/managed_warehouse/backend/trino_connection.py b/products/managed_warehouse/backend/trino_connection.py
index e7ac8d6bf1ce..d9c6df27b835 100644
--- a/products/managed_warehouse/backend/trino_connection.py
+++ b/products/managed_warehouse/backend/trino_connection.py
@@ -37,7 +37,7 @@ def _is_hosted_service_target(host: str) -> bool:
# Tenant endpoints are trusted only when issued by the control plane, never from external-source configuration.
label, _, domain = host.lower().removesuffix(".").partition(".")
return (
- domain in {"dw.us.postwh.com", "dw.dev.postwh.com"}
+ domain in {"dw.us.postwh.com", "dw.eu.postwh.com", "dw.dev.postwh.com"}
and re.fullmatch(r"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?", label) is not None
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/trino/tests/test_trino.py b/products/warehouse_sources/backend/temporal/data_imports/sources/trino/tests/test_trino.py
index ca3ba6ca465f..993d0f9ffba4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/trino/tests/test_trino.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/trino/tests/test_trino.py
@@ -85,6 +85,7 @@ def test_connect_trino_uses_tracked_session_and_closes_resources() -> None:
("host", "port", "use_ssl", "verify_ssl", "expected_trust_env"),
[
("trino.dw.us.postwh.com", 443, True, True, False),
+ ("trino.dw.eu.postwh.com", 443, True, True, False),
("TRINO.DW.DEV.POSTWH.COM.", 443, True, True, False),
("trino.example.com", 443, True, True, True),
("other.dw.us.postwh.com", 443, True, True, True),
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/trino/trino.py b/products/warehouse_sources/backend/temporal/data_imports/sources/trino/trino.py
index 484abd3afa43..d47601d66253 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/trino/trino.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/trino/trino.py
@@ -111,6 +111,7 @@ TRINO_PERMANENT_SYNC_ERROR_MESSAGES = frozenset(
POSTHOG_MANAGED_TRINO_HOSTS = frozenset(
{
"trino.dw.dev.postwh.com",
+ "trino.dw.eu.postwh.com",
"trino.dw.us.postwh.com",
}
)