From 2202cf7d71b19d274cb8e6ab961c1c1a7080f8fd Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Wed, 17 Jul 2019 12:13:44 +0200 Subject: [PATCH 1/6] added tab update handlers --- src/background.js | 7 ++++++- src/manifest.json | 3 +++ src/messageHandlers.js | 31 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 30e06717d1..c635ef95d7 100644 --- a/src/background.js +++ b/src/background.js @@ -1,5 +1,9 @@ import 'babel-polyfill' -import { signMessageHandler, walletMessageHandler } from './messageHandlers' +import { + signMessageHandler, + walletMessageHandler, + bindRequestsToTabs +} from './messageHandlers' global.browser = require('webextension-polyfill') @@ -27,6 +31,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { return true }) +bindRequestsToTabs(whitelisted) // only allow whitelisted websites to send us messages function senderAllowed(sender) { diff --git a/src/manifest.json b/src/manifest.json index b3d60ddf61..065cf44938 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -31,5 +31,8 @@ "contentScript.js" ] } + ], + "permissions": [ + "tabs" ] } \ No newline at end of file diff --git a/src/messageHandlers.js b/src/messageHandlers.js index 6acb4c6dca..34f21957a5 100644 --- a/src/messageHandlers.js +++ b/src/messageHandlers.js @@ -125,3 +125,34 @@ function unqueueSignRequest(id) { } return signRequest } + +function removeSignRequestForTab(tabID) { + signRequestQueue + .filter(({ tabID: storedtabID }) => storedtabID === tabID) + .map(({ id }) => { + unqueueSignRequest(id) + }) +} + +// requests always reference a tab so that a response finds the right listener +// if a tab is killed or it's url changes the request is not useful anymore +export function bindRequestsToTabs(whitelisted) { + // check if tab got removed + chrome.tabs.onRemoved.addListener(function(tabID) { + removeSignRequestForTab(tabID) + }) + // check if url changed + chrome.tabs.onUpdated.addListener(function(tabID, changeInfo) { + // if the url doesn't change, ignore the update + if (!changeInfo.url) { + return + } + if ( + !whitelisted.find(whitelistedUrl => + changeInfo.url.startsWith(whitelistedUrl) + ) + ) { + removeSignRequestForTab(tabID) + } + }) +} From d17550486a46aef6550090437ea788ecad45a96b Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Wed, 17 Jul 2019 12:49:54 +0200 Subject: [PATCH 2/6] refactored --- src/background.js | 15 ++++----- src/messageHandlers.js | 69 ++++++++---------------------------------- src/requests.js | 28 +++++++++++++++++ src/tabsHandler.js | 22 ++++++++++++++ 4 files changed, 71 insertions(+), 63 deletions(-) create mode 100644 src/requests.js create mode 100644 src/tabsHandler.js diff --git a/src/background.js b/src/background.js index c635ef95d7..629ee64739 100644 --- a/src/background.js +++ b/src/background.js @@ -1,9 +1,7 @@ import 'babel-polyfill' -import { - signMessageHandler, - walletMessageHandler, - bindRequestsToTabs -} from './messageHandlers' +import { signMessageHandler, walletMessageHandler } from './messageHandlers' +import SignRequestQueue from './requests' +import { bindRequestsToTabs } from './tabsHandler' global.browser = require('webextension-polyfill') @@ -13,6 +11,9 @@ if (process.env.NODE_ENV === 'development') { whitelisted.push('https://localhost') } +const signRequestQueue = new SignRequestQueue() +signRequestQueue.unqueueSignRequest('') + // main message handler chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { if (!senderAllowed(sender)) { @@ -21,7 +22,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { } try { - signMessageHandler(message, sender, sendResponse) + signMessageHandler(signRequestQueue, message, sender, sendResponse) walletMessageHandler(message, sender, sendResponse) } catch (error) { // Return this as rejected @@ -31,7 +32,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { return true }) -bindRequestsToTabs(whitelisted) +bindRequestsToTabs(signRequestQueue, whitelisted) // only allow whitelisted websites to send us messages function senderAllowed(sender) { diff --git a/src/messageHandlers.js b/src/messageHandlers.js index 34f21957a5..a0b29a5179 100644 --- a/src/messageHandlers.js +++ b/src/messageHandlers.js @@ -9,10 +9,12 @@ const { getSeed } = require('@lunie/cosmos-keys') -let signRequestQueue = [] -unqueueSignRequest('') // restart icons on restart - -export function signMessageHandler(message, sender, sendResponse) { +export function signMessageHandler( + signRequestQueue, + message, + sender, + sendResponse +) { switch (message.type) { case 'LUNIE_SIGN_REQUEST': { const { signMessage, senderAddress } = message.payload @@ -20,14 +22,18 @@ export function signMessageHandler(message, sender, sendResponse) { if (!wallet) { throw new Error('No wallet found matching the sender address.') } - queueSignRequest({ signMessage, senderAddress, tabID: sender.tab.id }) + signRequestQueue.queueSignRequest({ + signMessage, + senderAddress, + tabID: sender.tab.id + }) break } case 'SIGN': { const { signMessage, senderAddress, password, id } = message.payload const wallet = getStoredWallet(senderAddress, password) - const { tabID } = unqueueSignRequest(id) + const { tabID } = signRequestQueue.unqueueSignRequest(id) const signature = signWithPrivateKey( signMessage, Buffer.from(wallet.privateKey, 'hex') @@ -54,7 +60,7 @@ export function signMessageHandler(message, sender, sendResponse) { type: 'LUNIE_SIGN_REQUEST_RESPONSE', payload: { rejected: true } }) - unqueueSignRequest(id) + signRequestQueue.unqueueSignRequest(id) sendResponse() // to popup break } @@ -107,52 +113,3 @@ function getWalletFromIndex(walletIndex, address) { ({ address: storedAddress }) => storedAddress === address ) } - -function queueSignRequest({ signMessage, senderAddress, tabID }) { - signRequestQueue.push({ signMessage, senderAddress, id: Date.now(), tabID }) - chrome.browserAction.setIcon({ path: 'icons/128x128-alert.png' }) -} - -function unqueueSignRequest(id) { - const signRequest = signRequestQueue.find( - ({ id: storedId }) => storedId === id - ) - signRequestQueue = signRequestQueue.filter( - ({ id: storedId }) => storedId !== id - ) - if (signRequestQueue.length === 0) { - chrome.browserAction.setIcon({ path: 'icons/128x128.png' }) - } - return signRequest -} - -function removeSignRequestForTab(tabID) { - signRequestQueue - .filter(({ tabID: storedtabID }) => storedtabID === tabID) - .map(({ id }) => { - unqueueSignRequest(id) - }) -} - -// requests always reference a tab so that a response finds the right listener -// if a tab is killed or it's url changes the request is not useful anymore -export function bindRequestsToTabs(whitelisted) { - // check if tab got removed - chrome.tabs.onRemoved.addListener(function(tabID) { - removeSignRequestForTab(tabID) - }) - // check if url changed - chrome.tabs.onUpdated.addListener(function(tabID, changeInfo) { - // if the url doesn't change, ignore the update - if (!changeInfo.url) { - return - } - if ( - !whitelisted.find(whitelistedUrl => - changeInfo.url.startsWith(whitelistedUrl) - ) - ) { - removeSignRequestForTab(tabID) - } - }) -} diff --git a/src/requests.js b/src/requests.js new file mode 100644 index 0000000000..40fad941d8 --- /dev/null +++ b/src/requests.js @@ -0,0 +1,28 @@ +export default class SignRequestQueue { + constructor() { + this.queue = [] + this.unqueueSignRequest('') // to reset the icon in the beginning + } + + queueSignRequest({ signMessage, senderAddress, tabID }) { + this.queue.push({ signMessage, senderAddress, id: Date.now(), tabID }) + chrome.browserAction.setIcon({ path: 'icons/128x128-alert.png' }) + } + + unqueueSignRequest(id) { + const signRequest = this.queue.find(({ id: storedId }) => storedId === id) + this.queue = this.queue.filter(({ id: storedId }) => storedId !== id) + if (this.queue.length === 0) { + chrome.browserAction.setIcon({ path: 'icons/128x128.png' }) + } + return signRequest + } + + unqueueSignRequestForTab(tabID) { + this.queue + .filter(({ tabID: storedtabID }) => storedtabID === tabID) + .map(({ id }) => { + this.unqueueSignRequest(id) + }) + } +} diff --git a/src/tabsHandler.js b/src/tabsHandler.js new file mode 100644 index 0000000000..c141cb5742 --- /dev/null +++ b/src/tabsHandler.js @@ -0,0 +1,22 @@ +// requests always reference a tab so that a response finds the right listener +// if a tab is killed or it's url changes the request is not useful anymore +export function bindRequestsToTabs(signRequestQueue, whitelisted) { + // check if tab got removed + chrome.tabs.onRemoved.addListener(function(tabID) { + signRequestQueue.unqueueSignRequestForTab(tabID) + }) + // check if url changed + chrome.tabs.onUpdated.addListener(function(tabID, changeInfo) { + // if the url doesn't change, ignore the update + if (!changeInfo.url) { + return + } + if ( + !whitelisted.find(whitelistedUrl => + changeInfo.url.startsWith(whitelistedUrl) + ) + ) { + signRequestQueue.unqueueSignRequestForTab(tabID) + } + }) +} From 2c653940c644655ebd4b1f0dbdacd5768d11e560 Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Wed, 17 Jul 2019 16:55:24 +0200 Subject: [PATCH 3/6] changelog --- pending/fabo_56-bind-requests-to-tabs | 1 + 1 file changed, 1 insertion(+) create mode 100644 pending/fabo_56-bind-requests-to-tabs diff --git a/pending/fabo_56-bind-requests-to-tabs b/pending/fabo_56-bind-requests-to-tabs new file mode 100644 index 0000000000..6302b3beb0 --- /dev/null +++ b/pending/fabo_56-bind-requests-to-tabs @@ -0,0 +1 @@ +[Changed] Remove pending sign requests if a tab closes or changes the URL @faboweb \ No newline at end of file From dc29ca99485e86d97e9ac5b07d208d1d3480e6fa Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Wed, 17 Jul 2019 16:55:33 +0200 Subject: [PATCH 4/6] updated dependencies --- package.json | 2 +- yarn.lock | 279 +++++++++++++++++++++++++++------------------------ 2 files changed, 151 insertions(+), 130 deletions(-) diff --git a/package.json b/package.json index e1874c3dbe..509ca336d8 100644 --- a/package.json +++ b/package.json @@ -106,4 +106,4 @@ "webpack-cli": "^3.1.2", "webpack-extension-reloader": "^1.1.0" } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 302ed513e0..0fe6dc86a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,13 +10,13 @@ "@babel/highlight" "^7.0.0" "@babel/core@>=7.2.2", "@babel/core@^7.1.0", "@babel/core@^7.1.2": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.0.tgz#6ed6a2881ad48a732c5433096d96d1b0ee5eb734" - integrity sha512-6Isr4X98pwXqHvtigw71CKgmhL1etZjPs5A67jL/w0TkLM9eqmFR40YrnJvEc1WnMZFsskjsmid8bHZyxKEAnw== + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.4.tgz#4c32df7ad5a58e9ea27ad025c11276324e0b4ddd" + integrity sha512-+DaeBEpYq6b2+ZmHx3tHspC+ZRflrvLqwfv8E3hNr5LVQoyBnL8RPKSBCg+rK2W2My9PWlujBiqd0ZPsR9Q6zQ== dependencies: "@babel/code-frame" "^7.0.0" "@babel/generator" "^7.5.0" - "@babel/helpers" "^7.5.0" + "@babel/helpers" "^7.5.4" "@babel/parser" "^7.5.0" "@babel/template" "^7.4.4" "@babel/traverse" "^7.5.0" @@ -195,10 +195,10 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.2.0" -"@babel/helpers@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.0.tgz#7f0c17666e7ed8355ed6eff643dde12fb681ddb4" - integrity sha512-EgCUEa8cNwuMrwo87l2d7i2oShi8m2Q58H7h3t4TWtqATZalJYFwfL9DulRe02f3KdqM9xmMCw3v/7Ll+EiaWg== +"@babel/helpers@^7.5.4": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.4.tgz#2f00608aa10d460bde0ccf665d6dcf8477357cf0" + integrity sha512-6LJ6xwUEJP51w0sIgKyfvFMJvIb9mWAfohJp0+m6eHJigkFdcH8duZ1sfhn0ltJRzwUIT/yqqhdSfRpCpL7oow== dependencies: "@babel/template" "^7.4.4" "@babel/traverse" "^7.5.0" @@ -243,10 +243,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-json-strings" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.0.tgz#4838ce3cbc9a84dd00bce7a17e9e9c36119f83a0" - integrity sha512-G1qy5EdcO3vYhbxlXjRSR2SXB8GsxYv9hoRKT1Jdn3qy/NUnFqUUnqymKZ00Pbj+3FXNh06B+BUZzecrp3sxNw== +"@babel/plugin-proposal-object-rest-spread@^7.5.4": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.4.tgz#250de35d867ce8260a31b1fdac6c4fc1baa99331" + integrity sha512-KCx0z3y7y8ipZUMAEEJOyNi11lMb/FOPUjjB113tfowgw0c16EGYos7worCKBcUAh2oG+OBnoUhsnTSoLpV9uA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" @@ -565,16 +565,16 @@ regexpu-core "^4.5.4" "@babel/preset-env@^7.1.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.0.tgz#1122a751e864850b4dbce38bd9b4497840ee6f01" - integrity sha512-/5oQ7cYg+6sH9Dt9yx5IiylnLPiUdyMHl5y+K0mKVNiW2wJ7FpU5bg8jKcT8PcCbxdYzfv6OuC63jLEtMuRSmQ== + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.4.tgz#64bc15041a3cbb0798930319917e70fcca57713d" + integrity sha512-hFnFnouyRNiH1rL8YkX1ANCNAUVC8Djwdqfev8i1415tnAG+7hlA5zhZ0Q/3Q5gkop4HioIPbCEWAalqcbxRoQ== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-proposal-async-generator-functions" "^7.2.0" "@babel/plugin-proposal-dynamic-import" "^7.5.0" "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.0" + "@babel/plugin-proposal-object-rest-spread" "^7.5.4" "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" "@babel/plugin-syntax-async-generators" "^7.2.0" @@ -621,9 +621,9 @@ semver "^5.5.0" "@babel/runtime-corejs3@^7.4.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.5.0.tgz#a1d87e8ad9c8f41fb9346ea23424d5cd2cfbe6f5" - integrity sha512-hS5GOWvqnYGG4GRbSe63nIc+45DmrIEa/lMGZPgCBq9BSCAZNcKxSDQJKtPDl2T+vaA/an+3G5rVmuh6cJLfqw== + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.5.4.tgz#88dab70e4915c8e8c7212b01ebd73e57159190cf" + integrity sha512-zTLh6E+I7jk03bW4pBahDLW04XF+ZWhzBS+7CKtz/C5OG2/PKHJDxSmI8oDEznVDhmKskh6RblHluTjMWY/P7Q== dependencies: core-js-pure "^3.0.0" regenerator-runtime "^0.13.2" @@ -978,9 +978,9 @@ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== "@types/node@*": - version "12.0.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.12.tgz#cc791b402360db1eaf7176479072f91ee6c6c7ca" - integrity sha512-Uy0PN4R5vgBUXFoJrKryf5aTk3kJ8Rv3PdlHjl6UaX+Cqp1QE0yPQ68MPXGrZOfG7gZVNDIJZYyot0B9ubXUrQ== + version "12.6.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.6.tgz#831587377c35bb28fa33b6fe5f849a26a3f4a412" + integrity sha512-SMgj3x28MkJyHdWaMv/g/ca3LYDi5gR7O8mX0VKazvFOnmlDXctSEdd/8jfSqozjKFK1R9If1QZWkafX7yQTpA== "@types/node@11.11.6": version "11.11.6" @@ -1205,11 +1205,6 @@ abbrev@1: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -acorn-dynamic-import@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" - integrity sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw== - acorn-globals@^4.1.0: version "4.3.2" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.2.tgz#4e2c2313a597fd589720395f6354b41cd5ec8006" @@ -1233,12 +1228,12 @@ acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.5, acorn@^6.0.7: +acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.7, acorn@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== -agent-base@^4.1.0: +agent-base@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== @@ -1251,14 +1246,14 @@ ajv-errors@^1.0.0: integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== ajv-keywords@^3.1.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.0.tgz#4b831e7b531415a7cc518cd404e73f6193c6349d" - integrity sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw== + version "3.4.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" + integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== -ajv@^6.1.0, ajv@^6.5.5, ajv@^6.9.1: - version "6.10.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" - integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== +ajv@^6.1.0, ajv@^6.10.2, ajv@^6.5.5, ajv@^6.9.1: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" @@ -1476,11 +1471,11 @@ async-limiter@^1.0.0, async-limiter@~1.0.0: integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== async@^2.0.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" - integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg== + version "2.6.3" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" + integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== dependencies: - lodash "^4.17.11" + lodash "^4.17.14" asynckit@^0.4.0: version "0.4.0" @@ -1493,17 +1488,17 @@ atob@^2.1.1: integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== autoprefixer@^9.5.1: - version "9.6.0" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.0.tgz#0111c6bde2ad20c6f17995a33fad7cf6854b4c87" - integrity sha512-kuip9YilBqhirhHEGHaBTZKXL//xxGnzvsD0FtBQa6z+A69qZD6s/BAX9VzDF1i9VKDquTJDQaPLSEhOnL6FvQ== + version "9.6.1" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.1.tgz#51967a02d2d2300bb01866c1611ec8348d355a47" + integrity sha512-aVo5WxR3VyvyJxcJC3h4FKfwCQvQWb1tSI5VHNibddCVWrcD1NvlxEweg3TSgiPztMnWfjpy2FURKA2kvDE+Tw== dependencies: - browserslist "^4.6.1" - caniuse-lite "^1.0.30000971" + browserslist "^4.6.3" + caniuse-lite "^1.0.30000980" chalk "^2.4.2" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^7.0.16" - postcss-value-parser "^3.3.1" + postcss "^7.0.17" + postcss-value-parser "^4.0.0" autosize@^4.0.2: version "4.0.2" @@ -1849,14 +1844,14 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.6.0, browserslist@^4.6.1, browserslist@^4.6.2: - version "4.6.3" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.3.tgz#0530cbc6ab0c1f3fc8c819c72377ba55cf647f05" - integrity sha512-CNBqTCq22RKM8wKJNowcqihHJ4SkI8CGeK7KOR9tPboXUuS5Zk5lQgzzTbs4oxD8x+6HUshZUa2OyNI9lR93bQ== +browserslist@^4.6.0, browserslist@^4.6.2, browserslist@^4.6.3: + version "4.6.6" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.6.tgz#6e4bf467cde520bc9dbdf3747dafa03531cec453" + integrity sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA== dependencies: - caniuse-lite "^1.0.30000975" - electron-to-chromium "^1.3.164" - node-releases "^1.1.23" + caniuse-lite "^1.0.30000984" + electron-to-chromium "^1.3.191" + node-releases "^1.1.25" bs58@^4.0.0: version "4.0.1" @@ -2056,10 +2051,10 @@ camelcase@^5.0.0, camelcase@^5.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30000971, caniuse-lite@^1.0.30000975: - version "1.0.30000979" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000979.tgz#92f16d00186a6cf20d6c5711bb6e042a3d667029" - integrity sha512-gcu45yfq3B7Y+WB05fOMfr0EiSlq+1u+m6rPHyJli/Wy3PVQNGaU7VA4bZE5qw+AU2UVOBR/N5g1bzADUqdvFw== +caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984: + version "1.0.30000984" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000984.tgz#dc96c3c469e9bcfc6ad5bdd24c77ec918ea76fe0" + integrity sha512-n5tKOjMaZ1fksIpQbjERuqCyfgec/m9pferkFQbLmWtqLUdmt12hNhjSwsmPdqeiG2NkITOQhr1VYIwWSAceiA== capture-exit@^2.0.0: version "2.0.0" @@ -2302,7 +2297,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^2.19.0, commander@^2.20.0, commander@^2.9.0, commander@~2.20.0: +commander@^2.20.0, commander@^2.9.0, commander@~2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== @@ -2570,17 +2565,17 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -"cssom@>= 0.3.2 < 0.4.0", cssom@~0.3.6: +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.8" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== cssstyle@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.3.0.tgz#c36c466f7037fd30f03baa271b65f0f17b50585c" - integrity sha512-wXsoRfsRfsLVNaVzoKdqvEmK/5PFaEXNspVT22Ots6K/cnJdpoDKuQFw+qlMiXnmaif1OgeC466X1zISgAOcGg== + version "1.4.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" + integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== dependencies: - cssom "~0.3.6" + cssom "0.3.x" currently-unhandled@^0.4.1: version "0.4.1" @@ -2868,10 +2863,10 @@ ejs@^2.6.1: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.2.tgz#3a32c63d1cd16d11266cd4703b14fec4e74ab4f6" integrity sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q== -electron-to-chromium@^1.3.164: - version "1.3.187" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.187.tgz#fea64435f370892c0f27aded1bbdcb6f235c592b" - integrity sha512-XCEygaK7Fs35/RwS+67YbBWs/ydG+oUFPuy1wv558jC3Opd2DHwRyRqrCmhxpmPmCSVlZujYX4TOmOXuMz2GZA== +electron-to-chromium@^1.3.191: + version "1.3.193" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.193.tgz#de9b89959288070bffb14557daf8cf9f75b2caf8" + integrity sha512-WX01CG1UoPtTUFaKKwMn+u8nJ63loP6hNxePWtk1pN8ibWMyX1q6TiWPsz1ABBKXezvmaIdtP+0BwzjC1wyCaw== elegant-spinner@^1.0.1: version "1.0.1" @@ -3120,9 +3115,11 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3: estraverse "^4.1.1" eslint-utils@^1.3.0, eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" - integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== + version "1.4.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c" + integrity sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ== + dependencies: + eslint-visitor-keys "^1.0.0" eslint-visitor-keys@^1.0.0: version "1.0.0" @@ -3332,9 +3329,9 @@ extend@^3.0.0, extend@~3.0.2: integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== external-editor@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" - integrity sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA== + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: chardet "^0.7.0" iconv-lite "^0.4.24" @@ -4064,11 +4061,11 @@ https-browserify@^1.0.0: integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= https-proxy-agent@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" - integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ== + version "2.2.2" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz#271ea8e90f836ac9f119daccd39c19ff7dfb0793" + integrity sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg== dependencies: - agent-base "^4.1.0" + agent-base "^4.3.0" debug "^3.1.0" husky@^2.4.0: @@ -4223,9 +4220,9 @@ ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== inquirer@^6.2.2: - version "6.4.1" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.4.1.tgz#7bd9e5ab0567cd23b41b0180b68e0cfa82fc3c0b" - integrity sha512-/Jw+qPZx4EDYsaT6uz7F4GJRNFMRdKNeUZw3ZnKV8lyuUgz/YWRCSUAJMZSVhSq4Ec0R2oYnyi6b3d4JXcL5Nw== + version "6.5.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" + integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== dependencies: ansi-escapes "^3.2.0" chalk "^2.4.2" @@ -4233,7 +4230,7 @@ inquirer@^6.2.2: cli-width "^2.0.0" external-editor "^3.0.3" figures "^2.0.0" - lodash "^4.17.11" + lodash "^4.17.12" mute-stream "0.0.7" run-async "^2.2.0" rxjs "^6.4.0" @@ -5171,6 +5168,11 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + lint-prepush@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/lint-prepush/-/lint-prepush-0.4.1.tgz#db2dbba1ddb105dee91b4868f55586eabe242c9c" @@ -5352,10 +5354,10 @@ lodash.union@^4.6.0: resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88" integrity sha1-SLtQiECfFvGCFmZkHETdGqrjzYg= -lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.4, lodash@~4.17.10: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.4, lodash@~4.17.10: + version "4.17.14" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" + integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== log-symbols@^1.0.2: version "1.0.2" @@ -5919,7 +5921,7 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.23: +node-releases@^1.1.25: version "1.1.25" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.25.tgz#0c2d7dbc7fed30fbe02a9ee3007b8c90bf0133d3" integrity sha512-fI5BXuk83lKEoZDdH3gRhtsNgh05/wZacuXkgbiYkceE7+QIMXOg98n9ZV7mz27B+kFHnqHcUpscZZlGRSmTpQ== @@ -6328,6 +6330,16 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" @@ -6668,7 +6680,12 @@ postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== -postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.2, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7: +postcss-value-parser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.0.tgz#99a983d365f7b2ad8d0f9b8c3094926eab4b936d" + integrity sha512-ESPktioptiSUchCKgggAkzdmkgzKfmp0EU8jXH+5kbIUB+unr0Y4CY9SRMvibuvYUBjNh1ACLbxqYNpdTQOteQ== + +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.2, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7: version "7.0.17" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== @@ -6943,14 +6960,14 @@ read-pkg@^3.0.0: path-type "^3.0.0" read-pkg@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.1.1.tgz#5cf234dde7a405c90c88a519ab73c467e9cb83f5" - integrity sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w== + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== dependencies: "@types/normalize-package-data" "^2.4.0" normalize-package-data "^2.5.0" - parse-json "^4.0.0" - type-fest "^0.4.1" + parse-json "^5.0.0" + type-fest "^0.6.0" "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" @@ -7049,9 +7066,9 @@ regex-not@^1.0.0, regex-not@^1.0.2: safe-regex "^1.1.0" regexp-tree@^0.1.6: - version "0.1.10" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc" - integrity sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ== + version "0.1.11" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.11.tgz#c9c7f00fcf722e0a56c7390983a7a63dd6c272f3" + integrity sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg== regexpp@^2.0.1: version "2.0.1" @@ -7322,7 +7339,12 @@ rxjs@^6.3.3, rxjs@^6.4.0: dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== @@ -7599,7 +7621,7 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@~0.5.10: +source-map-support@^0.5.6, source-map-support@~0.5.12: version "0.5.12" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== @@ -7651,9 +7673,9 @@ spdx-expression-parse@^3.0.0: spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz#75ecd1a88de8c184ef015eafb51b5b48bfd11bb1" - integrity sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA== + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== specificity@^0.4.1: version "0.4.1" @@ -7998,12 +8020,12 @@ symbol-tree@^3.2.2: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== table@^5.2.3: - version "5.4.1" - resolved "https://registry.yarnpkg.com/table/-/table-5.4.1.tgz#0691ae2ebe8259858efb63e550b6d5f9300171e8" - integrity sha512-E6CK1/pZe2N75rGZQotFOdmzWQ1AILtgYbMAbAjvms0S1l5IDB47zG3nCnFGB/w+7nB3vKofbLXCH7HPBo864w== + version "5.4.4" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.4.tgz#6e0f88fdae3692793d1077fd172a4667afe986a6" + integrity sha512-IIfEAUx5QlODLblLrGTTLJA7Tk0iLSGBvgY8essPRVNGHAzThujww1YqHLs6h3HfTg55h++RzLHH5Xw/rfv+mg== dependencies: - ajv "^6.9.1" - lodash "^4.17.11" + ajv "^6.10.2" + lodash "^4.17.14" slice-ansi "^2.1.0" string-width "^3.0.0" @@ -8064,13 +8086,13 @@ terser-webpack-plugin@^1.1.0: worker-farm "^1.7.0" terser@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.0.2.tgz#580cea06c4932f46a48ed13804c93bc93c275968" - integrity sha512-IWLuJqTvx97KP3uTYkFVn93cXO+EtlzJu8TdJylq+H0VBDlPMIfQA9MBS5Vc5t3xTEUG1q0hIfHMpAP2R+gWTw== + version "4.1.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.1.2.tgz#b2656c8a506f7ce805a3f300a2ff48db022fa391" + integrity sha512-jvNoEQSPXJdssFwqPSgWjsOrb+ELoE+ILpHPKXC83tIxOlh2U75F1KuB2luLD/3a6/7K3Vw5pDn+hvu0C4AzSw== dependencies: - commander "^2.19.0" + commander "^2.20.0" source-map "~0.6.1" - source-map-support "~0.5.10" + source-map-support "~0.5.12" test-exclude@^5.2.3: version "5.2.3" @@ -8276,10 +8298,10 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-fest@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.4.1.tgz#8bdf77743385d8a4f13ba95f610f5ccd68c728f8" - integrity sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw== +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== typedarray@^0.0.6: version "0.0.6" @@ -8665,9 +8687,9 @@ webidl-conversions@^4.0.2: integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== webpack-cli@^3.1.2: - version "3.3.5" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.5.tgz#f4d1238a66a2843d9cebf189835ea22142e72767" - integrity sha512-w0j/s42c5UhchwTmV/45MLQnTVwRoaUTu9fM5LuyOd/8lFoCNCELDogFoecx5NzRUndO0yD/gF2b02XKMnmAWQ== + version "3.3.6" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.6.tgz#2c8c399a2642133f8d736a359007a052e060032c" + integrity sha512-0vEa83M7kJtxK/jUhlpZ27WHIOndz5mghWL2O53kiDoA9DIxSKnfqB92LoqEn77cT4f3H2cZm1BMEat/6AZz3A== dependencies: chalk "2.4.2" cross-spawn "6.0.5" @@ -8703,16 +8725,15 @@ webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.3.0: source-map "~0.6.1" webpack@^4.20.2: - version "4.35.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.35.2.tgz#5c8b8a66602cbbd6ec65c6e6747914a61c1449b1" - integrity sha512-TZAmorNymV4q66gAM/h90cEjG+N3627Q2MnkSgKlX/z3DlNVKUtqy57lz1WmZU2+FUZwzM+qm7cGaO95PyrX5A== + version "4.36.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.36.1.tgz#f546fda7a403a76faeaaa7196c50d12370ed18a9" + integrity sha512-Ej01/N9W8DVyhEpeQnbUdGvOECw0L46FxS12cCOs8gSK7bhUlrbHRnWkjiXckGlHjUrmL89kDpTRIkUk6Y+fKg== dependencies: "@webassemblyjs/ast" "1.8.5" "@webassemblyjs/helper-module-context" "1.8.5" "@webassemblyjs/wasm-edit" "1.8.5" "@webassemblyjs/wasm-parser" "1.8.5" - acorn "^6.0.5" - acorn-dynamic-import "^4.0.0" + acorn "^6.2.0" ajv "^6.1.0" ajv-keywords "^3.1.0" chrome-trace-event "^1.0.0" @@ -8871,9 +8892,9 @@ ws@^6.1.0: async-limiter "~1.0.0" ws@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.0.1.tgz#1a04e86cc3a57c03783f4910fdb090cf31b8e165" - integrity sha512-ILHfMbuqLJvnSgYXLgy4kMntroJpe8hT41dOVWM8bxRuw6TK4mgMp9VJUNsZTEc5Bh+Mbs0DJT4M0N+wBG9l9A== + version "7.1.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.1.0.tgz#0395646c6fcc3ac56abf61ce1a42039637a6bd98" + integrity sha512-Swie2C4fs7CkwlHu1glMePLYJJsWjzhl1vm3ZaLplD0h7OMkZyZ6kLTB/OagiU923bZrPFXuDTeEqaEN4NWG4g== dependencies: async-limiter "^1.0.0" @@ -8888,9 +8909,9 @@ xml-name-validator@^3.0.0: integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68= + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== y18n@^3.2.1: version "3.2.1" From b83df221bae9e5bdd2416cdebc0894ba00cf662a Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Wed, 17 Jul 2019 17:16:40 +0200 Subject: [PATCH 5/6] add tests for requests --- lunie | 2 +- src/messageHandlers.js | 4 +-- src/requests.js | 4 +++ test/unit/requests.spec.js | 59 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 test/unit/requests.spec.js diff --git a/lunie b/lunie index ec0eccbad8..689bd9da59 160000 --- a/lunie +++ b/lunie @@ -1 +1 @@ -Subproject commit ec0eccbad8b836d7b4dc6b723932995acf7e2c87 +Subproject commit 689bd9da59568935c172f99d99894a3600be22e6 diff --git a/src/messageHandlers.js b/src/messageHandlers.js index a0b29a5179..27d65a59bb 100644 --- a/src/messageHandlers.js +++ b/src/messageHandlers.js @@ -49,9 +49,7 @@ export function signMessageHandler( break } case 'GET_SIGN_REQUEST': { - sendResponse( - signRequestQueue.length > 0 ? signRequestQueue[0] : undefined - ) + sendResponse(signRequestQueue.getSignRequest()) break } case 'REJECT_SIGN_REQUEST': { diff --git a/src/requests.js b/src/requests.js index 40fad941d8..8649814e45 100644 --- a/src/requests.js +++ b/src/requests.js @@ -25,4 +25,8 @@ export default class SignRequestQueue { this.unqueueSignRequest(id) }) } + + getSignRequest() { + return this.queue.length > 0 ? this.queue[0] : undefined + } } diff --git a/test/unit/requests.spec.js b/test/unit/requests.spec.js new file mode 100644 index 0000000000..564a2b3ace --- /dev/null +++ b/test/unit/requests.spec.js @@ -0,0 +1,59 @@ +import SignRequestQueue from '../../src/requests' + +const mockSignRequest = { + signMessage: 'HALLOOOOO', + senderAddress: 'cosmos1234', + tabID: 42, + id: expect.any(Number) +} + +describe('Sign request queue', () => { + let instance + + beforeEach(() => { + global.chrome = { + browserAction: { + setIcon: jest.fn() + } + } + instance = new SignRequestQueue() + global.chrome.browserAction.setIcon.mockClear() + }) + + it('should queue a sign request', () => { + instance.queueSignRequest(mockSignRequest) + expect(instance.getSignRequest()).toEqual(mockSignRequest) + }) + + it('should unqueue a sign request', () => { + instance.queueSignRequest(mockSignRequest) + const { id } = instance.queue[0] + instance.unqueueSignRequest(id) + + expect(instance.getSignRequest()).toEqual(undefined) + }) + + it('should unqueueSignRequestForTab', () => { + instance.queueSignRequest(mockSignRequest) + instance.unqueueSignRequestForTab(42) + + expect(instance.getSignRequest()).toEqual(undefined) + }) + + describe('icons', () => { + it('shows a pending sign request icon', () => { + instance.queueSignRequest(mockSignRequest) + expect(global.chrome.browserAction.setIcon).toHaveBeenCalled() + }) + + it('removed the pending sign request icon', () => { + instance.queueSignRequest(mockSignRequest) + expect(global.chrome.browserAction.setIcon).toHaveBeenCalled() + + global.chrome.browserAction.setIcon.mockClear() + + instance.unqueueSignRequestForTab(42) + expect(global.chrome.browserAction.setIcon).toHaveBeenCalled() + }) + }) +}) From 5de91b26e4f498b093000edbedcc0a5764787dae Mon Sep 17 00:00:00 2001 From: Fabian Weber Date: Wed, 17 Jul 2019 17:26:21 +0200 Subject: [PATCH 6/6] added tabs listener specs --- test/unit/tabsHandler.spec.js | 48 +++++++++++++++++++++++++++++++++++ test/unit/test.spec.js | 5 ---- 2 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 test/unit/tabsHandler.spec.js delete mode 100644 test/unit/test.spec.js diff --git a/test/unit/tabsHandler.spec.js b/test/unit/tabsHandler.spec.js new file mode 100644 index 0000000000..ac2e97c969 --- /dev/null +++ b/test/unit/tabsHandler.spec.js @@ -0,0 +1,48 @@ +import { bindRequestsToTabs } from '../../src/tabsHandler' + +describe('Sign request queue', () => { + let signRequestQueue + + beforeEach(() => { + signRequestQueue = { + unqueueSignRequestForTab: jest.fn() + } + }) + + it('kills on tab removal', () => { + global.chrome = { + tabs: { + onRemoved: { addListener: callback => callback(42) }, + onUpdated: { addListener: () => {} } + } + } + bindRequestsToTabs(signRequestQueue, []) + + expect(signRequestQueue.unqueueSignRequestForTab).toHaveBeenCalledWith(42) + expect(signRequestQueue.unqueueSignRequestForTab).toHaveBeenCalledTimes(1) + }) + + it('kills on tab url not accepted', () => { + global.chrome = { + tabs: { + onRemoved: { addListener: () => {} }, + onUpdated: { addListener: callback => callback(42, {}) } + } + } + bindRequestsToTabs(signRequestQueue, ['https://lunie.io']) + expect(signRequestQueue.unqueueSignRequestForTab).not.toHaveBeenCalled() + + global.chrome = { + tabs: { + onRemoved: { addListener: () => {} }, + onUpdated: { + addListener: callback => callback(42, { url: 'https://funkytown.io' }) + } + } + } + bindRequestsToTabs(signRequestQueue, ['https://lunie.io']) + + expect(signRequestQueue.unqueueSignRequestForTab).toHaveBeenCalledWith(42) + expect(signRequestQueue.unqueueSignRequestForTab).toHaveBeenCalledTimes(1) + }) +}) diff --git a/test/unit/test.spec.js b/test/unit/test.spec.js deleted file mode 100644 index 4bb1f6a9af..0000000000 --- a/test/unit/test.spec.js +++ /dev/null @@ -1,5 +0,0 @@ -describe('TEST', () => { - it('TEST', () => { - expect(true).toBe(true); - }); -});