From a5ee7f6c0078a3ddaf31729e6dbd6a1883f6387d Mon Sep 17 00:00:00 2001 From: Oliver Blanthorn Date: Tue, 24 May 2022 14:19:34 +0200 Subject: [PATCH] Restore incognito check before storage --- src/state.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/state.ts b/src/state.ts index 35ec91de..2c84da8e 100644 --- a/src/state.ts +++ b/src/state.ts @@ -102,6 +102,13 @@ const state = new Proxy(overlay, { // Persist "sets" to storage in the background for some keys if (PERSISTENT_KEYS.includes(property)) { + // Ensure we don't accidentally store anything sensitive + if (browser.extension.inIncognitoContext) { + console.error( + "Attempted to write to storage in private window.", + ) + return false + } browser.storage.local.set({ state: R.pick(PERSISTENT_KEYS, target), } as any)