feat(integrations): add Snowflake OAuth block - #6394
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Auth is per-customer Snowflake account OAuth: customers supply account URL, locator, and client ID; Sim uses deployment-wide Also adds generated catalog/tool metadata and setup docs. Triggers are intentionally omitted (no Snowflake-compatible webhook model in scope). Reviewed by Cursor Bugbot for commit 1c5393a. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds a Snowflake integration backed by account-scoped OAuth, SQL API tools, bounded partition handling, catalog registration, and setup documentation.
Confidence Score: 4/5The PR should not merge until the Snowflake integrations-page flow preserves workspace identity so successful OAuth connections become usable workflow credentials. The primary browser connection path persists a Snowflake provider account without creating the draft required to bind it to a workspace credential; the remaining accepted issue is a non-blocking type-safety violation in a test. Files Needing Attention: apps/sim/hooks/queries/oauth/oauth-connections.ts, apps/sim/app/api/auth/snowflake/authorize/route.ts, apps/sim/tools/index.test.ts
|
| Filename | Overview |
|---|---|
| apps/sim/hooks/queries/oauth/oauth-connections.ts | Adds custom OAuth redirects, but the browser flow does not propagate workspaceId and therefore cannot create a workspace-bound Snowflake credential. |
| apps/sim/app/api/auth/snowflake/authorize/route.ts | Implements authenticated account-specific OAuth setup and PKCE, while making credential-draft creation conditional on a workspaceId the primary UI flow omits. |
| apps/sim/app/api/auth/oauth2/callback/snowflake/route.ts | Validates state, exchanges the code, persists account metadata, and delegates workspace credential creation to the draft processor. |
| apps/sim/lib/oauth/snowflake.ts | Implements validated Snowflake origins and metadata, PKCE, RS256 assertions, and bounded token exchange and refresh handling. |
| apps/sim/tools/snowflake/utils.ts | Implements bounded SQL API parsing, status normalization, partition metadata, and result shaping without an accepted defect. |
| apps/sim/lib/core/security/input-validation.server.ts | Adds compressed-response decoding with wire and decoded-size bounds and covered stream lifecycle behavior. |
| apps/sim/tools/index.test.ts | Extends configurable response-cap coverage but introduces an explicit any cast contrary to the repository's TypeScript rule. |
Reviews (1): Last reviewed commit: "feat(integrations): add Snowflake OAuth ..." | Re-trigger Greptile
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9f3ad46. Configure here.
7c9b773 to
1c5393a
Compare

Summary
OAuth architecture
Customers provide their Snowflake account URL, account locator, and OAuth client ID. Sim uses one deployment-wide
SNOWFLAKE_OAUTH_PRIVATE_KEY; customers register the matching public key on their Snowflake security integration. Versioned nonsecret connection metadata is stored in the existing OAuth account ID field, and refreshes reconstruct the account-specific token endpoint and client assertion.Validation
gpt-5.6-solhigh review usingvalidate-integrationandmemory-load-check, iterated to explicit no actionable findingsNotes
No database migration, integration-availability exception, Better Auth provider, trigger, automatic all-partition fetch, role switching, multi-statement execution, or Snowflake-only framework is introduced.