Skip to content

Commit

Permalink
Support Master Password authentication via env variable (#223)
Browse files Browse the repository at this point in the history
When spawning `dcli` in Node it's impossible to get past master password
prompt as stdin doesn't works, this fixes it by checking if
`DASHLANE_MASTER_PASSWORD` is set when spawning the process.
  • Loading branch information
neo773 authored Mar 18, 2024
1 parent 2689b61 commit 20ae36d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/crypto/keychainManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ const getLocalConfigurationWithoutDB = async (
const { type } = await get2FAStatusUnauthenticated({ login });

let masterPassword = '';
let masterPasswordEnv = process.env.DASHLANE_MASTER_PASSWORD;

Check failure on line 110 in src/modules/crypto/keychainManager.ts

View workflow job for this annotation

GitHub Actions / build

'masterPasswordEnv' is never reassigned. Use 'const' instead
let serverKeyEncrypted = null;
const isSSO = type === 'sso';

// In case of SSO
if (isSSO) {
masterPassword = decryptSsoRemoteKey({ ssoServerKey, ssoSpKey, remoteKeys });
} else if(masterPasswordEnv) {
masterPassword = masterPasswordEnv
} else {
masterPassword = await askMasterPassword();

Expand Down

0 comments on commit 20ae36d

Please sign in to comment.