@lightdash/warehouses 0.2092.1 → 0.2092.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -173,6 +173,7 @@ class SnowflakeWarehouseClient extends WarehouseBaseClient_1.default {
173
173
  throw new common_1.UnexpectedServerError('Snowflake token is required for SSO authentication');
174
174
  }
175
175
  authenticationOptions = {
176
+ // Do not include username when doing SSO authentication
176
177
  token: credentials.token,
177
178
  authenticator: 'OAUTH',
178
179
  };
@@ -182,6 +183,7 @@ class SnowflakeWarehouseClient extends WarehouseBaseClient_1.default {
182
183
  credentials.authenticationType === 'private_key')) {
183
184
  if (!credentials.privateKeyPass) {
184
185
  authenticationOptions = {
186
+ username: credentials.user,
185
187
  privateKey: credentials.privateKey,
186
188
  authenticator: 'SNOWFLAKE_JWT',
187
189
  };
@@ -201,6 +203,7 @@ class SnowflakeWarehouseClient extends WarehouseBaseClient_1.default {
201
203
  type: 'pkcs8',
202
204
  });
203
205
  authenticationOptions = {
206
+ username: credentials.user,
204
207
  privateKey: privateKey.toString(),
205
208
  authenticator: 'SNOWFLAKE_JWT',
206
209
  };
@@ -208,19 +211,14 @@ class SnowflakeWarehouseClient extends WarehouseBaseClient_1.default {
208
211
  }
209
212
  else if (credentials.password) {
210
213
  authenticationOptions = {
214
+ username: credentials.user,
211
215
  password: credentials.password,
212
216
  authenticator: 'SNOWFLAKE',
213
217
  };
214
218
  }
215
219
  this.connectionOptions = {
216
220
  account: credentials.account,
217
- // When using SSO, username and role can cause conflict
218
- ...(credentials.authenticationType !== 'sso'
219
- ? {
220
- username: credentials.user,
221
- role: credentials.role,
222
- }
223
- : {}),
221
+ role: credentials.role,
224
222
  ...authenticationOptions,
225
223
  database: credentials.database,
226
224
  schema: credentials.schema,
@@ -231,6 +229,18 @@ class SnowflakeWarehouseClient extends WarehouseBaseClient_1.default {
231
229
  sfRetryMaxLoginRetries: 3, // Number of retries for the login request.
232
230
  retryTimeout: 15000, // according to docs: The max login timeout value. This value is either 0 or over 300.
233
231
  };
232
+ // Manually specify the connection options to log, to avoid logging sensitive information
233
+ const logConnectionOptions = {
234
+ account: this.connectionOptions.account,
235
+ authenticator: authenticationOptions.authenticator,
236
+ username: this.connectionOptions.username,
237
+ role: this.connectionOptions.role,
238
+ database: this.connectionOptions.database,
239
+ schema: this.connectionOptions.schema,
240
+ warehouse: this.connectionOptions.warehouse,
241
+ accessUrl: this.connectionOptions.accessUrl,
242
+ };
243
+ console.info(`Initialized snowflake warehouse client with authentication type "${credentials.authenticationType}" and connection options: ${JSON.stringify(logConnectionOptions)}`);
234
244
  }
235
245
  async getConnection(connectionOptionsOverrides) {
236
246
  let connection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/warehouses",
3
- "version": "0.2092.1",
3
+ "version": "0.2092.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "snowflake-sdk": "~2.1.3",
18
18
  "ssh2": "^1.14.0",
19
19
  "trino-client": "0.2.6",
20
- "@lightdash/common": "0.2092.1"
20
+ "@lightdash/common": "0.2092.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/pg": "^8.11.10",