mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Clear passwords that don't decrypt (#159506)
If a password is not decrypted properly, then it should be removed from the secret storage because it's essentially dead. Fixes #151654
This commit is contained in:
parent
1715e06bb2
commit
0d690b3a8f
|
@ -65,9 +65,17 @@ export class MainThreadSecretState extends Disposable implements MainThreadSecre
|
|||
if (value.extensionId === extensionId) {
|
||||
return value.content;
|
||||
}
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
throw new Error('Cannot get password');
|
||||
} catch (parseError) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue