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(cdp): never pass warehouse source credentials to hog functions (#124889)

Tom Owersd7748a34e3f0
diff --git a/nodejs/src/cdp/services/hog-inputs.service.test.ts b/nodejs/src/cdp/services/hog-inputs.service.test.ts
index 3b400c371700..e6281fd8eca2 100644
--- a/nodejs/src/cdp/services/hog-inputs.service.test.ts
+++ b/nodejs/src/cdp/services/hog-inputs.service.test.ts
@@ -362,6 +362,30 @@ describe('Hog Inputs', () => {
expect(inputs.connection).toBeNull()
})
+ it.each([
+ ['a warehouse source marker', { warehouse_source_type: 'Postgres', host: 'db.example.com' }, null],
+ ['a null warehouse source marker', { warehouse_source_type: null, team: 'foobar' }, 'loaded'],
+ ['no warehouse source marker', { team: 'foobar' }, 'loaded'],
+ ])('handles an integration with %s', async (_name, config, expected) => {
+ const warehouseId = team.id + 3
+ await insertIntegration(hub.postgres, team.id, {
+ id: warehouseId,
+ kind: 'slack',
+ config,
+ sensitive_config: { password: hub.encryptedFields.encrypt('secret-password') },
+ })
+ hogFunction.inputs = { connection: { value: warehouseId } }
+ hogFunction.inputs_schema = [{ key: 'connection', type: 'integration', required: true }]
+
+ const inputs = await hogInputsService.buildInputs(hogFunction, globals)
+
+ if (expected === null) {
+ expect(inputs.connection).toBeNull()
+ } else {
+ expect(inputs.connection).toMatchObject({ $integration_id: warehouseId, password: 'secret-password' })
+ }
+ })
+
it.each([
{ name: 'a hog function', source: undefined },
{ name: 'a workflow email step', source: { appSourceId: 'flow-1', instanceId: 'action-1' } },
diff --git a/nodejs/src/cdp/services/hog-inputs.service.ts b/nodejs/src/cdp/services/hog-inputs.service.ts
index e227bb1cc736..95212bd67314 100644
--- a/nodejs/src/cdp/services/hog-inputs.service.ts
+++ b/nodejs/src/cdp/services/hog-inputs.service.ts
@@ -270,6 +270,10 @@ export class HogInputsService {
if (integration.kind === 'posthog') {
return null
}
+ // A row with this marker holds data warehouse source credentials. They are never Hog function inputs.
+ if (integration.config?.warehouse_source_type != null) {
+ return null
+ }
return {
$integration_id: integration.id,
...integration.config,