From ab7e15e9e43a6fbca78d4ee3319bfb256b8a2c93 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 19:58:35 -0500 Subject: [PATCH 1/7] Try to prevent issues if chrome.storage.get unexpectedly returns undefined --- src/models/settings.ts | 4 ++-- src/store/Accounts.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/models/settings.ts b/src/models/settings.ts index ae793e76..f40cb2e1 100644 --- a/src/models/settings.ts +++ b/src/models/settings.ts @@ -153,7 +153,7 @@ export class UserSettings { ? StorageLocation.Local : storageLocation; const storageData: UserSettingsData = - (await chrome.storage[location].get("UserSettings")).UserSettings || {}; + (await chrome.storage[location].get("UserSettings"))?.UserSettings || {}; delete storageData[key]; UserSettings.items = storageData; @@ -163,7 +163,7 @@ export class UserSettings { private static async getStorageData(location: StorageLocation) { const storageData: UserSettingsData = - (await chrome.storage[location].get("UserSettings")).UserSettings || {}; + (await chrome.storage[location].get("UserSettings"))?.UserSettings || {}; return storageData; } diff --git a/src/store/Accounts.ts b/src/store/Accounts.ts index 22c00b1a..2a6bd0bf 100644 --- a/src/store/Accounts.ts +++ b/src/store/Accounts.ts @@ -480,8 +480,10 @@ export class Accounts implements Module { newStorageLocation === StorageLocation.Sync ) { const localData = await chrome.storage.local.get(); - delete localData.UserSettings; - await chrome.storage.sync.set(localData); + if (localData?.UserSettings) { + delete localData.UserSettings; + await chrome.storage.sync.set(localData); + } const syncData = await chrome.storage.sync.get(); // Double check if data was set From 8a3240823ce692ba98e06e376b009ac0894dfa83 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 20:15:33 -0500 Subject: [PATCH 2/7] pin version of mujo-code/puppeteer-headful --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9e90435..a51e367a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: run-tests: runs-on: ubuntu-latest name: Run tests - needs: [ build ] + needs: [build] steps: - uses: actions/checkout@v2 @@ -53,9 +53,9 @@ jobs: - name: Install dependencies run: npm ci env: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true' + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" - name: Test code - uses: mujo-code/puppeteer-headful@master + uses: mujo-code/puppeteer-headful@18.9.0 with: args: npm test From e902d86de0f71e33acc63e10d2f0c1c0d5a2293c Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 20:21:08 -0500 Subject: [PATCH 3/7] Test fix for puppeteer issues --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a51e367a..071ccb53 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,6 @@ jobs: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" - name: Test code - uses: mujo-code/puppeteer-headful@18.9.0 + uses: mymindstorm/puppeteer-headful@5cdb4b90ae90e67cefb14e867d35c7b73693adac with: args: npm test From 12f8291e0e860d32b2250ca8a57e5084b84322db Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Tue, 25 Jun 2024 20:39:40 -0500 Subject: [PATCH 4/7] update CI action --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 071ccb53..c4e2793f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,6 +56,6 @@ jobs: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" - name: Test code - uses: mymindstorm/puppeteer-headful@5cdb4b90ae90e67cefb14e867d35c7b73693adac + uses: mymindstorm/puppeteer-headful@8f745c770f7f4c0f9f332d7c43a775f90e53779a with: args: npm test From 41acb99c82e4ac998b636be94c158ad0a6127a22 Mon Sep 17 00:00:00 2001 From: hicallmeal <76943372+hicallmeal@users.noreply.github.com> Date: Tue, 2 Jul 2024 03:55:37 +1000 Subject: [PATCH 5/7] Implement work-around/fix for incorrect render of manually added HOTP tokens The parsed ` - + @@ -103,7 +103,7 @@ export default Vue.extend({ ) { type = OTPType.hhex; } else { - type = parseInt(this.newAccount.type); + type = this.newAccount.type; } if (type === OTPType.hhex || type === OTPType.hotp) { From 320a999621190fb2a5277cfc9129d60852007b51 Mon Sep 17 00:00:00 2001 From: Brendan Early Date: Thu, 4 Jul 2024 00:46:21 -0500 Subject: [PATCH 7/7] Don't insert content script on chrome:// pages when autofill is enabled (#1214) * Fix #1203 * copy even if autofill fails * remove unnecessary dependency * address review comments * fix --- package-lock.json | 75 ++++++------------------- package.json | 5 +- src/background.ts | 11 +++- src/components/Popup/AddMethodPage.vue | 4 +- src/components/Popup/EntryComponent.vue | 17 +++--- src/components/Popup/MainHeader.vue | 4 +- src/utils.ts | 17 ++++++ 7 files changed, 57 insertions(+), 76 deletions(-) diff --git a/package-lock.json b/package-lock.json index e36934af..958147fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "qrcode-generator": "^1.4.4", "qrcode-reader": "^1.0.4", "uuid": "^3.4.0", - "vue": "^2.6.12", + "vue": "^2.7.16", "vue2-dragula": "^2.5.4", "vuex": "^3.4.0" }, @@ -32,7 +32,6 @@ "@types/uuid": "^3.4.9", "@typescript-eslint/eslint-plugin": "^2.34.0", "@typescript-eslint/parser": "^2.34.0", - "@vue/runtime-dom": "^3.2.47", "@vue/test-utils": "^1.1.1", "base64-loader": "^1.0.0", "buffer": "^6.0.3", @@ -58,7 +57,7 @@ "util": "^0.12.5", "vue-loader": "^15.10.1", "vue-svg-loader": "^0.16.0", - "vue-template-compiler": "^2.7.0", + "vue-template-compiler": "^2.7.16", "webpack": "^5.11.0", "webpack-cli": "^5.0.0", "webpack-merge": "^5.0.0" @@ -1010,13 +1009,16 @@ } }, "node_modules/@vue/compiler-sfc": { - "version": "2.7.14", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.14.tgz", - "integrity": "sha512-aNmNHyLPsw+sVvlQFQ2/8sjNuLtK54TC6cuKnVzAY93ks4ZBrvwQSnkkIh7bsbNhum5hJBS00wSDipQ937f5DA==", + "version": "2.7.16", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz", + "integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==", "dependencies": { - "@babel/parser": "^7.18.4", + "@babel/parser": "^7.23.5", "postcss": "^8.4.14", "source-map": "^0.6.1" + }, + "optionalDependencies": { + "prettier": "^1.18.2 || ^2.0.0" } }, "node_modules/@vue/component-compiler-utils": { @@ -1077,48 +1079,6 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", "dev": true }, - "node_modules/@vue/reactivity": { - "version": "3.2.47", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.47.tgz", - "integrity": "sha512-7khqQ/75oyyg+N/e+iwV6lpy1f5wq759NdlS1fpAhFXa8VeAIKGgk2E/C4VF59lx5b+Ezs5fpp/5WsRYXQiKxQ==", - "dev": true, - "dependencies": { - "@vue/shared": "3.2.47" - } - }, - "node_modules/@vue/runtime-core": { - "version": "3.2.47", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.47.tgz", - "integrity": "sha512-RZxbLQIRB/K0ev0K9FXhNbBzT32H9iRtYbaXb0ZIz2usLms/D55dJR2t6cIEUn6vyhS3ALNvNthI+Q95C+NOpA==", - "dev": true, - "dependencies": { - "@vue/reactivity": "3.2.47", - "@vue/shared": "3.2.47" - } - }, - "node_modules/@vue/runtime-dom": { - "version": "3.2.47", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.47.tgz", - "integrity": "sha512-ArXrFTjS6TsDei4qwNvgrdmHtD930KgSKGhS5M+j8QxXrDJYLqYw4RRcDy1bz1m1wMmb6j+zGLifdVHtkXA7gA==", - "dev": true, - "dependencies": { - "@vue/runtime-core": "3.2.47", - "@vue/shared": "3.2.47", - "csstype": "^2.6.8" - } - }, - "node_modules/@vue/runtime-dom/node_modules/csstype": { - "version": "2.6.21", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", - "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==", - "dev": true - }, - "node_modules/@vue/shared": { - "version": "3.2.47", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.47.tgz", - "integrity": "sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==", - "dev": true - }, "node_modules/@vue/test-utils": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/@vue/test-utils/-/test-utils-1.3.4.tgz", @@ -6768,7 +6728,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", - "dev": true, + "devOptional": true, "bin": { "prettier": "bin-prettier.js" }, @@ -8602,11 +8562,12 @@ "dev": true }, "node_modules/vue": { - "version": "2.7.14", - "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.14.tgz", - "integrity": "sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==", + "version": "2.7.16", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.16.tgz", + "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", + "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", "dependencies": { - "@vue/compiler-sfc": "2.7.14", + "@vue/compiler-sfc": "2.7.16", "csstype": "^3.1.0" } }, @@ -8746,9 +8707,9 @@ } }, "node_modules/vue-template-compiler": { - "version": "2.7.14", - "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", - "integrity": "sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==", + "version": "2.7.16", + "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz", + "integrity": "sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==", "dev": true, "dependencies": { "de-indent": "^1.0.2", diff --git a/package.json b/package.json index 088dde83..bb9b2754 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "@types/uuid": "^3.4.9", "@typescript-eslint/eslint-plugin": "^2.34.0", "@typescript-eslint/parser": "^2.34.0", - "@vue/runtime-dom": "^3.2.47", "@vue/test-utils": "^1.1.1", "base64-loader": "^1.0.0", "buffer": "^6.0.3", @@ -60,7 +59,7 @@ "util": "^0.12.5", "vue-loader": "^15.10.1", "vue-svg-loader": "^0.16.0", - "vue-template-compiler": "^2.7.0", + "vue-template-compiler": "^2.7.16", "webpack": "^5.11.0", "webpack-cli": "^5.0.0", "webpack-merge": "^5.0.0" @@ -73,7 +72,7 @@ "qrcode-generator": "^1.4.4", "qrcode-reader": "^1.0.4", "uuid": "^3.4.0", - "vue": "^2.6.12", + "vue": "^2.7.16", "vue2-dragula": "^2.5.4", "vuex": "^3.4.0" } diff --git a/src/background.ts b/src/background.ts index 30b95a15..73be3f77 100644 --- a/src/background.ts +++ b/src/background.ts @@ -3,7 +3,12 @@ import { Encryption } from "./models/encryption"; import { EntryStorage, ManagedStorage } from "./models/storage"; import { Dropbox, Drive, OneDrive } from "./models/backup"; import * as uuid from "uuid/v4"; -import { getSiteName, getMatchedEntries, getCurrentTab } from "./utils"; +import { + getSiteName, + getMatchedEntries, + getCurrentTab, + okToInjectContentScript, +} from "./utils"; import { CodeState } from "./models/otp"; import { getOTPAuthPerLineFromOPTAuthMigration } from "./models/migration"; @@ -456,7 +461,7 @@ chrome.commands.onCommand.addListener(async (command: string) => { } tab = await getCurrentTab(); - if (tab.id) { + if (okToInjectContentScript(tab)) { await chrome.scripting.executeScript({ target: { tabId: tab.id }, files: ["/dist/content.js"], @@ -473,7 +478,7 @@ chrome.commands.onCommand.addListener(async (command: string) => { case "autofill": tab = await getCurrentTab(); - if (tab.id) { + if (okToInjectContentScript(tab)) { await chrome.scripting.executeScript({ target: { tabId: tab.id }, files: ["/dist/content.js"], diff --git a/src/components/Popup/AddMethodPage.vue b/src/components/Popup/AddMethodPage.vue index 5fb0bee5..ca63065f 100644 --- a/src/components/Popup/AddMethodPage.vue +++ b/src/components/Popup/AddMethodPage.vue @@ -14,7 +14,7 @@