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

Don't delete a password if we can't decrypt it #171773

Merged
merged 1 commit into from Jan 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/vs/workbench/api/browser/mainThreadSecretState.ts
Expand Up @@ -71,15 +71,9 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre
return value.content;
}
} catch (parseError) {
// We may not be able to parse it, but we keep the secret in the keychain anyway just in case
// it decrypts correctly in the future.
this.logService.error(parseError);

// If we can't parse the decrypted value, then it's not a valid secret so we should try to delete it
try {
await this.credentialsService.deletePassword(fullKey, key);
} catch (e) {
this.logService.error(e);
}

throw new Error('Unable to parse decrypted password');
}
}
Expand Down