Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent API call non-interactive device login #225

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/modules/crypto/keychainManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ const getLocalConfigurationWithoutDB = async (
});

// Get the authentication type (mainly to identify if the user is with OTP2)
const { type } = await get2FAStatusUnauthenticated({ login });
// if non-interactive device, we consider it as email_token, so we don't need to call the API
const { type } = deviceCredentials ? { type: 'email_token' } : await get2FAStatusUnauthenticated({ login });

let masterPassword = '';
const masterPasswordEnv = process.env.DASHLANE_MASTER_PASSWORD;
Expand All @@ -114,10 +115,8 @@ const getLocalConfigurationWithoutDB = async (
// In case of SSO
if (isSSO) {
masterPassword = decryptSsoRemoteKey({ ssoServerKey, ssoSpKey, remoteKeys });
} else if (masterPasswordEnv) {
masterPassword = masterPasswordEnv;
} else {
masterPassword = await askMasterPassword();
masterPassword = masterPasswordEnv ?? (await askMasterPassword());

// In case of OTP2
if (type === 'totp_login' && serverKey) {
Expand Down
Loading