: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
chore(cdp): test that the warehouse row guard hides other teams' rows (#125365)
Tom Owers43d80f4006e9
diff --git a/nodejs/src/cdp/services/hog-inputs.service.test.ts b/nodejs/src/cdp/services/hog-inputs.service.test.tsindex 92004765774c..00757f239b19 100644--- a/nodejs/src/cdp/services/hog-inputs.service.test.ts+++ b/nodejs/src/cdp/services/hog-inputs.service.test.ts@@ -392,6 +392,38 @@ describe('Hog Inputs', () => {expect(loaded.connection.value).toBeNull()})+ it.each([+ ['integration', "The integration for input 'connection' no longer exists."],+ ['integration_multi', null],+ ])("treats another team's warehouse row like a missing row for an %s input", async (type, message) => {+ const otherTeam = (await createTestTeamFixture(hub.postgres)).team+ const foreignId = 100000000 + otherTeam.id+ const missingId = foreignId + 1+ await insertIntegration(hub.postgres, otherTeam.id, {+ id: foreignId,+ kind: 'postgresql' as any,+ config: { warehouse_source_type: 'Postgres', host: 'db.example.com' },+ sensitive_config: { password: hub.encryptedFields.encrypt('secret-password') },+ })+ const run = async (id: number): Promise<any> => {+ hogFunction.inputs = { connection: { value: type === 'integration' ? id : [integrationId1, id] } }+ hogFunction.inputs_schema = [{ key: 'connection', type: type as any, required: true }]+ return hogInputsService.buildInputs(hogFunction, globals).catch((e) => e)+ }++ const foreign = await run(foreignId)+ const missing = await run(missingId)++ if (message) {+ expect(missing.message).toContain(message)+ expect(foreign.message).toBe(missing.message)+ } else {+ expect(missing).not.toBeInstanceOf(Error)+ expect(foreign).toEqual(missing)+ }+ expect(foreign.message ?? '').not.toContain("can't be used as a function input")+ })+it.each([['no marker', { team: 'foobar' }],['a null config', null],