You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: [AI-266] Snowflake auth — support all auth methods, fix field name mismatches (#268)
* fix: [AI-266] Snowflake auth fails with `MissingParameterError` for private key and non-password methods
Root cause: the `warehouse_add` tool description only showed a Postgres password example,
so the Builder LLM used `private_key` (not `private_key_path`) for file paths. The driver
only checked `private_key_path`, so key-pair auth was never triggered.
Changes:
- Support all 8 Snowflake auth methods: password, key-pair (file + inline PEM),
OAuth, external browser SSO, Okta SSO, JWT, programmatic access token, MFA
- Auto-detect whether `private_key` contains a file path or PEM content
- Normalize escaped `\n` in inline PEM from env vars / JSON configs
- Accept both snake_case (dbt) and camelCase (SDK) field name variants
- Add `private_key`, `privateKey`, `token`, `oauth_client_secret`, `passcode`
and camelCase variants to `SENSITIVE_FIELDS` for secure keychain storage
- Use `isSensitiveField()` in `formatConnections` instead of hardcoded list
- Update `warehouse_add` tool description with Snowflake-specific examples
for all auth methods so the Builder LLM picks correct field names
- Add `private_key`, `authenticator`, `oauth_client_id`, `oauth_client_secret`
to dbt-profiles key mapper
- `detectAuthMethod` now returns `sso`, `oauth`, `key_pair` for all variants
- Better error messages for key decryption failures and missing OAuth tokens
- Use `connectAsync()` for browser-based SSO (external browser / Okta)
Closes#266
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: validate required fields for all explicit Snowflake authenticators
Addresses code review findings from 6-model consensus review:
- JWT, PROGRAMMATIC_ACCESS_TOKEN: error if token missing (was silent fallthrough)
- USERNAME_PASSWORD_MFA: error if password missing (was undefined)
- Browser SSO: error if `connectAsync` unavailable instead of silent fallback
- Extract Okta URL regex to avoid duplication
- Fix comment: "Non-interactive" → "Interactive" for browser SSO
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: JWT/PAT must alias to OAUTH, reject invalid `private_key` values
Addresses Gemini 3.1 Pro code review findings:
- JWT and PROGRAMMATIC_ACCESS_TOKEN: snowflake-sdk Node.js only accepts
pre-generated tokens via OAUTH authenticator. SNOWFLAKE_JWT expects a
`privateKey` for self-signing and would crash with TypeError.
- `private_key` containing a non-existent file path now throws a clear
error instead of passing the path string to `crypto.createPrivateKey`
which produces a cryptic OpenSSL error.
- Remove `oauthClientId`/`oauthClientSecret` passthrough — the SDK's
`AuthOauth` class ignores them entirely.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: keep credentials in memory when keytar unavailable
Sentry flagged: when keytar is unavailable (CI/headless), `saveConnection`
strips sensitive fields from both the disk config AND the in-memory config.
This causes subsequent `warehouse_test` calls in the same session to fail
because the credentials are permanently lost.
Fix: store the original config (with credentials) in memory so the current
session can connect. Only the disk file uses the sanitized version.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: handle `connectAsync` Promise rejection to prevent unhandled errors
Sentry flagged: `connectAsync()` returns a Promise in addition to accepting
a callback. If the SDK rejects the Promise (instead of calling the callback
with an error), the rejection was unhandled, potentially causing the
connection to hang silently.
Fix: chain `.catch(reject)` to forward Promise-based errors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: add `privateKeyPass` to SENSITIVE_FIELDS
Sentry flagged: the driver accepts `privateKeyPass` as a passphrase alias
but it was missing from SENSITIVE_FIELDS, causing plaintext storage in
connections.json.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments