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.

chore(data-warehouse): fix direct-postgres SSRF guard test team-id collision (#66228)

Phil Haackd3788eca1250
diff --git a/posthog/hogql/test/test_direct_postgres_query.py b/posthog/hogql/test/test_direct_postgres_query.py
index fbb2c8f9982f..954ff1dd11c1 100644
--- a/posthog/hogql/test/test_direct_postgres_query.py
+++ b/posthog/hogql/test/test_direct_postgres_query.py
@@ -1264,7 +1264,9 @@ class TestDirectPostgresQuery(APIBaseTest):
'column "posthog_dashboard.name" must appear in the GROUP BY clause or be used in an aggregate function',
)
- @override_settings(CLOUD_DEPLOYMENT="US")
+ # DEV (not US/EU) keeps the host guard active without the internal-team allowlist, which the
+ # test team's auto-assigned id can otherwise collide with (US team_id 2 / EU team_id 1).
+ @override_settings(CLOUD_DEPLOYMENT="DEV")
@patch("posthog.hogql.direct_sql.postgres_adapter.psycopg.connect")
def test_execute_direct_postgres_query_blocks_internal_host(self, mock_connect):
source = ExternalDataSource.objects.create(