Skip to content

Commit 680cbcc

Browse files
Fix encryption by not double sequencing (microsoft#186234)
super.set adds to the sequencer... I shouldn't do that in the overridden function too. Also more trace logging because _why not_? Thanks for reporting @joyceerhl!
1 parent c42e107 commit 680cbcc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/vs/platform/encryption/electron-main/encryptionMainService.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export class EncryptionMainService implements IEncryptionMainService {
3131
}
3232

3333
async encrypt(value: string): Promise<string> {
34+
this.logService.trace('[EncryptionMainService] Encrypting value.');
3435
try {
35-
this.logService.trace('[EncryptionMainService] Encrypting value.');
3636
const result = JSON.stringify(safeStorage.encryptString(value));
3737
this.logService.trace('[EncryptionMainService] Encrypted value.');
3838
return result;
@@ -57,7 +57,14 @@ export class EncryptionMainService implements IEncryptionMainService {
5757
const bufferToDecrypt = Buffer.from(parsedValue.data);
5858

5959
this.logService.trace('[EncryptionMainService] Decrypting value.');
60-
return safeStorage.decryptString(bufferToDecrypt);
60+
try {
61+
const result = safeStorage.decryptString(bufferToDecrypt);
62+
this.logService.trace('[EncryptionMainService] Decrypted value.');
63+
return result;
64+
} catch (e) {
65+
this.logService.error(e);
66+
throw e;
67+
}
6168
}
6269

6370
isEncryptionAvailable(): Promise<boolean> {

src/vs/workbench/services/secrets/electron-sandbox/secretStorageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class NativeSecretStorageService extends BaseSecretStorageService {
4444

4545
});
4646

47-
return this._sequencer.queue(key, () => super.set(key, value));
47+
return super.set(key, value);
4848
}
4949

5050
private notifyOfNoEncryptionOnce = once(() => this.notifyOfNoEncryption());

0 commit comments

Comments
 (0)