Skip to content

Commit e74437c

Browse files
committed
fix(credentials): fail Databricks verification on an oversized identity reply, cite the CLI docs
1 parent 053d8bd commit e74437c

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎apps/sim/lib/compare/data/sim.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ export const simProfile: CompetitorProfile = {
143143
label: 'Sim Docs: Introduction (visual, natural-language, and API building)',
144144
asOf: '2026-11-10',
145145
},
146+
{
147+
url: 'https://docs.sim.ai/cli',
148+
label: 'Sim Docs: CLI',
149+
asOf: '2026-11-10',
150+
},
146151
],
147152
},
148153
learningCurve: {

‎apps/sim/lib/credentials/databricks-service-account.server.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ describe('saving a Databricks connection', () => {
4848
)
4949
})
5050

51+
it('refuses an identity reply over the size cap instead of saving the host as the identity', async () => {
52+
fetch.mockResolvedValue(
53+
jsonResponse({ userName: 'me@example.com', groups: 'g'.repeat(1024 * 1024) })
54+
)
55+
56+
await expect(
57+
verifyAndEncryptDatabricksCredential(
58+
patConfig('dbc-1234abcd-5678.cloud.databricks.com'),
59+
owner
60+
)
61+
).rejects.toThrow(/Could not verify/)
62+
expect(encryptionMockFns.mockEncryptSecret).not.toHaveBeenCalled()
63+
})
64+
5165
it.each([
5266
'attacker.example.com',
5367
'https://attacker.example.com',

‎apps/sim/lib/credentials/databricks-service-account.server.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,15 @@ async function verifyWorkspaceIdentity(
246246
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
247247
})
248248
if (!response.ok) throw new Error(`workspace returned HTTP ${response.status}`)
249+
// A malformed body only loses the display name; an oversized one must fail
250+
// verification rather than save the host as the identity.
249251
const me = (await readResponseJsonWithLimit(response, {
250252
maxBytes: MAX_RESPONSE_BYTES,
251253
label: 'Databricks identity response',
252-
}).catch(() => ({}))) as {
254+
}).catch((error: unknown) => {
255+
if (error instanceof SyntaxError) return {}
256+
throw error
257+
})) as {
253258
userName?: unknown
254259
displayName?: unknown
255260
}

0 commit comments

Comments
 (0)